RouteServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 73
ccs 20
cts 20
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 6 1
A map() 0 5 1
A mapApiRoutes() 0 8 1
A mapWebRoutes() 0 8 1
1
<?php
2
3
namespace App\Providers;
4
5
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
6
use Illuminate\Routing\Router;
7
8
class RouteServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * This namespace is applied to your controller routes.
12
     *
13
     * In addition, it is set as the URL generator's root namespace.
14
     *
15
     * @var string
16
     */
17
    protected $namespace = 'App\Http\Controllers';
18
19
    /**
20
     * Define your route model bindings, pattern filters, etc.
21
     *
22
     * @param \Illuminate\Routing\Router $router
23
     *
24
     * @return void
25
     */
26 43
    public function boot(Router $router)
27
    {
28
        //
29
30 43
        parent::boot($router);
31 43
    }
32
33
    /**
34
     * Define the routes for the application.
35
     *
36
     * @param \Illuminate\Routing\Router $router
37
     *
38
     * @return void
39
     */
40 43
    public function map(Router $router)
41
    {
42 43
        $this->mapWebRoutes($router);
43 43
        $this->mapApiRoutes($router);
44 43
    }
45
46
    /**
47
     * Define the "api" routes for the application.
48
     *
49
     *
50
     * @param \Illuminate\Routing\Router $router
51
     *
52
     * @return void
53
     */
54 43
    protected function mapApiRoutes(Router $router)
55
    {
56 43
        $router->group([
57 43
            'namespace' => $this->namespace,
58
        ], function ($router) {
59 43
            require app_path('Http/routes-api.php');
60 43
        });
61 43
    }
62
63
    /**
64
     * Define the "web" routes for the application.
65
     *
66
     * These routes all receive session state, CSRF protection, etc.
67
     *
68
     * @param \Illuminate\Routing\Router $router
69
     *
70
     * @return void
71
     */
72 43
    protected function mapWebRoutes(Router $router)
73
    {
74 43
        $router->group([
75 43
            'namespace' => $this->namespace, 'middleware' => 'web',
76 43
        ], function ($router) {
77 43
            require app_path('Http/routes.php');
78 43
        });
79 43
    }
80
}
81