Completed
Push — master ( da1cfa...dccc7f )
by Vladimir
03:06
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\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 1
    public function __construct(AdapterInterface $adapter)
20
    {
21 1
        $this->adapter = $adapter;
22 1
    }
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 1
        $this->getContainer()->share(Filesystem::class, function () {
34 1
            return new Filesystem($this->adapter);
35 1
        });
36 1
    }
37
}
38