public function configureFilesystemAdapter(ContainerBuilder $container, array $config): void
    {
        // add the default configuration for the S3 filesystem
        if ($container->hasDefinition('bkstg.core.adapter.filesystem.do_spaces') && isset($config['filesystem'])) {
            $container->getDefinition('bkstg.core.adapter.filesystem.do_spaces')
                ->replaceArgument(0, new Reference('bkstg.core.adapter.service.do_spaces'))
                ->replaceArgument(1, $config['filesystem']['bucket'])
                ->replaceArgument(
                    2,
                    [
                        'create' => $config['filesystem']['create'],
                        'region' => $config['filesystem']['region'],
                        'directory' => $config['filesystem']['directory'],
                        'ACL' => $config['filesystem']['acl'],
                    ]
                )
            ;

            if (3 === $config['filesystem']['sdk_version']) {
                $arguments = [
                    'region' => $config['filesystem']['region'],
                    'version' => $config['filesystem']['version'],
                ];

                if (isset($config['filesystem']['secretKey'], $config['filesystem']['accessKey'])) {
                    $arguments['credentials'] = [
                        'secret' => $config['filesystem']['secretKey'],
                        'key' => $config['filesystem']['accessKey'],
                    ];
                }

                if (isset($config['filesystem']['endpoint'])) {
                    $arguments['endpoint'] = $config['filesystem']['endpoint'];
                } else {
                    $arguments['endpoint'] = sprintf(
                        'https://%s.digitaloceanspaces.com',
                        $config['filesystem']['region']
                    );
                }

                $container->getDefinition('bkstg.core.adapter.service.do_spaces')
                    ->replaceArgument(0, $arguments)
                ;
            } else {
                $container->getDefinition('bkstg.core.adapter.service.do_spaces')
                    ->replaceArgument(0, [
                        'secret' => $config['filesystem']['secretKey'],
                        'key' => $config['filesystem']['accessKey'],
                    ])
                ;
            }
        } else {
            $container->removeDefinition('bkstg.core.adapter.filesystem.do_spaces');
            $container->removeDefinition('bkstg.core.filesystem.do_spaces');
        }
    }
public function configureFilesystemAdapter(ContainerBuilder $container, array $config): void
    {
        // add the default configuration for the S3 filesystem
        if ($container->hasDefinition('bkstg.core.adapter.filesystem.do_spaces') && isset($config['filesystem'])) {
            $container->getDefinition('bkstg.core.adapter.filesystem.do_spaces')
                ->replaceArgument(0, new Reference('bkstg.core.adapter.service.do_spaces'))
                ->replaceArgument(1, $config['filesystem']['bucket'])
                ->replaceArgument(
                    2,
                    [
                        'create' => $config['filesystem']['create'],
                        'region' => $config['filesystem']['region'],
                        'directory' => $config['filesystem']['directory'],
                        'ACL' => $config['filesystem']['acl'],
                    ]
                )
            ;

            if (3 === $config['filesystem']['sdk_version']) {
                $arguments = [
                    'region' => $config['filesystem']['region'],
                    'version' => $config['filesystem']['version'],
                ];

                if (isset($config['filesystem']['secretKey'], $config['filesystem']['accessKey'])) {
                    $arguments['credentials'] = [
                        'secret' => $config['filesystem']['secretKey'],
                        'key' => $config['filesystem']['accessKey'],
                    ];
                }

                if (isset($config['filesystem']['endpoint'])) {
                    $arguments['endpoint'] = $config['filesystem']['endpoint'];
                } else {
                    $arguments['endpoint'] = sprintf(
                        'https://%s.digitaloceanspaces.com',
                        $config['filesystem']['region']
                    );
                }

                $container->getDefinition('bkstg.core.adapter.service.do_spaces')
                    ->replaceArgument(0, $arguments)
                ;
            } else {
                $container->getDefinition('bkstg.core.adapter.service.do_spaces')
                    ->replaceArgument(0, [
                        'secret' => $config['filesystem']['secretKey'],
                        'key' => $config['filesystem']['accessKey'],
                    ])
                ;
            }
        } else {
            $container->removeDefinition('bkstg.core.adapter.filesystem.do_spaces');
            $container->removeDefinition('bkstg.core.filesystem.do_spaces');
        }
    }
public function configureFilesystemAdapter ( ContainerBuilder $ container , array $ config ) : void { // add the default configuration for the S3 filesystem if ( $ container -> hasDefinition ( 'bkstg.core.adapter.filesystem.do_spaces' ) && isset ( $ config [ 'filesystem' ] ) ) { $ container -> getDefinition ( 'bkstg.core.adapter.filesystem.do_spaces' ) -> replaceArgument ( 0 , new Reference ( 'bkstg.core.adapter.service.do_spaces' ) ) -> replaceArgument ( 1 , $ config [ 'filesystem' ] [ 'bucket' ] ) -> replaceArgument ( 2 , [ 'create' => $ config [ 'filesystem' ] [ 'create' ] , 'region' => $ config [ 'filesystem' ] [ 'region' ] , 'directory' => $ config [ 'filesystem' ] [ 'directory' ] , 'ACL' => $ config [ 'filesystem' ] [ 'acl' ] , ] ) ; if ( 3 === $ config [ 'filesystem' ] [ 'sdk_version' ] ) { $ arguments = [ 'region' => $ config [ 'filesystem' ] [ 'region' ] , 'version' => $ config [ 'filesystem' ] [ 'version' ] , ] ; if ( isset ( $ config [ 'filesystem' ] [ 'secretKey' ] , $ config [ 'filesystem' ] [ 'accessKey' ] ) ) { $ arguments [ 'credentials' ] = [ 'secret' => $ config [ 'filesystem' ] [ 'secretKey' ] , 'key' => $ config [ 'filesystem' ] [ 'accessKey' ] , ] ; } if ( isset ( $ config [ 'filesystem' ] [ 'endpoint' ] ) ) { $ arguments [ 'endpoint' ] = $ config [ 'filesystem' ] [ 'endpoint' ] ; } else { $ arguments [ 'endpoint' ] = sprintf ( 'https://%s.digitaloceanspaces.com' , $ config [ 'filesystem' ] [ 'region' ] ) ; } $ container -> getDefinition ( 'bkstg.core.adapter.service.do_spaces' ) -> replaceArgument ( 0 , $ arguments ) ; } else { $ container -> getDefinition ( 'bkstg.core.adapter.service.do_spaces' ) -> replaceArgument ( 0 , [ 'secret' => $ config [ 'filesystem' ] [ 'secretKey' ] , 'key' => $ config [ 'filesystem' ] [ 'accessKey' ] , ] ) ; } } else { $ container -> removeDefinition ( 'bkstg.core.adapter.filesystem.do_spaces' ) ; $ container -> removeDefinition ( 'bkstg.core.filesystem.do_spaces' ) ; } }
Configure the filesystem adapter.

@param ContainerBuilder $container The container builder.
@param array            $config    The configuration.

@return void
Configure the filesystem adapter .