Completed
Push — master ( 44d13a...738b86 )
by ARCANEDEV
06:02
created

RouteServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 85.71%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 4
c 3
b 0
f 0
lcom 1
cbo 4
dl 0
loc 53
ccs 12
cts 14
cp 0.8571
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getRouteNamespace() 0 4 1
A getFoundationRouteGroup() 0 4 1
A map() 0 9 1
A registerMiddlewares() 0 4 1
1
<?php namespace Arcanesoft\Foundation\Providers;
2
3
use Arcanedev\Support\Providers\RouteServiceProvider as ServiceProvider;
4
use Arcanesoft\Foundation\Http\Middleware;
5
use Arcanesoft\Foundation\Http\Routes;
6
use Illuminate\Routing\Router;
7
8
/**
9
 * Class     RouteServiceProvider
10
 *
11
 * @package  Arcanesoft\Foundation\Providers
12
 * @author   ARCANEDEV <[email protected]>
13
 */
14
class RouteServiceProvider extends ServiceProvider
15
{
16
    /* ------------------------------------------------------------------------------------------------
17
     |  Getters & Setters
18
     | ------------------------------------------------------------------------------------------------
19
     */
20
    /**
21
     * Get the routes namespace
22
     *
23
     * @return string
24
     */
25
    protected function getRouteNamespace()
26
    {
27
        return 'Arcanesoft\\Foundation\\Http\\Routes';
28
    }
29
30
    /**
31
     * Get Foundation route group.
32
     *
33
     * @return array
34
     */
35 18
    protected function getFoundationRouteGroup()
36
    {
37 18
        return config('arcanesoft.foundation.route', []);
38
    }
39
40
    /* ------------------------------------------------------------------------------------------------
41
     |  Main Functions
42
     | ------------------------------------------------------------------------------------------------
43
     */
44
    /**
45
     * Define the routes for the application.
46
     *
47
     * @param  Router $router
48
     */
49 18
    public function map(Router $router)
50
    {
51 18
        $this->registerMiddlewares();
52
53 18
        $router->group($this->getFoundationRouteGroup(), function (Router $router) {
54 18
            (new Routes\DashboardRoute())->map($router);
55 18
            (new Routes\LogViewerRoutes())->map($router);
56 18
        });
57 18
    }
58
59
    /**
60
     * Register all middlewares.
61
     */
62 18
    private function registerMiddlewares()
63
    {
64 18
        $this->middleware('admin', Middleware\AdminMiddleware::class);
0 ignored issues
show
Documentation introduced by
'admin' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
65 18
    }
66
}
67