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

VfsAdapterFactory::doCreateService()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

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