protected function configureData($data)
    {
        if (is_string($data)) {
            if (!empty($this->Options)) {
                $fileField = end($this->Options);
                $data = array(
                    $fileField => $data
                );
            } else {
                throw new RequiredOptionsException(get_called_class(), "Options are required, when passing String for data.");
            }
        }
        if (is_array($data)) {
            foreach ($data as $key => $value) {
                if (!array_key_exists($key, $this->_REQUIRED_DATA)) {
                    $data[$key] = $this->setFileFieldValue($value);
                }
            }
        }
        parent::configureData($data);
    }
protected function configureData($data)
    {
        if (is_string($data)) {
            if (!empty($this->Options)) {
                $fileField = end($this->Options);
                $data = array(
                    $fileField => $data
                );
            } else {
                throw new RequiredOptionsException(get_called_class(), "Options are required, when passing String for data.");
            }
        }
        if (is_array($data)) {
            foreach ($data as $key => $value) {
                if (!array_key_exists($key, $this->_REQUIRED_DATA)) {
                    $data[$key] = $this->setFileFieldValue($value);
                }
            }
        }
        parent::configureData($data);
    }
protected function configureData ( $ data ) { if ( is_string ( $ data ) ) { if ( ! empty ( $ this -> Options ) ) { $ fileField = end ( $ this -> Options ) ; $ data = array ( $ fileField => $ data ) ; } else { throw new RequiredOptionsException ( get_called_class ( ) , "Options are required, when passing String for data." ) ; } } if ( is_array ( $ data ) ) { foreach ( $ data as $ key => $ value ) { if ( ! array_key_exists ( $ key , $ this -> _REQUIRED_DATA ) ) { $ data [ $ key ] = $ this -> setFileFieldValue ( $ value ) ; } } } parent :: configureData ( $ data ) ; }
Allow for shorthand calling of attachFile method.
Users can simply submit the File in via string, or pass the filename => path
@param $data
@throws RequiredOptionsException
Allow for shorthand calling of attachFile method . Users can simply submit the File in via string or pass the filename = > path