RouteServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 5
rs 9.4285
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace App\Providers;
4
5
use Illuminate\Routing\Router;
6
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
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
     * Define your route model bindings, pattern filters, etc.
20
     *
21
     * @param  \Illuminate\Routing\Router  $router
22
     * @return void
23
     */
24
    public function boot(Router $router)
25
    {
26
        //
27
        parent::boot($router);
28
    }
29
    /**
30
     * Define the routes for the application.
31
     *
32
     * @param  \Illuminate\Routing\Router  $router
33
     * @return void
34
     */
35
    public function map(Router $router)
36
    {
37
        $this->mapWebRoutes($router);
38
39
        $this->mapApiRoutes($router);
40
41
//        $this->mapNoMiddlewareRoutes($router);
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% 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...
42
    }
43
    /**
44
     * Define the "web" routes for the application.
45
     *
46
     * These routes all receive session state, CSRF protection, etc.
47
     *
48
     * @param  \Illuminate\Routing\Router  $router
49
     * @return void
50
     */
51
    protected function mapNoMiddlewareRoutes(Router $router)
52
    {
53
        $router->group([
54
            'namespace' => $this->namespace,
55
        ], function ($router) {
56
            require app_path('Http/routes-nomiddleware.php');
57
        });
58
    }
59
    /**
60
     * Define the "web" routes for the application.
61
     *
62
     * These routes all receive session state, CSRF protection, etc.
63
     *
64
     * @param  \Illuminate\Routing\Router  $router
65
     * @return void
66
     */
67 View Code Duplication
    protected function mapWebRoutes(Router $router)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
68
    {
69
        $router->group([
70
            'namespace' => $this->namespace, 'middleware' => 'web',
71
        ], function ($router) {
72
            require app_path('Http/routes.php');
73
        });
74
    }
75
    /**
76
     * Define the "web" routes for the application.
77
     *
78
     * These routes all receive session state, CSRF protection, etc.
79
     *
80
     * @param  \Illuminate\Routing\Router  $router
81
     * @return void
82
     */
83 View Code Duplication
    protected function mapApiRoutes(Router $router)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
84
    {
85
        $router->group([
86
            'namespace' => $this->namespace, 'middleware' => 'api',
87
        ], function ($router) {
88
            require app_path('Http/routes-api.php');
89
        });
90
    }
91
}
92