GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 9e7309...ca86c4 )
by Aden
39:37 queued 06:18
created

RouteServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 94
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

Changes 8
Bugs 3 Features 1
Metric Value
wmc 4
c 8
b 3
f 1
lcom 2
cbo 1
dl 0
loc 94
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 4 1
A map() 0 6 1
registerMiddleware() 0 1 ?
registerDefinedRoutes() 0 1 ?
registerDefaultRoutes() 0 1 ?
A adminController() 0 8 2
1
<?php
2
3
namespace LaravelFlare\Flare\Providers;
4
5
use Illuminate\Routing\Router;
6
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
7
8
abstract class RouteServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * This namespace is applied to the controller routes in your routes file.
12
     *
13
     * In addition, it is set as the URL generator's root namespace.
14
     *
15
     * @var string
16
     */
17
    protected $namespace = '\LaravelFlare\Flare\Http\Controllers';
18
    
19
    /**
20
     * The compatibility version of this RouteServiceProvider
21
     * 
22
     * @var string
23
     */
24
    protected $compatibilityVersion;
25
26
    /**
27
     * Define your route model bindings, pattern filters, etc.
28
     *
29
     * @param \Illuminate\Routing\Router $router
30
     */
31
    public function boot(Router $router)
32
    {
33
        parent::boot($router);
34
    }
35
36
    /**
37
     * Define the routes for the application.
38
     *
39
     * @param \Illuminate\Routing\Router $router
40
     */
41
    public function map(Router $router)
42
    {
43
        $this->registerMiddleware($router);
44
        $this->registerDefinedRoutes($router);
45
        $this->registerDefaultRoutes($router);
46
    }
47
48
    /**
49
     * Register all the Flare Provided Middleware and Middleware Groups.
50
     *
51
     * We define flarebase rather than extend an existing middleware stack
52
     * since it is possible that a user has amended the default middleware 
53
     * of their application in a way that could break Flare.
54
     * 
55
     * @param Router $router
56
     */
57
    abstract protected function registerMiddleware(Router $router);
58
59
    /**
60
     * Register the Defined Routes.
61
     *
62
     * This registers all the routes which have been defined by
63
     * Admin sections defined in the Application's Flare Config
64
     * (or in the runtime config if anotehr service provider
65
     * has already started manipulating these dynamically).
66
     * 
67
     * @param Router $router
68
     */
69
    abstract protected function registerDefinedRoutes(Router $router);
70
71
    /**
72
     * Register the Default Routes.
73
     *
74
     * This registers all the default routes which are included
75
     * with Flare. These consist of things which will probably
76
     * be included with every application such as the login,
77
     * logout and password reset forms.
78
     *
79
     * The login form can however be hidden by setting the 
80
     * 'show' config for 'login' to false.
81
     * 
82
     * @param Router $router
83
     */
84
    abstract protected function registerDefaultRoutes(Router $router);
85
86
    /**
87
     * Return the Controller or Controller and Route if provided.
88
     * 
89
     * @param  string $route 
90
     * 
91
     * @return string
92
     */
93
    protected function adminController($route = null)
94
    {
95
        if ($route) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $route of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
96
            return $this->namespace.'\\'.$this->compatibilityVersion.'\AdminController@'.$route;
97
        }
98
99
        return $this->namespace.'\\'.$this->compatibilityVersion.'\AdminController';
100
    }
101
}
102