Completed
Push — master ( 60fa13...455325 )
by Bas
15:24
created

FilesystemManagerFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 20
ccs 10
cts 10
cp 1
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createService() 0 4 1
A __invoke() 0 12 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BsbFlysystem\Service\Factory;
6
7
use BsbFlysystem\Filesystem\Factory\FilesystemFactory;
8
use BsbFlysystem\Service\FilesystemManager;
9
use Interop\Container\ContainerInterface;
10
use Zend\ServiceManager\FactoryInterface;
11
use Zend\ServiceManager\ServiceLocatorInterface;
12
13
class FilesystemManagerFactory implements FactoryInterface
0 ignored issues
show
Deprecated Code introduced by
The interface Zend\ServiceManager\FactoryInterface has been deprecated with message: Use Zend\ServiceManager\Factory\FactoryInterface instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
14
{
15 1
    public function createService(ServiceLocatorInterface $serviceLocator): FilesystemManager
16
    {
17 1
        return $this($serviceLocator, null);
18
    }
19
20 1
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null): FilesystemManager
21
    {
22 1
        $config        = $container->get('config');
23 1
        $config        = $config['bsb_flysystem']['filesystems'];
24 1
        $serviceConfig = [];
25 1
        foreach ($config as $key => $filesystems) {
26 1
            $serviceConfig['factories'][$key] = FilesystemFactory::class;
27 1
            $serviceConfig['shared'][$key]    = isset($filesystems['shared']) ? (bool) $filesystems['shared'] : true;
28
        }
29
30 1
        return new FilesystemManager($container, $serviceConfig);
31
    }
32
}
33