Completed
Pull Request — master (#2)
by ARCANEDEV
06:40
created

RouteServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 90%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getRouteNamespace() 0 4 1
A getFoundationAuthPrefix() 0 6 1
A map() 0 4 1
A mapAdminRoutes() 0 14 1
1
<?php namespace Arcanesoft\Media\Providers;
2
3
use Arcanesoft\Core\Bases\RouteServiceProvider as ServiceProvider;
4
use Arcanesoft\Media\Http\Routes;
5
use Illuminate\Contracts\Routing\Registrar as Router;
6
use Illuminate\Support\Arr;
7
8
class RouteServiceProvider extends ServiceProvider
9
{
10
    /* ------------------------------------------------------------------------------------------------
11
     |  Getters & Setters
12
     | ------------------------------------------------------------------------------------------------
13
     */
14
    /**
15
     * Get the routes namespace
16
     *
17
     * @return string
18
     */
19
    protected function getRouteNamespace()
20
    {
21
        return 'Arcanesoft\\Media\\Http\\Routes';
22
    }
23
24
    /**
25
     * Get the auth foundation route prefix.
26
     *
27
     * @return string
28
     */
29 8
    public function getFoundationAuthPrefix()
30
    {
31 8
        $prefix = Arr::get($this->getFoundationRouteGroup(), 'prefix', 'dashboard');
32
33 8
        return "$prefix/" . config('arcanesoft.media.route.prefix', 'media');
34
    }
35
36
    /* ------------------------------------------------------------------------------------------------
37
     |  Main Functions
38
     | ------------------------------------------------------------------------------------------------
39
     */
40
    /**
41
     * Define the routes for the application.
42
     *
43
     * @param  \Illuminate\Contracts\Routing\Registrar  $router
44
     */
45 8
    public function map(Router $router)
46
    {
47 8
        $this->mapAdminRoutes($router);
48 8
    }
49
50
    /**
51
     * Register the admin routes.
52
     *
53
     * @param  \Illuminate\Contracts\Routing\Registrar  $router
54
     */
55 8
    private function mapAdminRoutes(Router $router)
56
    {
57 8
        $attributes = array_merge($this->getFoundationRouteGroup(), [
58 8
            'as'        => 'admin::media.',
59 4
            'namespace' => 'Arcanesoft\\Media\\Http\\Controllers\\Admin',
60 4
        ]);
61
62 8
        $router->group(array_merge(
63 4
            $attributes,
64 8
            ['prefix' => $this->getFoundationAuthPrefix()]
65 8
        ), function (Router $router) {
66 8
            Routes\Admin\MediaRoutes::register($router);
67 8
        });
68 8
    }
69
}
70