Passed
Push — 1.0 ( 12d132...dd1957 )
by Vladimir
06:10
created

FilesystemServiceProvider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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