RouteServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 56
ccs 15
cts 15
cp 1
rs 10
c 1
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 9 1
A map() 0 5 1
A mapApiRoutes() 0 4 1
A mapWebRoutes() 0 4 1
1
<?php namespace App\Providers;
2
3
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
4
5
class RouteServiceProvider extends ServiceProvider
6
{
7
    /**
8
     * This namespace is applied to the controller routes in your routes file.
9
     * In addition, it is set as the URL generator's root namespace.
10
     *
11
     * @var string
12
     */
13
    protected $namespace = 'App\Http\Controllers';
14
15
    /**
16
     * Define your route model bindings, pattern filters, etc.
17
     *
18
     * @return void
19
     */
20 19
    public function boot()
21
    {
22 19
        app('router')->patterns([
23 19
            'provider' => 'twitter|google|facebook',
24
            'token' => '[a-zA-Z0-9-]+'
25
        ]);
26
27 19
        parent::boot();
28 19
    }
29
30
    /**
31
     * Define the routes for the application.
32
     */
33 19
    public function map()
34
    {
35 19
        $this->mapApiRoutes();
36 19
        $this->mapWebRoutes();
37 19
    }
38
39
    /**
40
     * Define the "api" routes for the application.
41
     * These routes are typically stateless.
42
     *
43
     * @return void
44
     */
45 19
    protected function mapApiRoutes()
46
    {
47 19
        app('router')->prefix('api/v1')->middleware('api')->namespace($this->namespace)->group(base_path('routes/api.php'));
48 19
    }
49
50
    /**
51
     * Define the "web" routes for the application.
52
     * These routes all receive session state, CSRF protection, etc.
53
     *
54
     * @return void
55
     */
56 19
    protected function mapWebRoutes()
57
    {
58 19
        app('router')->middleware('web')->namespace($this->namespace)->group(base_path('routes/web.php'));
59 19
    }
60
}
61