Passed
Pull Request — master (#104)
by Sergei
31:44 queued 23:50
created

DebugServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 8
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 15
ccs 8
cts 8
cp 1
rs 10
c 8
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDefinitions() 0 3 1
A getExtensions() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug;
6
7
use Psr\Container\ContainerInterface;
8
use Psr\EventDispatcher\EventDispatcherInterface;
9
use Psr\Log\LoggerInterface;
10
use Yiisoft\Di\Contracts\ServiceProviderInterface;
11
use Yiisoft\Yii\Debug\Collector\EventCollector;
12
use Yiisoft\Yii\Debug\Collector\LogCollector;
13
use Yiisoft\Yii\Debug\Proxy\EventDispatcherInterfaceProxy;
14
use Yiisoft\Yii\Debug\Proxy\LoggerInterfaceProxy;
15
16
final class DebugServiceProvider implements ServiceProviderInterface
17
{
18 1
    public function getDefinitions(): array
19
    {
20 1
        return [];
21
    }
22
23 1
    public function getExtensions(): array
24
    {
25
        return [
26 1
            LoggerInterface::class => static function (ContainerInterface $container, LoggerInterface $logger) {
27 1
                return new LoggerInterfaceProxy($logger, $container->get(LogCollector::class));
28 1
            },
29 1
            EventDispatcherInterface::class => static function (ContainerInterface $container, EventDispatcherInterface $dispatcher) {
30 1
                return new EventDispatcherInterfaceProxy($dispatcher, $container->get(EventCollector::class));
31 1
            },
32
        ];
33
    }
34
}
35