FlysystemConnector   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 14
ccs 0
cts 7
cp 0
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A connect() 0 10 2
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of the daikon-cqrs/flysystem-adapter project.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Daikon\Flysystem\Connector;
10
11
use Daikon\Dbal\Connector\ConnectorInterface;
12
use Daikon\Dbal\Connector\ProvidesConnector;
13
use League\Flysystem\AdapterInterface;
14
use League\Flysystem\Filesystem;
15
use League\Flysystem\MountManager;
16
17
final class FlysystemConnector implements ConnectorInterface
18
{
19
    use ProvidesConnector;
20
21
    protected function connect(): MountManager
22
    {
23
        $mounts = [];
24
        foreach ($this->settings['mounts'] as $mountName => $mountConfig) {
25
            $adapterClass = $mountConfig['adapter'];
26
            /** @var AdapterInterface $adapter */
27
            $adapter = new $adapterClass($mountConfig['location']);
28
            $mounts[$mountName] = new Filesystem($adapter);
29
        }
30
        return new MountManager($mounts);
0 ignored issues
show
Deprecated Code introduced by
The class League\Flysystem\MountManager has been deprecated: This functionality will be removed in 2.0 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

30
        return /** @scrutinizer ignore-deprecated */ new MountManager($mounts);
Loading history...
31
    }
32
}
33