Passed
Push — master ( 1204f0...e0445e )
by n
01:48
created

RouteServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
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\Http\Routing\RoutingErrorResponder;
7
use Illuminate\Container\Container;
8
use N1215\Hakudo\Router;
9
use N1215\Http\Router\RouterInterface;
10
use N1215\Http\Router\RoutingErrorResponderInterface;
11
use N1215\Jugoya\RequestHandlerBuilderInterface;
12
use N1215\Tsukuyomi\FrameworkInterface;
13
14
class RouteServiceProvider
15
{
16
    public function register(Container $container)
17
    {
18 1
        $container->singleton(RouterInterface::class, function (Container $container) {
19 1
            $framework = $container->get(FrameworkInterface::class);
20 1
            $router = new Router($container->get(RequestHandlerBuilderInterface::class));
21
22 1
            $routingPath = $framework->path('routes/api.php');
23 1
            require $routingPath;
24
25 1
            return $router;
26 1
        });
27
28 1
        $container->singleton(RoutingErrorResponderInterface::class, RoutingErrorResponder::class);
29 1
    }
30
}
31