RouteServiceProvider   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 84
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
eloc 21
c 0
b 0
f 0
dl 0
loc 84
ccs 27
cts 27
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 3 1
A map() 0 9 1
A mapFileManagerRoutes() 0 3 1
A mapApiRoutes() 0 7 1
A mapWebRoutes() 0 5 1
A mapGdaemonApiRoutes() 0 7 1
1
<?php
2
3
namespace Gameap\Providers;
4
5
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
6
use Illuminate\Support\Facades\Route;
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 = 'Gameap\Http\Controllers';
18
19
    /**
20
     * Define your route model bindings, pattern filters, etc.
21
     *
22
     * @return void
23
     */
24 108
    public function boot(): void
25
    {
26 108
        parent::boot();
27 108
    }
28
29
    /**
30
     * Define the routes for the application.
31
     *
32
     * @return void
33
     */
34 108
    public function map(): void
35
    {
36 108
        $this->mapApiRoutes();
37
38 108
        $this->mapFileManagerRoutes();
39
40 108
        $this->mapWebRoutes();
41 108
42
        $this->mapGdaemonApiRoutes();
43
    }
44
45
    protected function mapFileManagerRoutes(): void
46
    {
47
        Route::prefix('file-manager')->middleware('api');
48
    }
49
50 108
    /**
51
     * Define the "web" routes for the application.
52 108
     *
53 108
     * These routes all receive session state, CSRF protection, etc.
54 108
     *
55 108
     * @return void
56
     */
57
    protected function mapWebRoutes(): void
58
    {
59
        Route::middleware(['web', 'preferLanguage'])
60
            ->namespace($this->namespace)
61
            ->group(base_path('routes/web.php'));
62
    }
63
64 108
    /**
65
     * Define the "api" routes for the application.
66 108
     *
67 108
     * These routes are typically stateless.
68 108
     *
69 108
     * @return void
70 108
     */
71 108
    protected function mapApiRoutes(): void
72
    {
73
        Route::prefix('api')
74
            ->middleware('api')
75
            ->as('api.')
76
            ->namespace($this->namespace . '\\API')
77
            ->group(base_path('routes/api.php'));
78 108
    }
79
80 108
    /**
81 108
     * Define the "gdaemon_api" routes for the application
82 108
     *
83 108
     * @return void
84 108
     */
85 108
    protected function mapGdaemonApiRoutes(): void
86
    {
87
        Route::prefix('gdaemon_api')
88
            ->middleware('gdaemon_api')
89
            ->as('gdaemon_api.')
90
            ->namespace($this->namespace . '\\GdaemonAPI')
91
            ->group(base_path('routes/gdaemon_api.php'));
92
    }
93
}
94