Completed
Push — master ( 50d896...15fe5a )
by Dmitry
06:51 queued 04:55
created

ServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

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

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 6
        $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 6
        });
29
30 6
        $this->getContainer()->share(Service::class, function () {
31 6
            $config = $this->getContainer()->get(Config::class);
32 6
            $app = $this->getContainer()->get(Application::class);
33 6
            return new Service($config['service'], $app);
34 6
        });
35 6
    }
36
}
37