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

DebugServiceProvider::getExtensions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 8
ccs 6
cts 6
cp 1
crap 1
rs 10
c 0
b 0
f 0
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