|
1
|
|
|
<?php namespace Arcanesoft\Pages\Providers; |
|
2
|
|
|
|
|
3
|
|
|
use Arcanesoft\Pages\Http\Routes; |
|
4
|
|
|
use Arcanesoft\Core\Bases\RouteServiceProvider as ServiceProvider; |
|
5
|
|
|
use Illuminate\Contracts\Routing\Registrar as Router; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Class RouteServiceProvider |
|
9
|
|
|
* |
|
10
|
|
|
* @package Arcanesoft\Pages\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\\Pages\\Http\\Routes'; |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Get the auth foundation route prefix. |
|
31
|
|
|
* |
|
32
|
|
|
* @return string |
|
33
|
|
|
*/ |
|
34
|
8 |
|
public function getFoundationPagesPrefix() |
|
35
|
|
|
{ |
|
36
|
8 |
|
$prefix = array_get($this->getFoundationRouteGroup(), 'prefix', 'dashboard'); |
|
37
|
|
|
|
|
38
|
8 |
|
return "$prefix/" . config('arcanesoft.pages.route.prefix', 'pages'); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/* ------------------------------------------------------------------------------------------------ |
|
42
|
|
|
| Main Functions |
|
43
|
|
|
| ------------------------------------------------------------------------------------------------ |
|
44
|
|
|
*/ |
|
45
|
|
|
/** |
|
46
|
|
|
* Define the routes for the application. |
|
47
|
|
|
* |
|
48
|
|
|
* @param \Illuminate\Contracts\Routing\Registrar $router |
|
49
|
|
|
*/ |
|
50
|
8 |
|
public function map(Router $router) |
|
51
|
|
|
{ |
|
52
|
8 |
|
$this->mapFrontEndRoutes($router); |
|
|
|
|
|
|
53
|
8 |
|
$this->mapBackEndRoutes($router); |
|
54
|
8 |
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Define the public routes for the application. |
|
58
|
|
|
* |
|
59
|
|
|
* @param \Illuminate\Contracts\Routing\Registrar $router |
|
60
|
|
|
*/ |
|
61
|
8 |
|
private function mapFrontEndRoutes(Router $router) |
|
62
|
|
|
{ |
|
63
|
|
|
$attributes = [ |
|
|
|
|
|
|
64
|
8 |
|
'prefix' => 'pages', |
|
65
|
6 |
|
'as' => 'pages::', |
|
66
|
6 |
|
'namespace' => 'Arcanesoft\\Pages\\Http\\Controllers\\Front', |
|
67
|
6 |
|
]; |
|
68
|
8 |
|
} |
|
69
|
|
|
/** |
|
70
|
|
|
* Define the foundation routes for the application. |
|
71
|
|
|
* |
|
72
|
|
|
* @param \Illuminate\Contracts\Routing\Registrar $router |
|
73
|
|
|
*/ |
|
74
|
8 |
|
private function mapBackEndRoutes(Router $router) |
|
75
|
|
|
{ |
|
76
|
8 |
|
$attributes = array_merge($this->getFoundationRouteGroup(), [ |
|
77
|
8 |
|
'as' => 'pages::foundation.', |
|
78
|
6 |
|
'namespace' => 'Arcanesoft\\Pages\\Http\\Controllers\\Back', |
|
79
|
6 |
|
]); |
|
80
|
|
|
|
|
81
|
8 |
|
$router->group(array_merge( |
|
82
|
6 |
|
$attributes, |
|
83
|
8 |
|
['prefix' => $this->getFoundationPagesPrefix()] |
|
84
|
8 |
|
), function (Router $router) { |
|
85
|
8 |
|
Routes\Back\StatsRoutes::register($router); |
|
86
|
8 |
|
Routes\Back\PagesRoutes::register($router); |
|
87
|
8 |
|
}); |
|
88
|
|
|
} |
|
89
|
|
|
} |
|
90
|
|
|
|
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call: