@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | private function getCallBindController() |
40 | 40 | { |
41 | 41 | //we finally process the method of the class invoked by the user as a process and prepare it for the response |
42 | - return app()->resolve(RouteWatch::class)->watch(function(){ |
|
42 | + return app()->resolve(RouteWatch::class)->watch(function() { |
|
43 | 43 | |
44 | 44 | // if the method in the instance object exists, |
45 | 45 | // this method is executed to produce the output. |
46 | - if(method_exists($this->app['instanceController'],$this->app['method'])){ |
|
47 | - return $this->app['di']($this->app['instanceController'],$this->app['method']); |
|
46 | + if (method_exists($this->app['instanceController'], $this->app['method'])) { |
|
47 | + return $this->app['di']($this->app['instanceController'], $this->app['method']); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | //throw exception as unsuccessful |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function handle() |
64 | 64 | { |
65 | - return $this->app->resolve(RoutePolicy::class)->gate(function(){ |
|
65 | + return $this->app->resolve(RoutePolicy::class)->gate(function() { |
|
66 | 66 | |
67 | - $this->app->register('routerResult',$this->callController()); |
|
67 | + $this->app->register('routerResult', $this->callController()); |
|
68 | 68 | |
69 | 69 | //we call our services as controller |
70 | 70 | return $this->app['routerResult']; |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | $namespace = $this->getControllerNamespace(); |
83 | 83 | |
84 | 84 | //utils make bind via dependency injection named as service container |
85 | - $this->app->register('serviceConf',$this->app['fileSystem']->callFile(StaticPathModel::getServiceConf())); |
|
86 | - $this->app->register('instanceController',$this->app->resolve($namespace)); |
|
85 | + $this->app->register('serviceConf', $this->app['fileSystem']->callFile(StaticPathModel::getServiceConf())); |
|
86 | + $this->app->register('instanceController', $this->app->resolve($namespace)); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | |
101 | 101 | // based on the serviceConf variable, |
102 | 102 | // we are doing parameter bindings in the method context in the routeParameters array key. |
103 | - $this->app->register('serviceConf','routeParameters',[$method=>$parameters]); |
|
103 | + $this->app->register('serviceConf', 'routeParameters', [$method=>$parameters]); |
|
104 | 104 | |
105 | 105 | } |
106 | 106 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function setMethodNameViaDefine($methodName) |
114 | 114 | { |
115 | - define('methodName',strtolower($methodName)); |
|
115 | + define('methodName', strtolower($methodName)); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $fromRoutes = Route::getRouteResolve(); |
144 | 144 | $method = $fromRoutes['method'] ?? $method; |
145 | 145 | |
146 | - $this->app->register('method',$method); |
|
146 | + $this->app->register('method', $method); |
|
147 | 147 | $this->app->register('routeParameters', $this->routeParametersAssign($this->resolveMethod($method))); |
148 | 148 | |
149 | 149 | } |
@@ -16,11 +16,11 @@ |
||
16 | 16 | { |
17 | 17 | $di = $this->app['di']; |
18 | 18 | |
19 | - if(!method_exists(policy(),Route::getRouteControllerMethod())){ |
|
19 | + if (!method_exists(policy(), Route::getRouteControllerMethod())) { |
|
20 | 20 | $directly = true; |
21 | 21 | } |
22 | 22 | |
23 | - if(isset($directly) || $di(policy(),Route::getRouteControllerMethod())){ |
|
23 | + if (isset($directly) || $di(policy(), Route::getRouteControllerMethod())) { |
|
24 | 24 | return call_user_func($callback); |
25 | 25 | } |
26 | 26 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | function applicationKey() |
49 | 49 | { |
50 | - if(property_exists($kernel=app()->kernel(),'applicationKey')){ |
|
50 | + if (property_exists($kernel = app()->kernel(), 'applicationKey')) { |
|
51 | 51 | return $kernel->applicationKey; |
52 | 52 | } |
53 | 53 | return null; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | function bundleName() |
82 | 82 | { |
83 | - if(defined('endpoint')){ |
|
83 | + if (defined('endpoint')) { |
|
84 | 84 | |
85 | 85 | return endpoint.''.StaticPathList::$controllerBundleName; |
86 | 86 | } |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | * @param null $default |
96 | 96 | * @return mixed|null |
97 | 97 | */ |
98 | - function config($config=null,$default=null) |
|
98 | + function config($config = null, $default = null) |
|
99 | 99 | { |
100 | 100 | $configResult = app()->config($config); |
101 | 101 | |
102 | - if($configResult === null && $default!==null){ |
|
102 | + if ($configResult===null && $default!==null) { |
|
103 | 103 | return $default; |
104 | 104 | } |
105 | 105 | |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | * @param $bind array |
115 | 115 | * @return mixed |
116 | 116 | */ |
117 | - function container($class,$bind=array()) |
|
117 | + function container($class, $bind = array()) |
|
118 | 118 | { |
119 | - return app()->singleton()->appClass->container(appInstance(),$class,$bind); |
|
119 | + return app()->singleton()->appClass->container(appInstance(), $class, $bind); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
@@ -176,10 +176,10 @@ discard block |
||
176 | 176 | * @param array $params |
177 | 177 | * @return ExceptionContracts |
178 | 178 | */ |
179 | - function exception($name=null,$params=array()) |
|
179 | + function exception($name = null, $params = array()) |
|
180 | 180 | { |
181 | - $exceptionManager=ExceptionManager::class; |
|
182 | - return app()->resolve($exceptionManager,['name'=>$name,'params'=>$params]); |
|
181 | + $exceptionManager = ExceptionManager::class; |
|
182 | + return app()->resolve($exceptionManager, ['name'=>$name, 'params'=>$params]); |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
@@ -189,13 +189,13 @@ discard block |
||
189 | 189 | * @param null $locale |
190 | 190 | * @return Generator |
191 | 191 | */ |
192 | - function faker($locale=null) |
|
192 | + function faker($locale = null) |
|
193 | 193 | { |
194 | - if($locale===null){ |
|
195 | - $faker=Factory::create(); |
|
194 | + if ($locale===null) { |
|
195 | + $faker = Factory::create(); |
|
196 | 196 | } |
197 | - else{ |
|
198 | - $faker=Factory::create($locale); |
|
197 | + else { |
|
198 | + $faker = Factory::create($locale); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | return $faker; |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | |
207 | 207 | function fingerPrint() |
208 | 208 | { |
209 | - return md5(sha1(implode("|",[ |
|
210 | - request()->getClientIp(),$_SERVER['HTTP_USER_AGENT'],applicationKey() |
|
209 | + return md5(sha1(implode("|", [ |
|
210 | + request()->getClientIp(), $_SERVER['HTTP_USER_AGENT'], applicationKey() |
|
211 | 211 | ]))); |
212 | 212 | } |
213 | 213 | } |
@@ -227,10 +227,10 @@ discard block |
||
227 | 227 | * @param null $default |
228 | 228 | * @return null |
229 | 229 | */ |
230 | - function get($param=null,$default=null) |
|
230 | + function get($param = null, $default = null) |
|
231 | 231 | { |
232 | 232 | //symfony request query object |
233 | - $get=core()->get; |
|
233 | + $get = core()->get; |
|
234 | 234 | |
235 | 235 | return ($param===null) ? $get : (isset($get[$param]) ? $get[$param] : $default); |
236 | 236 | } |
@@ -243,14 +243,14 @@ discard block |
||
243 | 243 | * @param null $default |
244 | 244 | * @return array |
245 | 245 | */ |
246 | - function headers($param=null,$default=null) |
|
246 | + function headers($param = null, $default = null) |
|
247 | 247 | { |
248 | - $list=[]; |
|
248 | + $list = []; |
|
249 | 249 | |
250 | 250 | //We only get the objects in the list name to match the header objects |
251 | 251 | //that come with the request path to the objects sent by the client |
252 | 252 | foreach (request()->headers->all() as $key=>$value) { |
253 | - $list[$key]=$value; |
|
253 | + $list[$key] = $value; |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | //return header list |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | * @param $file null |
276 | 276 | * @return LoggerHandler |
277 | 277 | */ |
278 | - function logger($file=null) |
|
278 | + function logger($file = null) |
|
279 | 279 | { |
280 | - return app()->resolve(LoggerHandler::class,['file'=>$file]); |
|
280 | + return app()->resolve(LoggerHandler::class, ['file'=>$file]); |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | */ |
300 | 300 | function response() |
301 | 301 | { |
302 | - $object=debug_backtrace()[1]['object']; |
|
302 | + $object = debug_backtrace()[1]['object']; |
|
303 | 303 | return new ResponseOutManager($object); |
304 | 304 | } |
305 | 305 | } |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | * @throws \DI\DependencyException |
315 | 315 | * @throws \DI\NotFoundException |
316 | 316 | */ |
317 | - function resolve($class,$bind=array()) |
|
317 | + function resolve($class, $bind = array()) |
|
318 | 318 | { |
319 | - return app()->resolve($class,$bind); |
|
319 | + return app()->resolve($class, $bind); |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | function policy() |
329 | 329 | { |
330 | - $policyPath = implode('/',[ |
|
330 | + $policyPath = implode('/', [ |
|
331 | 331 | Route::getRouteControllerNamespace(), |
332 | 332 | 'Policy', |
333 | 333 | Route::getRouteControllerClass().'Policy' |
@@ -343,10 +343,10 @@ discard block |
||
343 | 343 | * @param $key |
344 | 344 | * @return mixed |
345 | 345 | */ |
346 | - function route($key=null) |
|
346 | + function route($key = null) |
|
347 | 347 | { |
348 | - if(is_null($key)){ |
|
349 | - return array_map(function($route){ |
|
348 | + if (is_null($key)) { |
|
349 | + return array_map(function($route) { |
|
350 | 350 | return strtolower($route); |
351 | 351 | },app()->singleton()->appClass->route($key)); |
352 | 352 | } |
@@ -374,10 +374,10 @@ discard block |
||
374 | 374 | * @param null $default |
375 | 375 | * @return mixed |
376 | 376 | */ |
377 | - function post($param=null,$default=null) |
|
377 | + function post($param = null, $default = null) |
|
378 | 378 | { |
379 | 379 | //symfony request query object |
380 | - $post=core()->post; |
|
380 | + $post = core()->post; |
|
381 | 381 | |
382 | 382 | return ($param===null) ? $post : (isset($post[$param]) ? $post[$param] : $default); |
383 | 383 | } |
@@ -408,8 +408,8 @@ discard block |
||
408 | 408 | * @param array $select |
409 | 409 | * @return mixed |
410 | 410 | */ |
411 | - function trans($lang,$select=array()) |
|
411 | + function trans($lang, $select = array()) |
|
412 | 412 | { |
413 | - return app()->singleton()->appClass->translator($lang,$select); |
|
413 | + return app()->singleton()->appClass->translator($lang, $select); |
|
414 | 414 | } |
415 | 415 | } |
416 | 416 | \ No newline at end of file |