RouteServiceProvider::mapWebRoutes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
/*
4
 * rmarchiv.tk
5
 * (c) 2016-2017 by Marcel 'ryg' Hering
6
 */
7
8
namespace App\Providers;
9
10
use Illuminate\Support\Facades\Route;
11
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
12
13
class RouteServiceProvider extends ServiceProvider
14
{
15
    /**
16
     * This namespace is applied to your controller routes.
17
     *
18
     * In addition, it is set as the URL generator's root namespace.
19
     *
20
     * @var string
21
     */
22
    protected $namespace = 'App\Http\Controllers';
23
24
    /**
25
     * Define your route model bindings, pattern filters, etc.
26
     *
27
     * @return void
28
     */
29
    public function boot()
30
    {
31
        //
32
33
        parent::boot();
34
    }
35
36
    /**
37
     * Define the routes for the application.
38
     *
39
     * @return void
40
     */
41
    public function map()
42
    {
43
        $this->mapApiRoutes();
44
45
        $this->mapWebRoutes();
46
47
        //
48
    }
49
50
    /**
51
     * Define the "web" routes for the application.
52
     *
53
     * These routes all receive session state, CSRF protection, etc.
54
     *
55
     * @return void
56
     */
57
    protected function mapWebRoutes()
58
    {
59
        Route::group([
60
            'middleware' => 'web',
61
            'namespace'  => $this->namespace,
62
        ], function ($router) {
0 ignored issues
show
Unused Code introduced by
The call to Route::group() has too many arguments starting with function ($router) { ...th('routes/web.php'); }.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
63
            require base_path('routes/web.php');
64
        });
65
    }
66
67
    /**
68
     * Define the "api" routes for the application.
69
     *
70
     * These routes are typically stateless.
71
     *
72
     * @return void
73
     */
74
    protected function mapApiRoutes()
75
    {
76
        Route::group([
77
            'middleware' => 'api',
78
            'namespace'  => $this->namespace,
79
            'prefix'     => 'api',
80
        ], function ($router) {
0 ignored issues
show
Unused Code introduced by
The call to Route::group() has too many arguments starting with function ($router) { ...th('routes/api.php'); }.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
81
            require base_path('routes/api.php');
82
        });
83
    }
84
}
85