RouteServiceProvider::map()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

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