Completed
Push — 1.0 ( 678007...4c5066 )
by Vladimir
21:50
created

FilesystemServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A register() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Filesystem;
6
7
use League\Flysystem\AdapterInterface;
8
use League\Container\ServiceProvider\AbstractServiceProvider;
9
10
class FilesystemServiceProvider extends AbstractServiceProvider
11
{
12
    protected $provides = [
13
        Filesystem::class,
14
    ];
15
16
    private $adapter;
17
18 1
    public function __construct(AdapterInterface $adapter)
19
    {
20 1
        $this->adapter = $adapter;
21 1
    }
22
23
    /**
24
     * Use the register method to register items with the container via the
25
     * protected $this->container property or the `getContainer` method
26
     * from the ContainerAwareTrait.
27
     *
28
     * @return void
29
     */
30 1
    public function register(): void
31
    {
32 1
        $filesystem = new Filesystem($this->adapter);
33
34 1
        $this->getContainer()->add(Filesystem::class, $filesystem);
35 1
    }
36
}
37