Josegonzalez\Upload\File\Writer\DefaultWriter::getFilesystem PHP Method

getFilesystem() public method

Retrieves a configured filesystem for the given field
public getFilesystem ( string $field, array $settings = [] ) : League\Flysystem\FilesystemInterface
$field string the field for which data will be saved
$settings array the settings for the current field
return League\Flysystem\FilesystemInterface
    public function getFilesystem($field, array $settings = [])
    {
        $adapter = new Local(Hash::get($settings, 'filesystem.root', ROOT . DS));
        $adapter = Hash::get($settings, 'filesystem.adapter', $adapter);
        if (is_callable($adapter)) {
            $adapter = $adapter();
        }
        if ($adapter instanceof AdapterInterface) {
            return new Filesystem($adapter, Hash::get($settings, 'filesystem.options', ['visibility' => AdapterInterface::VISIBILITY_PUBLIC]));
        }
        throw new UnexpectedValueException(sprintf("Invalid Adapter for field %s", $field));
    }