RouteServiceProvider::mapWebRoutes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

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