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

LocalAdapterFactory::validateConfig()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BsbFlysystem\Adapter\Factory;
6
7
use BsbFlysystem\Exception\UnexpectedValueException;
8
use League\Flysystem\Adapter\Local as Adapter;
9
use League\Flysystem\AdapterInterface;
10
use Psr\Container\ContainerInterface;
11
12
class LocalAdapterFactory extends AbstractAdapterFactory
13
{
14
    public function doCreateService(ContainerInterface $container): AdapterInterface
15
    {
16
        $adapter = new Adapter($this->options['root']);
17
18
        return $adapter;
19
    }
20
21 2
    protected function validateConfig()
22
    {
23 2
        if (! isset($this->options['root'])) {
24 1
            throw new UnexpectedValueException("Missing 'root' as option");
25
        }
26 1
    }
27
}
28