Completed
Push — master ( a0e8ce...60fa13 )
by Bas
12s
created

VfsAdapterFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 62.5%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 26
ccs 5
cts 8
cp 0.625
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
namespace BsbFlysystem\Adapter\Factory;
4
5
use BsbFlysystem\Exception\RequirementsException;
6
use League\Flysystem\Vfs\VfsAdapter as Adapter;
7
use VirtualFileSystem\FileSystem as Vfs;
8
use Zend\ServiceManager\FactoryInterface;
9
use Zend\ServiceManager\ServiceLocatorInterface;
10
11
class VfsAdapterFactory extends AbstractAdapterFactory
12
{
13
    /**
14
     * @inheritdoc
15
     */
16 1
    public function doCreateService(ServiceLocatorInterface $serviceLocator)
17
    {
18 1
        if (!class_exists(\League\Flysystem\Vfs\VfsAdapter::class)) {
19
            throw new RequirementsException(
20
                ['league/flysystem-vfs'],
21
                'Vfs'
22
            );
23
        }
24
25 1
        return new Adapter(new Vfs());
26
    }
27
28
    /**
29
     * @inheritdoc
30
     *
31
     * This adapter has no options
32
     */
33 1
    protected function validateConfig()
34
    {
35 1
    }
36
}
37