Completed
Push — master ( 248e12...0fb364 )
by ARCANEDEV
03:19
created

RouteServiceProvider   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 88
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 9

Test Coverage

Coverage 93.75%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 6
c 4
b 0
f 0
lcom 1
cbo 9
dl 0
loc 88
ccs 30
cts 32
cp 0.9375
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getRouteNamespace() 0 4 1
A getFoundationPrefix() 0 4 1
A getFoundationAuthPrefix() 0 4 1
A map() 0 5 1
A mapPublicRoutes() 0 12 1
A mapFoundationRoutes() 0 13 1
1
<?php namespace Arcanesoft\Auth\Providers;
2
3
use Arcanedev\Support\Providers\RouteServiceProvider as ServiceProvider;
4
use Arcanesoft\Auth\Http\Routes;
5
use Illuminate\Routing\Router;
6
7
/**
8
 * Class     RouteServiceProvider
9
 *
10
 * @package  Arcanesoft\Auth\Providers
11
 * @author   ARCANEDEV <[email protected]>
12
 */
13
class RouteServiceProvider extends ServiceProvider
14
{
15
    /* ------------------------------------------------------------------------------------------------
16
     |  Getters & Setters
17
     | ------------------------------------------------------------------------------------------------
18
     */
19
    /**
20
     * Get the routes namespace
21
     *
22
     * @return string
23
     */
24
    protected function getRouteNamespace()
25
    {
26
        return 'Arcanesoft\\Auth\\Http\\Routes';
27
    }
28
29
    /**
30
     * Get the foundation route prefix.
31
     *
32
     * @return string
33
     */
34 9
    protected function getFoundationPrefix()
35
    {
36 9
        return config('arcanesoft.foundation.route.prefix', 'dashboard');
37
    }
38
39
    /**
40
     * Get the auth foundation route prefix.
41
     *
42
     * @return string
43
     */
44 9
    public function getFoundationAuthPrefix()
45
    {
46 9
        return $this->getFoundationPrefix() . '/' . config('arcanesoft.auth.route.prefix', 'authorization');
47
    }
48
49
    /* ------------------------------------------------------------------------------------------------
50
     |  Main Functions
51
     | ------------------------------------------------------------------------------------------------
52
     */
53
    /**
54
     * Define the routes for the application.
55
     *
56
     * @param  Router $router
57
     */
58 9
    public function map(Router $router)
59
    {
60 9
        $this->mapPublicRoutes($router);
61 9
        $this->mapFoundationRoutes($router);
62 9
    }
63
64
    /**
65
     * Define the public routes for the application.
66
     *
67
     * @param  Router  $router
68
     */
69 9
    private function mapPublicRoutes(Router $router)
70
    {
71 9
        $router->group([
72 9
            'prefix'    => 'auth',
73 9
            'as'        => 'auth::',
74 9
            'namespace' => 'Arcanesoft\\Auth\\Http\\Controllers\\Front',
75
        ], function ($router) {
76 9
            (new Routes\Front\AuthenticateRoutes)->map($router);
77 9
            (new Routes\Front\RegisterRoutes)->map($router);
78 9
            (new Routes\Front\ReminderRoutes)->map($router);
79 9
        });
80 9
    }
81
82
    /**
83
     * Define the foundation routes for the application.
84
     *
85
     * @param  Router  $router
86
     */
87 9
    private function mapFoundationRoutes(Router $router)
88
    {
89 9
        $router->group([
90 9
            'prefix'    => $this->getFoundationAuthPrefix(),
91 9
            'as'        => 'auth::foundation.',
92 9
            'namespace' => 'Arcanesoft\\Auth\\Http\\Controllers\\Foundation',
93 9
        ], function ($router) {
94 9
            (new Routes\Foundation\StatsRoutes)->map($router);
95 9
            (new Routes\Foundation\UsersRoutes)->map($router);
96 9
            (new Routes\Foundation\RolesRoutes)->map($router);
97 9
            (new Routes\Foundation\PermissionsRoutes)->map($router);
98 9
        });
99 9
    }
100
}
101