resolveDirectoryPermissions example

$options->setDefined(['file', 'dir', 'url']);

        $options->setAllowedTypes('root', 'string');
        $options->setAllowedTypes('file', 'array');
        $options->setAllowedTypes('dir', 'array');

        $options->setDefault('file', []);
        $options->setDefault('dir', []);

        $config = $options->resolve($config);
        $config['file'] = $this->resolveFilePermissions($config['file']);
        $config['dir'] = $this->resolveDirectoryPermissions($config['dir']);

        return $config;
    }

    private function resolveFilePermissions(array $permissions): array
    {
        $options = new OptionsResolver();

        $options->setDefined(['public', 'private']);

        $options->setAllowedTypes('public', 'int');
        
$options->setAllowedTypes('file', 'array');
        $options->setAllowedTypes('dir', 'array');
        $options->setAllowedTypes('mediaUrl', 'string');
        $options->setAllowedTypes('type', 'string');
        $options->setAllowedTypes('permissions', 'array');

        $options->setDefault('file', []);
        $options->setDefault('dir', []);

        $config = $options->resolve($config);
        $config['file'] = $this->resolveFilePermissions($config['file']);
        $config['dir'] = $this->resolveDirectoryPermissions($config['dir']);

        return $config;
    }

    /** * @return array */
    private function resolveFilePermissions(array $permissions)
    {
        $options = new OptionsResolver();

        
Home | Imprint | This part of the site doesn't use cookies.