VfsAdapterFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A doCreateService() 0 8 2
A validateConfig() 0 3 1
1
<?php
2
3
/**
4
 * BsbFlystem
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 *
9
 * @see       https://bushbaby.nl/
10
 *
11
 * @copyright Copyright (c) 2014-2021 bushbaby multimedia. (https://bushbaby.nl)
12
 * @author    Bas Kamer <[email protected]>
13
 * @license   MIT
14
 *
15 1
 * @package   bushbaby/flysystem
16
 */
17 1
18
declare(strict_types=1);
19
20
namespace BsbFlysystem\Adapter\Factory;
21
22
use BsbFlysystem\Exception\RequirementsException;
23
use League\Flysystem\AdapterInterface;
24 1
use League\Flysystem\Vfs\VfsAdapter as Adapter;
25
use Psr\Container\ContainerInterface;
26
use VirtualFileSystem\FileSystem as Vfs;
27
28
class VfsAdapterFactory extends AbstractAdapterFactory
29
{
30 1
    public function doCreateService(ContainerInterface $container): AdapterInterface
31
    {
32 1
        if (! \class_exists(Adapter::class)) {
33
            throw new RequirementsException(['league/flysystem-vfs'], 'Vfs');
34
        }
35
36
        return new Adapter(new Vfs());
37
    }
38
39
    /**
40
     * This adapter has no options.
41
     */
42
    protected function validateConfig(): void
43
    {
44
    }
45
}
46