RouteServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 66
ccs 18
cts 18
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 6 1
A map() 0 8 1
A mapWebRoutes() 0 6 1
A mapApiRoutes() 0 7 1
1
<?php
2
3
namespace PiFinder\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 = 'PiFinder\Http\Controllers';
18
19
    /**
20
     * Define your route model bindings, pattern filters, etc.
21
     *
22
     * @return void
23
     */
24 9
    public function boot()
25
    {
26
        //
27
28 9
        parent::boot();
29 9
    }
30
31
    /**
32
     * Define the routes for the application.
33
     *
34
     * @return void
35
     */
36 9
    public function map()
37
    {
38 9
        $this->mapApiRoutes();
39
40 9
        $this->mapWebRoutes();
41
42
        //
43 9
    }
44
45
    /**
46
     * Define the "web" routes for the application.
47
     *
48
     * These routes all receive session state, CSRF protection, etc.
49
     *
50
     * @return void
51
     */
52 9
    protected function mapWebRoutes()
53
    {
54 9
        Route::middleware('web')
0 ignored issues
show
Bug introduced by
The method namespace() does not exist on Illuminate\Routing\Route. Did you maybe mean addGroupNamespaceToStringUses()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
55 9
             ->namespace($this->namespace)
56 9
             ->group(base_path('routes/web.php'));
57 9
    }
58
59
    /**
60
     * Define the "api" routes for the application.
61
     *
62
     * These routes are typically stateless.
63
     *
64
     * @return void
65
     */
66 9
    protected function mapApiRoutes()
67
    {
68 9
        Route::prefix('api')
69 9
             ->middleware('api')
70 9
             ->namespace($this->namespace)
71 9
             ->group(base_path('routes/api.php'));
72 9
    }
73
}
74