Passed
Pull Request — master (#34)
by Dmitriy
08:14
created

DebugApiProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 5
Bugs 1 Features 0
Metric Value
wmc 2
eloc 6
c 5
b 1
f 0
dl 0
loc 16
ccs 0
cts 6
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getExtensions() 0 6 1
A getDefinitions() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Api\Provider;
6
7
use Psr\Container\ContainerInterface;
8
use Yiisoft\Di\Contracts\ServiceProviderInterface;
9
use Yiisoft\Yii\Debug\Api\Middleware\DebugHeaders;
10
use Yiisoft\Router\RouteCollectorInterface;
11
12
class DebugApiProvider implements ServiceProviderInterface
13
{
14
    /**
15
     * @psalm-suppress InaccessibleMethod
16
     */
17
    public function getDefinitions(): array
18
    {
19
        return [];
20
    }
21
22
    public function getExtensions(): array
23
    {
24
        return [
25
            RouteCollectorInterface::class => static function (ContainerInterface $container, RouteCollectorInterface $routeCollector) {
26
                $routeCollector->prependMiddleware(DebugHeaders::class);
27
                return $routeCollector;
28
            }
29
        ];
30
    }
31
}
32