Completed
Pull Request — master (#42)
by Florent
12:58
created

VfsAdapterFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 21
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A doCreateService() 0 11 2
A validateConfig() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BsbFlysystem\Adapter\Factory;
6
7
use BsbFlysystem\Exception\RequirementsException;
8
use League\Flysystem\AdapterInterface;
9
use League\Flysystem\Vfs\VfsAdapter as Adapter;
10
use Psr\Container\ContainerInterface;
11
use VirtualFileSystem\FileSystem as Vfs;
12
13
class VfsAdapterFactory extends AbstractAdapterFactory
14
{
15
    public function doCreateService(ContainerInterface $container): AdapterInterface
16
    {
17
        if (! class_exists(\League\Flysystem\Vfs\VfsAdapter::class)) {
18
            throw new RequirementsException(
19
                ['league/flysystem-vfs'],
20
                'Vfs'
21
            );
22
        }
23
24
        return new Adapter(new Vfs());
25
    }
26
27
    /**
28
     * This adapter has no options.
29
     */
30
    protected function validateConfig()
31
    {
32
    }
33
}
34