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::map()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace LaravelFlare\Flare\Providers\LTS;
4
5
use Illuminate\Routing\Router;
6
use LaravelFlare\Flare\Providers\RouteServiceProvider;
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, LaravelFlare\Flare\Provi...TS\RouteServiceProvider.

Let’s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let’s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
7
8
class RouteServiceProvider extends RouteServiceProvider
9
{
10
    /**
11
     * The compatibility version of this RouteServiceProvider
12
     * 
13
     * @var string
14
     */
15
    protected $compatibilityVersion = 'LTS';
16
17
    /**
18
     * Register all the Flare Provided Middleware and Middleware Groups.
19
     *
20
     * We define flarebase rather than extend an existing middleware stack
21
     * since it is possible that a user has amended the default middleware 
22
     * of their application in a way that could break Flare.
23
     * 
24
     * @param Router $router
25
     */
26
    protected function registerMiddleware(Router $router)
27
    {
28
        $router->middleware('flareauthenticate', \LaravelFlare\Flare\Http\Middleware\FlareAuthenticate::class);
29
        $router->middleware('checkmodelfound', \LaravelFlare\Flare\Http\Middleware\CheckModelFound::class);
30
        $router->middleware('checkpermissions', \LaravelFlare\Flare\Http\Middleware\CheckPermissions::class);
31
    }
32
33
    /**
34
     * Register the Defined Routes.
35
     *
36
     * This registers all the routes which have been defined by
37
     * Admin sections defined in the Application's Flare Config
38
     * (or in the runtime config if anotehr service provider
39
     * has already started manipulating these dynamically).
40
     * 
41
     * @param Router $router
42
     */
43 View Code Duplication
    protected function registerDefinedRoutes(Router $router)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
44
    {
45
        $router->group(
46
            [
47
                'prefix' => \Flare::config('admin_url'),
48
                'as' => 'flare::',
49
                'middleware' => ['flareauthenticate', 'checkpermissions'],
50
            ],
51
            function ($router) {
52
                \Flare::admin()->registerRoutes($router);
53
                $router->get('/', $this->adminController('getDashboard'))->name('dashboard');
54
            }
55
        );
56
    }
57
58
    /**
59
     * Register the Default Routes.
60
     *
61
     * This registers all the default routes which are included
62
     * with Flare. These consist of things which will probably
63
     * be included with every application such as the login,
64
     * logout and password reset forms.
65
     *
66
     * The login form can however be hidden by setting the 
67
     * 'show' config for 'login' to false.
68
     * 
69
     * @param Router $router
70
     */
71
    protected function registerDefaultRoutes(Router $router)
72
    {
73
        $router->group(
74
            [
75
                'prefix' => \Flare::config('admin_url'),
76
                'as' => 'flare::',
77
            ],
78 View Code Duplication
            function ($router) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
79
                // Logout route...
80
                $router->get('logout', $this->adminController('getLogout'))->name('logout');
81
82
                if (\Flare::show('login')) {
83
                    // Login request reoutes...
84
                    $router->get('login', $this->adminController('getLogin'))->name('login');
85
                    $router->post('login', $this->adminController('postLogin'))->name('login');
86
87
                    // Password reset link request routes...
88
                    $router->get('email', $this->adminController('getEmail'))->name('email');
89
                    $router->post('email', $this->adminController('postEmail'))->name('email');
90
91
                    // Password reset routes...
92
                    $router->get('reset/{token}', $this->adminController('getReset'))->name('reset');
93
                    $router->post('reset', $this->adminController('postReset'))->name('reset');
94
                }
95
            }
96
        );
97
    }
98
}
99