Completed
Push — master ( b663ee...50d896 )
by Dmitry
06:21
created

ServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 61.53%

Importance

Changes 3
Bugs 2 Features 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 24
ccs 8
cts 13
cp 0.6153
rs 10
c 3
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\Aplication;
8
use Basis\Event;
9
use Basis\Filesystem;
10
use Basis\Service;
11
use League\Container\ServiceProvider\AbstractServiceProvider;
12
use Tarantool\Mapper\Pool;
13
14
class ServiceProvider extends AbstractServiceProvider
15
{
16
    protected $provides = [
17
        Event::class,
18
        Service::class,
19
    ];
20
21
    public function register()
22
    {
23 4
        $this->getContainer()->share(Event::class, function () {
24
            $app = $this->getContainer()->get(Aplication::class);
25
            $service = $this->getContainer()->get(Service::class);
26
            $pool = $this->getContainer()->get(Pool::class);
27
            $filesystem = $this->getContainer()->get(Filesystem::class);
28
            return new Event($app, $service, $pool, $filesystem);
29 4
        });
30
31 4
        $this->getContainer()->share(Service::class, function () {
32 4
            $config = $this->getContainer()->get(Config::class);
33 4
            $app = $this->getContainer()->get(Application::class);
34 4
            return new Service($config['service'], $app);
35 4
        });
36 4
    }
37
}
38