Completed
Push — master ( e81256...4b285b )
by Bas
04:59
created

VfsAdapterFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A doCreateService() 0 11 2
A validateConfig() 0 4 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
        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
    protected function validateConfig()
34
    {
35
36
    }
37
}
38