Passed
Push — develop ( a18085...de8258 )
by Francisco
14:47
created

RouteServiceProvider::map()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App\Providers;
4
5
use Illuminate\Support\Facades\Route;
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
    /**
20
     * Define your route model bindings, pattern filters, etc.
21
     */
22
    public function boot()
23
    {
24
        //
25
26
        parent::boot();
27
    }
28
29
    /**
30
     * Define the routes for the application.
31
     */
32
    public function map()
33
    {
34
        $this->mapApiRoutes();
35
36
        $this->mapWebRoutes();
37
38
        //
39
    }
40
41
    /**
42
     * Define the "web" routes for the application.
43
     *
44
     * These routes all receive session state, CSRF protection, etc.
45
     */
46
    protected function mapWebRoutes()
47
    {
48
        Route::middleware('web')
49
            ->namespace($this->namespace)
0 ignored issues
show
Bug introduced by
The method namespace() does not exist on Illuminate\Routing\Route. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

49
            ->/** @scrutinizer ignore-call */ namespace($this->namespace)

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
50
            ->group(base_path('routes/web.php'));
51
    }
52
53
    /**
54
     * Define the "api" routes for the application.
55
     *
56
     * These routes are typically stateless.
57
     */
58
    protected function mapApiRoutes()
59
    {
60
        Route::prefix('api')
61
            ->middleware('api')
62
            ->namespace($this->namespace)
63
            ->group(base_path('routes/api.php'));
64
    }
65
}
66