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

FilesystemServiceProvider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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