RouteServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 13
dl 0
loc 63
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 4 1
A mapWebRoutes() 0 5 1
A map() 0 5 1
A mapApiRoutes() 0 6 1
1
<?php
2
3
namespace App\Providers;
4
5
use Illuminate\Support\Facades\Route;
6
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
7
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
8
9
class RouteServiceProvider extends ServiceProvider
10
{
11
    use \Mcamara\LaravelLocalization\Traits\LoadsTranslatedCachedRoutes;
12
13
    /**
14
     * This namespace is applied to your controller routes.
15
     *
16
     * In addition, it is set as the URL generator's root namespace.
17
     *
18
     * @var string
19
     */
20
    protected $namespace = 'App\Http\Controllers';
21
22
    /**
23
     * Define your route model bindings, pattern filters, etc.
24
     *
25
     * @return void
26
     */
27 102
    public function boot()
28
    {
29
        
30
        parent::boot();
31 102
    }
32 102
33
    /**
34
     * Define the routes for the application.
35
     *
36
     * @return void
37
     */
38
    public function map()
39 102
    {
40
        $this->mapApiRoutes();
41 102
42
        $this->mapWebRoutes();
43 102
    }
44
45
    /**
46 102
     * Define the "web" routes for the application.
47
     *
48
     * These routes all receive session state, CSRF protection, etc.
49
     *
50
     * @return void
51
     */
52
    protected function mapWebRoutes()
53
    {
54
        Route::middleware('web')
55 102
                ->namespace($this->namespace)
56
                ->group(base_path('routes/web.php'));
0 ignored issues
show
Bug introduced by
The function base_path was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

56
                ->group(/** @scrutinizer ignore-call */ base_path('routes/web.php'));
Loading history...
57 102
    }
58 102
59 102
    /**
60 102
     * Define the "api" routes for the application.
61
     *
62
     * These routes are typically stateless.
63
     *
64
     * @return void
65
     */
66
    protected function mapApiRoutes()
67
    {
68
        Route::prefix('api')
69 102
                ->middleware('api')
70
                ->namespace($this->namespace)
71 102
                ->group(base_path('routes/api.php'));
0 ignored issues
show
Bug introduced by
The function base_path was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

71
                ->group(/** @scrutinizer ignore-call */ base_path('routes/api.php'));
Loading history...
72 102
    }
73
}
74