src/Model/Behavior/UploadBehavior.php
public function getWriter(Entity $entity, $data, $field, $settings)
    {
        $default = 'Josegonzalez\Upload\File\Writer\DefaultWriter';
        $writerClass = Hash::get($settings, 'writer', $default);
        if (is_subclass_of($writerClass, 'Josegonzalez\Upload\File\Writer\WriterInterface')) {
            return new $writerClass($this->_table, $entity, $data, $field, $settings);
        }

        throw new UnexpectedValueException(sprintf(
            "'writer' not set to instance of WriterInterface: %s",
            $writerClass
        ));
    }
public function getWriter(Entity $entity, $data, $field, $settings)
    {
        $default = 'Josegonzalez\Upload\File\Writer\DefaultWriter';
        $writerClass = Hash::get($settings, 'writer', $default);
        if (is_subclass_of($writerClass, 'Josegonzalez\Upload\File\Writer\WriterInterface')) {
            return new $writerClass($this->_table, $entity, $data, $field, $settings);
        }

        throw new UnexpectedValueException(sprintf(
            "'writer' not set to instance of WriterInterface: %s",
            $writerClass
        ));
    }
public function getWriter ( Entity $ entity , $ data , $ field , $ settings ) { $ default = 'Josegonzalez\Upload\File\Writer\DefaultWriter' ; $ writerClass = Hash :: get ( $ settings , 'writer' , $ default ) ; if ( is_subclass_of ( $ writerClass , 'Josegonzalez\Upload\File\Writer\WriterInterface' ) ) { return new $ writerClass ( $ this -> _table , $ entity , $ data , $ field , $ settings ) ; } throw new UnexpectedValueException ( sprintf ( "'writer' not set to instance of WriterInterface: %s" , $ writerClass ) ) ; }
Retrieves an instance of a file writer which knows how to write files to disk

@param \Cake\ORM\Entity $entity an entity
@param array $data the data being submitted for a save
@param string $field the field for which data will be saved
@param array $settings the settings for the current field
@return \Josegonzalez\Upload\File\Path\AbstractProcessor
Retrieves an instance of a file writer which knows how to write files to disk