Completed
Push — master ( 4848aa...64d9da )
by Dmitry
03:44
created

ServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 46.15%

Importance

Changes 4
Bugs 2 Features 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 24
ccs 6
cts 13
cp 0.4615
rs 10
c 4
b 2
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 16 1
1
<?php
2
3
namespace Basis\Provider;
4
5
use Basis\Application;
6
use Basis\Config;
7
use Basis\Event;
8
use Basis\Filesystem;
9
use Basis\Service;
10
use League\Container\ServiceProvider\AbstractServiceProvider;
11
use Tarantool\Mapper\Pool;
12
13
class ServiceProvider extends AbstractServiceProvider
14
{
15
    protected $provides = [
16
        Event::class,
17
        Service::class,
18
    ];
19
20
    public function register()
21
    {
22 2
        $this->getContainer()->share(Event::class, function () {
23 2
            $app = $this->getContainer()->get(Application::class);
24 2
            $service = $this->getContainer()->get(Service::class);
25 2
            $pool = $this->getContainer()->get(Pool::class);
26 2
            $filesystem = $this->getContainer()->get(Filesystem::class);
27 2
            return new Event($app, $service, $pool, $filesystem);
28
        });
29
30
        $this->getContainer()->share(Service::class, function () {
31
            $config = $this->getContainer()->get(Config::class);
32
            $app = $this->getContainer()->get(Application::class);
33
            return new Service($config['service'], $app);
34
        });
35
    }
36
}
37