RouteServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 17
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 14 1
1
<?php
2
declare(strict_types=1);
3
4
namespace App\Providers;
5
6
use App\Routing\RoutingErrorResponder;
7
use Illuminate\Container\Container;
8
use N1215\Hakudo\Router;
9
use N1215\Http\Router\Result\RoutingResultFactory;
10
use N1215\Http\Router\RouterInterface;
11
use N1215\Http\Router\Handler\RoutingErrorResponderInterface;
12
use N1215\Jugoya\RequestHandlerBuilderInterface;
13
use N1215\Tsukuyomi\FrameworkInterface;
14
15
class RouteServiceProvider implements ServiceProviderInterface
16
{
17 1
    public function register(Container $container)
18
    {
19
        $container->singleton(RouterInterface::class, function (Container $container) {
20 1
            $framework = $container->get(FrameworkInterface::class);
21 1
            $router = new Router($container->get(RequestHandlerBuilderInterface::class), new RoutingResultFactory());
22
23 1
            $routingPath = $framework->path('routes/api.php');
24 1
            require $routingPath;
25
26 1
            return $router;
27 1
        });
28
29 1
        $container->singleton(RoutingErrorResponderInterface::class, RoutingErrorResponder::class);
30 1
    }
31
}
32