@@ -13,5 +13,5 @@ |
||
13 | 13 | * @param array $data |
14 | 14 | * @return mixed |
15 | 15 | */ |
16 | - public function set($data=array()); |
|
16 | + public function set($data = array()); |
|
17 | 17 | } |
18 | 18 | \ No newline at end of file |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * @param array $bind |
25 | 25 | * @return mixed |
26 | 26 | */ |
27 | - public function controller($endpoint=null,$bind=array()); |
|
27 | + public function controller($endpoint = null, $bind = array()); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * @return mixed |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @param null $app |
9 | 9 | * @return mixed |
10 | 10 | */ |
11 | - public function app($app=null); |
|
11 | + public function app($app = null); |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @return mixed |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param bool $bool |
56 | 56 | * @return mixed |
57 | 57 | */ |
58 | - public function controller($controller=null,$bool=true); |
|
58 | + public function controller($controller = null, $bool = true); |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * @return mixed |
@@ -146,5 +146,5 @@ discard block |
||
146 | 146 | * @param null $app |
147 | 147 | * @return mixed |
148 | 148 | */ |
149 | - public function version($app=null); |
|
149 | + public function version($app = null); |
|
150 | 150 | } |
151 | 151 | \ No newline at end of file |
@@ -10,11 +10,11 @@ |
||
10 | 10 | * @param $concrete |
11 | 11 | * @return mixed |
12 | 12 | */ |
13 | - public function addListener($eventName,$abstract,$concrete); |
|
13 | + public function addListener($eventName, $abstract, $concrete); |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * @param array $subscriber |
17 | 17 | * @return mixed |
18 | 18 | */ |
19 | - public function addSubscriber($subscriber=array()); |
|
19 | + public function addSubscriber($subscriber = array()); |
|
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -10,6 +10,6 @@ |
||
10 | 10 | * @param bool $onion |
11 | 11 | * @return mixed |
12 | 12 | */ |
13 | - public function callBootstrapperProcess($group,$booting,$onion=true); |
|
13 | + public function callBootstrapperProcess($group, $booting, $onion = true); |
|
14 | 14 | |
15 | 15 | } |
16 | 16 | \ No newline at end of file |
@@ -8,6 +8,6 @@ |
||
8 | 8 | * @param null $path |
9 | 9 | * @return mixed |
10 | 10 | */ |
11 | - public function setConfig($path=null); |
|
11 | + public function setConfig($path = null); |
|
12 | 12 | |
13 | 13 | } |
14 | 14 | \ No newline at end of file |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * @var array $onionTypes |
27 | 27 | */ |
28 | - protected $onionTypes=[ |
|
28 | + protected $onionTypes = [ |
|
29 | 29 | |
30 | 30 | 'middlewareGroups' => 'before', |
31 | 31 | 'reflectionGroups' => 'core' |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | |
43 | 43 | // If the peelings variable does not have a kernel, |
44 | 44 | // we first assign an instance of this class to the initial value of the array. |
45 | - if(!isset($this->app['peelings'])){ |
|
46 | - $this->app->register('peelings','0',$this); |
|
45 | + if (!isset($this->app['peelings'])) { |
|
46 | + $this->app->register('peelings', '0', $this); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | // we will then use the keys of |
@@ -52,17 +52,17 @@ discard block |
||
52 | 52 | |
53 | 53 | // and since we can not peel, |
54 | 54 | // we will include the onion property in the process class respectively and run it as before yada after. |
55 | - $bootstrapperPeelOnionProcess = new MiddlewareKernelProviderProcess($this->onionTypes[$group],$this->onionList); |
|
55 | + $bootstrapperPeelOnionProcess = new MiddlewareKernelProviderProcess($this->onionTypes[$group], $this->onionList); |
|
56 | 56 | |
57 | 57 | // and we assign this running onion process property to the peelings variable on the kernel. |
58 | - $this->app->register('peelings',end($keys)+1,$bootstrapperPeelOnionProcess); |
|
58 | + $this->app->register('peelings', end($keys)+1, $bootstrapperPeelOnionProcess); |
|
59 | 59 | |
60 | 60 | //If the peelingsAfter object is not in the kernel. |
61 | - if(!isset($this->app['peelingsAfter'])){ |
|
61 | + if (!isset($this->app['peelingsAfter'])) { |
|
62 | 62 | |
63 | 63 | //we assign the last saved after object to the peelingsAfter variable independently in the kernel. |
64 | - $bootstrapperPeelAfterOnionProcess = new MiddlewareKernelProviderProcess('after',$this->onionList); |
|
65 | - $this->app->register('peelingsAfter',$bootstrapperPeelAfterOnionProcess); |
|
64 | + $bootstrapperPeelAfterOnionProcess = new MiddlewareKernelProviderProcess('after', $this->onionList); |
|
65 | + $this->app->register('peelingsAfter', $bootstrapperPeelAfterOnionProcess); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | return true; |
@@ -82,12 +82,12 @@ discard block |
||
82 | 82 | |
83 | 83 | // After we check the peel objects in the list for core, |
84 | 84 | // we hold the core objects in a row. |
85 | - foreach ($peelings as $peelKey=>$peelObje){ |
|
85 | + foreach ($peelings as $peelKey=>$peelObje) { |
|
86 | 86 | |
87 | - if($peelObje->onionType=='core'){ |
|
87 | + if ($peelObje->onionType=='core') { |
|
88 | 88 | $peelList['core'][] = $peelObje; |
89 | 89 | } |
90 | - else{ |
|
90 | + else { |
|
91 | 91 | $peelList['peel'][] = $peelObje; |
92 | 92 | } |
93 | 93 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @param callable $callback |
121 | 121 | * @return mixed|null |
122 | 122 | */ |
123 | - public function onionBoot($onion,callable $callback) |
|
123 | + public function onionBoot($onion, callable $callback) |
|
124 | 124 | { |
125 | 125 | // we are globalizing the onion variable. |
126 | 126 | $this->onionList = $onion; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | // if the current onionlist is present in the specified onions list we will peel. |
142 | 142 | // otherwise we will have to make a normal bootstrapper. |
143 | - if(isset($this->onionTypes[current($this->onionList)])){ |
|
143 | + if (isset($this->onionTypes[current($this->onionList)])) { |
|
144 | 144 | |
145 | 145 | // If our register property succeeds, |
146 | 146 | // we return this condition. |
@@ -86,8 +86,7 @@ |
||
86 | 86 | |
87 | 87 | if($peelObje->onionType=='core'){ |
88 | 88 | $peelList['core'][] = $peelObje; |
89 | - } |
|
90 | - else{ |
|
89 | + } else{ |
|
91 | 90 | $peelList['peel'][] = $peelObje; |
92 | 91 | } |
93 | 92 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @param null $onionType |
22 | 22 | * @param null $onions |
23 | 23 | */ |
24 | - public function __construct($onionType=null,$onions=null) |
|
24 | + public function __construct($onionType = null, $onions = null) |
|
25 | 25 | { |
26 | 26 | $this->onionType = $onionType; |
27 | 27 | $this->onions = $onions; |
@@ -36,14 +36,14 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function peel($object, \Closure $next) |
38 | 38 | { |
39 | - if($this->onionType=="before"){ |
|
39 | + if ($this->onionType=="before") { |
|
40 | 40 | |
41 | 41 | $object->runs[] = $this->onionsProcess(); |
42 | 42 | |
43 | 43 | return $next($object); |
44 | 44 | } |
45 | 45 | |
46 | - if($this->onionType=="after"){ |
|
46 | + if ($this->onionType=="after") { |
|
47 | 47 | |
48 | 48 | $response = $next($object); |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | private function afterPeel() |
72 | 72 | { |
73 | - if(isset(core()->bindings['middleware']) && core()->bindings['middleware']!==null){ |
|
73 | + if (isset(core()->bindings['middleware']) && core()->bindings['middleware']!==null) { |
|
74 | 74 | return core()->bindings['middleware']->after(); |
75 | 75 | } |
76 | 76 | } |
@@ -141,7 +141,9 @@ discard block |
||
141 | 141 | |
142 | 142 | //method can only return fixed. |
143 | 143 | if(!is_null($key)){ |
144 | - if(isset($$key)) return $$key; |
|
144 | + if(isset($$key)) { |
|
145 | + return $$key; |
|
146 | + } |
|
145 | 147 | } |
146 | 148 | |
147 | 149 | //middleware key odds |
@@ -170,8 +172,7 @@ discard block |
||
170 | 172 | // it is detected as a short name and is searched in the middleware directory. |
171 | 173 | if(Utils::isNamespaceExists($middleVal)){ |
172 | 174 | $middlewareNamespace = $middleVal; |
173 | - } |
|
174 | - else{ |
|
175 | + } else{ |
|
175 | 176 | $middlewareNamespace = app()->namespace()->middleware().'\\'.ucfirst($middleVal); |
176 | 177 | } |
177 | 178 | |
@@ -271,7 +272,9 @@ discard block |
||
271 | 272 | { |
272 | 273 | //If the all option is present, |
273 | 274 | //it is automatically injected into all services for the middleware application. |
274 | - if($key==="all") return true; |
|
275 | + if($key==="all") { |
|
276 | + return true; |
|
277 | + } |
|
275 | 278 | |
276 | 279 | //service middleware key |
277 | 280 | //if it is array,check odds |
@@ -311,8 +314,7 @@ discard block |
||
311 | 314 | $middlewareList = array_merge($middlewareList,[$middleValue]); |
312 | 315 | $this->app->register('pointer','middlewareList',$middlewareList); |
313 | 316 | } |
314 | - } |
|
315 | - else{ |
|
317 | + } else{ |
|
316 | 318 | $this->app->register('pointer','middlewareList',[$middleValue]); |
317 | 319 | } |
318 | 320 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function getResolveServiceMiddleware() |
62 | 62 | { |
63 | - if(!is_null($this->serviceMiddleware)){ |
|
63 | + if (!is_null($this->serviceMiddleware)) { |
|
64 | 64 | return $this->app->resolve($this->serviceMiddleware); |
65 | 65 | } |
66 | 66 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | public function handle() |
96 | 96 | { |
97 | 97 | //set define for middleware |
98 | - define('middleware',true); |
|
98 | + define('middleware', true); |
|
99 | 99 | |
100 | 100 | //middleware handle process |
101 | 101 | $this->handleMiddlewareProcess(); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @param string $method |
108 | 108 | * @return void|mixed |
109 | 109 | */ |
110 | - public function handleMiddlewareProcess($method='handle') |
|
110 | + public function handleMiddlewareProcess($method = 'handle') |
|
111 | 111 | { |
112 | 112 | // the app instance is a global application example, |
113 | 113 | // and a hash is loaded as this hash. |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | // the middleware class must be subject to |
117 | 117 | // the ServiceMiddlewareManagerContracts interface rule to be implemented. |
118 | - if(!$this->getResolveServiceMiddleware() instanceof ServiceMiddlewareManagerContracts){ |
|
118 | + if (!$this->getResolveServiceMiddleware() instanceof ServiceMiddlewareManagerContracts) { |
|
119 | 119 | exception()->badMethodCall('Service middleware does not have ServiceMiddlewareManagerContracts'); |
120 | 120 | } |
121 | 121 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @param $key null |
133 | 133 | * @return array |
134 | 134 | */ |
135 | - public function middlewareKeyOdds($key=null) |
|
135 | + public function middlewareKeyOdds($key = null) |
|
136 | 136 | { |
137 | 137 | $route = Route::getRouteResolve(); |
138 | 138 | |
@@ -140,17 +140,15 @@ discard block |
||
140 | 140 | ? $route['namespace'] |
141 | 141 | : (defined('endpoint')) ? endpoint : null; |
142 | 142 | |
143 | - $routeParameterContainer = ($this->app->has('routeParameters')) ? implode("/",$this->app['routeParameters']) : ''; |
|
143 | + $routeParameterContainer = ($this->app->has('routeParameters')) ? implode("/", $this->app['routeParameters']) : ''; |
|
144 | 144 | |
145 | 145 | $method = (isset($route['method'])) |
146 | - ? $route['method'] : |
|
147 | - $routeParameterContainer; |
|
146 | + ? $route['method'] : $routeParameterContainer; |
|
148 | 147 | |
149 | - $routeHttpContainer = ($this->app->has('httpMethod')) ? $this->app['httpMethod'] : null ; |
|
148 | + $routeHttpContainer = ($this->app->has('httpMethod')) ? $this->app['httpMethod'] : null; |
|
150 | 149 | |
151 | 150 | $http = (isset($route['http'])) |
152 | - ? $route['http'] : |
|
153 | - $routeHttpContainer; |
|
151 | + ? $route['http'] : $routeHttpContainer; |
|
154 | 152 | |
155 | 153 | // identifying constants for the middleware layer. |
156 | 154 | // with the property of the user, the user is free to determine the constants that the middleware layer wants. |
@@ -159,8 +157,8 @@ discard block |
||
159 | 157 | $http = $this->odds['http'] ?? $http; |
160 | 158 | |
161 | 159 | //method can only return fixed. |
162 | - if(!is_null($key)){ |
|
163 | - if(isset($$key)) return $$key; |
|
160 | + if (!is_null($key)) { |
|
161 | + if (isset($$key)) return $$key; |
|
164 | 162 | } |
165 | 163 | |
166 | 164 | //middleware key odds |
@@ -178,21 +176,21 @@ discard block |
||
178 | 176 | * |
179 | 177 | * @param array $middleware |
180 | 178 | */ |
181 | - public function serviceMiddleware($middleware=array()) |
|
179 | + public function serviceMiddleware($middleware = array()) |
|
182 | 180 | { |
183 | 181 | $this->show = []; |
184 | 182 | |
185 | 183 | //It will be run individually according to the rules of |
186 | 184 | //the middleware classes specified for the service middleware middleware. |
187 | - foreach($middleware as $middleVal=>$middleKey){ |
|
185 | + foreach ($middleware as $middleVal=>$middleKey) { |
|
188 | 186 | |
189 | 187 | // if the keys in the array in the service middleware class represent a class, |
190 | 188 | // this value is checked, if it does not represent the class, |
191 | 189 | // it is detected as a short name and is searched in the middleware directory. |
192 | - if(Utils::isNamespaceExists($middleVal)){ |
|
190 | + if (Utils::isNamespaceExists($middleVal)) { |
|
193 | 191 | $middlewareNamespace = $middleVal; |
194 | 192 | } |
195 | - else{ |
|
193 | + else { |
|
196 | 194 | $middlewareNamespace = app()->namespace()->middleware().'\\'.ucfirst($middleVal); |
197 | 195 | } |
198 | 196 | |
@@ -211,12 +209,12 @@ discard block |
||
211 | 209 | //it will be handled according to the following rule. |
212 | 210 | //The exclude class will return a callback and allocate the result as bool to the exclude variable. |
213 | 211 | //If the exclude variable is true then the middleware will be run. |
214 | - $excludeClass->exclude($this->middleware,function($exclude) use ($middleVal){ |
|
212 | + $excludeClass->exclude($this->middleware, function($exclude) use ($middleVal){ |
|
215 | 213 | |
216 | - if($exclude){ |
|
214 | + if ($exclude) { |
|
217 | 215 | |
218 | 216 | //the condition of a specific statement to be handled |
219 | - if($this->checkNamespaceAndSpecificCondition()){ |
|
217 | + if ($this->checkNamespaceAndSpecificCondition()) { |
|
220 | 218 | $this->pointer($middleVal); |
221 | 219 | |
222 | 220 | //directly registered to the middleware name show property. |
@@ -224,8 +222,8 @@ discard block |
||
224 | 222 | |
225 | 223 | // the middleware namespace must have handletraitcontract interface property. |
226 | 224 | // otherwise, middleware will not work. |
227 | - if(false === $this->app->runningInConsole() |
|
228 | - && $this->app->resolve($this->middleware['namespace']) instanceof HandleContracts){ |
|
225 | + if (false===$this->app->runningInConsole() |
|
226 | + && $this->app->resolve($this->middleware['namespace']) instanceof HandleContracts) { |
|
229 | 227 | $this->app->resolve($this->middleware['namespace'])->handle(); |
230 | 228 | } |
231 | 229 | } |
@@ -241,10 +239,10 @@ discard block |
||
241 | 239 | * @param null $key |
242 | 240 | * @param null $value |
243 | 241 | */ |
244 | - public function setKeyOdds($key=null,$value=null) |
|
242 | + public function setKeyOdds($key = null, $value = null) |
|
245 | 243 | { |
246 | 244 | //user-defined middleware constants. |
247 | - if(!is_null($key) && !is_null($value)){ |
|
245 | + if (!is_null($key) && !is_null($value)) { |
|
248 | 246 | $this->odds[$key] = $value; |
249 | 247 | } |
250 | 248 | } |
@@ -261,13 +259,13 @@ discard block |
||
261 | 259 | |
262 | 260 | // if the service middleware does not represent a class, |
263 | 261 | // then in this case core support is assigned as a class service middleware. |
264 | - if(Utils::isNamespaceExists($serviceMiddleware)===false){ |
|
262 | + if (Utils::isNamespaceExists($serviceMiddleware)===false) { |
|
265 | 263 | $serviceMiddleware = ServiceMiddlewareManager::class; |
266 | 264 | } |
267 | 265 | |
268 | 266 | //We are logging the kernel for the middleware class and the exclude class |
269 | - $this->app->register('middlewareClass',$this->app->resolve($serviceMiddleware)); |
|
270 | - $this->app->register('excludeClass',$this->app->resolve(ExcludeMiddleware::class)); |
|
267 | + $this->app->register('middlewareClass', $this->app->resolve($serviceMiddleware)); |
|
268 | + $this->app->register('excludeClass', $this->app->resolve(ExcludeMiddleware::class)); |
|
271 | 269 | } |
272 | 270 | |
273 | 271 | /** |
@@ -275,9 +273,9 @@ discard block |
||
275 | 273 | * |
276 | 274 | * @param null $serviceMiddleware |
277 | 275 | */ |
278 | - public function setserviceMiddleware($serviceMiddleware=null) |
|
276 | + public function setserviceMiddleware($serviceMiddleware = null) |
|
279 | 277 | { |
280 | - if(!is_null($serviceMiddleware)){ |
|
278 | + if (!is_null($serviceMiddleware)) { |
|
281 | 279 | $this->serviceMiddleware = $serviceMiddleware; |
282 | 280 | } |
283 | 281 | } |
@@ -292,11 +290,11 @@ discard block |
||
292 | 290 | { |
293 | 291 | //If the all option is present, |
294 | 292 | //it is automatically injected into all services for the middleware application. |
295 | - if($key==="all") return true; |
|
293 | + if ($key==="all") return true; |
|
296 | 294 | |
297 | 295 | //service middleware key |
298 | 296 | //if it is array,check odds |
299 | - if(is_array($key)){ |
|
297 | + if (is_array($key)) { |
|
300 | 298 | |
301 | 299 | //get middleware odd keys |
302 | 300 | $odds = $this->middlewareKeyOdds(); |
@@ -305,8 +303,8 @@ discard block |
||
305 | 303 | //then the middleware is conditioned and the services are individually checked according to |
306 | 304 | //the degree of conformity with the middlewareOdds method and |
307 | 305 | //the middleware is executed under the specified condition. |
308 | - foreach($key as $item){ |
|
309 | - if(in_array($item,$odds)){ |
|
306 | + foreach ($key as $item) { |
|
307 | + if (in_array($item, $odds)) { |
|
310 | 308 | return true; |
311 | 309 | } |
312 | 310 | } |
@@ -324,17 +322,17 @@ discard block |
||
324 | 322 | */ |
325 | 323 | private function pointer($middleValue) |
326 | 324 | { |
327 | - if(isset($this->app['pointer']['middlewareList'])){ |
|
325 | + if (isset($this->app['pointer']['middlewareList'])) { |
|
328 | 326 | |
329 | 327 | $middlewareList = $this->app['pointer']['middlewareList']; |
330 | 328 | |
331 | - if(is_array($middlewareList)){ |
|
332 | - $middlewareList = array_merge($middlewareList,[$middleValue]); |
|
333 | - $this->app->register('pointer','middlewareList',$middlewareList); |
|
329 | + if (is_array($middlewareList)) { |
|
330 | + $middlewareList = array_merge($middlewareList, [$middleValue]); |
|
331 | + $this->app->register('pointer', 'middlewareList', $middlewareList); |
|
334 | 332 | } |
335 | 333 | } |
336 | - else{ |
|
337 | - $this->app->register('pointer','middlewareList',[$middleValue]); |
|
334 | + else { |
|
335 | + $this->app->register('pointer', 'middlewareList', [$middleValue]); |
|
338 | 336 | } |
339 | 337 | } |
340 | 338 | } |
341 | 339 | \ No newline at end of file |