Josegonzalez\Upload\Model\Behavior\UploadBehavior::getPathProcessor PHP Method

getPathProcessor() public method

Retrieves an instance of a path processor which knows how to build paths for a given file upload
public getPathProcessor ( Cake\ORM\Entity $entity, array $data, string $field, array $settings ) : Josegonzalez\Upload\File\Path\AbstractProcessor
$entity Cake\ORM\Entity an entity
$data array the data being submitted for a save
$field string the field for which data will be saved
$settings array the settings for the current field
return Josegonzalez\Upload\File\Path\AbstractProcessor
    public function getPathProcessor(Entity $entity, $data, $field, $settings)
    {
        $default = 'Josegonzalez\\Upload\\File\\Path\\DefaultProcessor';
        $processorClass = Hash::get($settings, 'pathProcessor', $default);
        if (is_subclass_of($processorClass, 'Josegonzalez\\Upload\\File\\Path\\ProcessorInterface')) {
            return new $processorClass($this->_table, $entity, $data, $field, $settings);
        }
        throw new UnexpectedValueException(sprintf("'pathProcessor' not set to instance of ProcessorInterface: %s", $processorClass));
    }