resolveCredentialsOptions example

$options->setAllowedTypes('region', 'string');
        $options->setAllowedTypes('version', 'string');
        $options->setAllowedTypes('root', 'string');
        $options->setAllowedTypes('metaOptions', 'array');

        $options->setDefault('version', 'latest');
        $options->setDefault('root', '');
        $options->setDefault('endpoint', null);
        $options->setDefault('metaOptions', []);

        $config = $options->resolve($definition);
        $config['credentials'] = $this->resolveCredentialsOptions($config['credentials']);

        return $config;
    }

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

        
$options->setAllowedTypes('options', 'array');
        $options->setAllowedTypes('endpoint', 'string');
        $options->setAllowedTypes('use_path_style_endpoint', 'bool');

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

        /** @var S3Config $config */
        $config = $options->resolve($definition);

        if (\array_key_exists('credentials', $config)) {
            $config['credentials'] = $this->resolveCredentialsOptions($config['credentials']);
        }

        return $config;
    }

    /** * @param array<string, mixed> $credentials * * @return array{key: string, secret: string} */
    private function resolveCredentialsOptions(array $credentials): array
    {
Home | Imprint | This part of the site doesn't use cookies.