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

VfsAdapterFactory::doCreateService()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.5

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 3
cts 6
cp 0.5
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 1
crap 2.5
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