RouteServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 58
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A map() 0 6 1
A mapWebRoutes() 0 9 1
A mapApiRoutes() 0 10 1
1
<?php
2
3
namespace Colligator\Providers;
4
5
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
6
use Illuminate\Support\Facades\Route;
7
8
class RouteServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * This namespace is applied to the controller routes in your routes file.
12
     *
13
     * In addition, it is set as the URL generator's root namespace.
14
     *
15
     * @var string
16
     */
17
    protected $namespace = 'Colligator\Http\Controllers';
18
19
20
    /**
21
     * Define the routes for the application.
22
     *
23
     * @return void
24
     */
25
    public function map()
26
    {
27
        $this->mapApiRoutes();
28
        $this->mapWebRoutes();
29
        //
30
    }
31
32
    /**
33
     * Define the "web" routes for the application.
34
     *
35
     * These routes all receive session state, CSRF protection, etc.
36
     *
37
     * @return void
38
     */
39
    protected function mapWebRoutes()
40
    {
41
        Route::group([
42
            'middleware' => 'web',
43
            'namespace' => $this->namespace,
44
        ], function () {
45
            require base_path('routes/web.php');
46
        });
47
    }
48
    /**
49
     * Define the "api" routes for the application.
50
     *
51
     * These routes are typically stateless.
52
     *
53
     * @return void
54
     */
55
    protected function mapApiRoutes()
56
    {
57
        Route::group([
58
            'middleware' => 'api',
59
            'namespace' => $this->namespace,
60
            // 'prefix' => 'api',
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
61
        ], function () {
62
            require base_path('routes/api.php');
63
        });
64
    }
65
}
66