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));
}