@@ -87,7 +87,9 @@ discard block |
||
87 | 87 | //If the console object returns true, |
88 | 88 | //we do not cancel binding operations |
89 | 89 | //We are getting what applies to console with consoleKernelObject. |
90 | - if($sync===false) return $this->consoleKernelObjectChecker($object,$callback); |
|
90 | + if($sync===false) { |
|
91 | + return $this->consoleKernelObjectChecker($object,$callback); |
|
92 | + } |
|
91 | 93 | |
92 | 94 | //the value corresponding to the bind value for the global object is assigned and |
93 | 95 | //the resolve method is called for the dependency injection. |
@@ -133,7 +135,9 @@ discard block |
||
133 | 135 | //If the console object returns true, |
134 | 136 | //we do not cancel binding operations |
135 | 137 | //We are getting what applies to console with consoleKernelObject. |
136 | - if($this->console() AND $isCallableForCallback) return $this->consoleKernelObject($object,$callback,$container); |
|
138 | + if($this->console() AND $isCallableForCallback) { |
|
139 | + return $this->consoleKernelObject($object,$callback,$container); |
|
140 | + } |
|
137 | 141 | |
138 | 142 | //If the application is not a console operation, we re-bind to existing methods synchronously. |
139 | 143 | return ($container) ? $this->containerBuild($object,$callback,true) : $this->build($object,$callback,true); |
@@ -167,7 +171,9 @@ discard block |
||
167 | 171 | //If the console object returns true, |
168 | 172 | //we do not cancel binding operations |
169 | 173 | //We are getting what applies to console with consoleKernelObject. |
170 | - if($sync===false) return $this->consoleKernelObjectChecker($object,$callback,true); |
|
174 | + if($sync===false) { |
|
175 | + return $this->consoleKernelObjectChecker($object,$callback,true); |
|
176 | + } |
|
171 | 177 | |
172 | 178 | //Since the objects that come to the build method are objects from the container method, |
173 | 179 | //we need to automatically create a kernel object named serviceContainer in this method. |
@@ -211,8 +217,7 @@ discard block |
||
211 | 217 | foreach (explode(".",$abstract) as $item){ |
212 | 218 | if(isset($container[$item])){ |
213 | 219 | $container = $container[$item]; |
214 | - } |
|
215 | - else{ |
|
220 | + } else{ |
|
216 | 221 | return null; |
217 | 222 | } |
218 | 223 | } |
@@ -246,8 +251,7 @@ discard block |
||
246 | 251 | // the control result is transferred to the bools array. |
247 | 252 | $container = $container[$item]; |
248 | 253 | $bools[] = is_null($container) ? false : true; |
249 | - } |
|
250 | - else{ |
|
254 | + } else{ |
|
251 | 255 | |
252 | 256 | // if the container array corresponds to a string, |
253 | 257 | // the bools array is filled with the isset control directly. |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | use Resta\Console\ConsoleBindings; |
8 | 8 | use Resta\Contracts\ContainerContracts; |
9 | 9 | |
10 | -class Container implements ContainerContracts,\ArrayAccess |
|
10 | +class Container implements ContainerContracts, \ArrayAccess |
|
11 | 11 | { |
12 | 12 | /** |
13 | 13 | * @var bool |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | * @param array $bind |
50 | 50 | * @return array |
51 | 51 | */ |
52 | - public function applicationProviderBinding($make,$bind=array()) |
|
52 | + public function applicationProviderBinding($make, $bind = array()) |
|
53 | 53 | { |
54 | 54 | //service container is an automatic application provider |
55 | 55 | //that we can bind to the special class di in the dependency condition. |
56 | 56 | //This method is automatically added to the classes resolved by the entire make bind method. |
57 | - return array_merge($bind,['app'=>$make]); |
|
57 | + return array_merge($bind, ['app'=>$make]); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -66,16 +66,16 @@ discard block |
||
66 | 66 | * @throws DependencyException |
67 | 67 | * @throws NotFoundException |
68 | 68 | */ |
69 | - public function bind($object=null,$callback=null,$alias=null) |
|
69 | + public function bind($object = null, $callback = null, $alias = null) |
|
70 | 70 | { |
71 | - if(!is_null($alias)){ |
|
71 | + if (!is_null($alias)) { |
|
72 | 72 | $object = $alias; |
73 | 73 | } |
74 | 74 | |
75 | 75 | //If the bind method does not have parameters object and callback, the value is directly assigned to the kernel object. |
76 | 76 | //Otherwise, when the bind object and callback are sent, the closure class inherits |
77 | 77 | //the applicationProvider object and the resolve method is called |
78 | - return $this->make($object,$callback,'container'); |
|
78 | + return $this->make($object, $callback, 'container'); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -87,16 +87,16 @@ discard block |
||
87 | 87 | * @throws DependencyException |
88 | 88 | * @throws NotFoundException |
89 | 89 | */ |
90 | - private function build($object,$callback,$sync=false) |
|
90 | + private function build($object, $callback, $sync = false) |
|
91 | 91 | { |
92 | 92 | //If the console object returns true, |
93 | 93 | //we do not cancel binding operations |
94 | 94 | //We are getting what applies to console with consoleKernelObject. |
95 | - if($sync===false) return $this->consoleKernelObjectChecker($object,$callback); |
|
95 | + if ($sync===false) return $this->consoleKernelObjectChecker($object, $callback); |
|
96 | 96 | |
97 | 97 | //the value corresponding to the bind value for the global object is assigned and |
98 | 98 | //the resolve method is called for the dependency injection. |
99 | - $this->kernelAssigner()->setKernelObject($object,$callback); |
|
99 | + $this->kernelAssigner()->setKernelObject($object, $callback); |
|
100 | 100 | |
101 | 101 | //return kernel object |
102 | 102 | return $this->kernel(); |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | * @throws DependencyException |
112 | 112 | * @throws NotFoundException |
113 | 113 | */ |
114 | - private function consoleKernelObject($object,$callback,$container=false) |
|
114 | + private function consoleKernelObject($object, $callback, $container = false) |
|
115 | 115 | { |
116 | 116 | //we use the console bindings class to specify the classes to be preloaded in the console application. |
117 | 117 | //Thus, classes that can not be bound with http are called without closure in global loaders directory. |
118 | - $this->resolve(ConsoleBindings::class)->console($object,$callback,$container); |
|
118 | + $this->resolve(ConsoleBindings::class)->console($object, $callback, $container); |
|
119 | 119 | |
120 | 120 | //The console application must always return the kernel method. |
121 | 121 | return $this->kernel(); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @throws DependencyException |
131 | 131 | * @throws NotFoundException |
132 | 132 | */ |
133 | - private function consoleKernelObjectChecker($object,$callback,$container=false) |
|
133 | + private function consoleKernelObjectChecker($object, $callback, $container = false) |
|
134 | 134 | { |
135 | 135 | //we check whether the callback value is a callable function. |
136 | 136 | $isCallableForCallback = is_callable($callback); |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | //If the console object returns true, |
139 | 139 | //we do not cancel binding operations |
140 | 140 | //We are getting what applies to console with consoleKernelObject. |
141 | - if($this->console() AND $isCallableForCallback) return $this->consoleKernelObject($object,$callback,$container); |
|
141 | + if ($this->console() AND $isCallableForCallback) return $this->consoleKernelObject($object, $callback, $container); |
|
142 | 142 | |
143 | 143 | //If the application is not a console operation, we re-bind to existing methods synchronously. |
144 | - return ($container) ? $this->containerBuild($object,$callback,true) : $this->build($object,$callback,true); |
|
144 | + return ($container) ? $this->containerBuild($object, $callback, true) : $this->build($object, $callback, true); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -151,11 +151,11 @@ discard block |
||
151 | 151 | * @throws DependencyException |
152 | 152 | * @throws NotFoundException |
153 | 153 | */ |
154 | - private function consoleShared($object,$callback) |
|
154 | + private function consoleShared($object, $callback) |
|
155 | 155 | { |
156 | 156 | //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound. |
157 | 157 | //The work to be done here is to bind the classes to be included in the console share privately. |
158 | - $this->kernelAssigner()->consoleShared($object,$callback); |
|
158 | + $this->kernelAssigner()->consoleShared($object, $callback); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -167,12 +167,12 @@ discard block |
||
167 | 167 | * @throws DependencyException |
168 | 168 | * @throws NotFoundException |
169 | 169 | */ |
170 | - public function containerBuild($object,$callback,$sync=false) |
|
170 | + public function containerBuild($object, $callback, $sync = false) |
|
171 | 171 | { |
172 | 172 | //If the console object returns true, |
173 | 173 | //we do not cancel binding operations |
174 | 174 | //We are getting what applies to console with consoleKernelObject. |
175 | - if($sync===false) return $this->consoleKernelObjectChecker($object,$callback,true); |
|
175 | + if ($sync===false) return $this->consoleKernelObjectChecker($object, $callback, true); |
|
176 | 176 | |
177 | 177 | //Since the objects that come to the build method are objects from the container method, |
178 | 178 | //we need to automatically create a kernel object named serviceContainer in this method. |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | //the value corresponding to the bind value for the global object is assigned and |
182 | 182 | //the resolve method is called for the dependency method. |
183 | - $this->kernelAssigner()->setKernelObject($object,$callback,'serviceContainer'); |
|
183 | + $this->kernelAssigner()->setKernelObject($object, $callback, 'serviceContainer'); |
|
184 | 184 | |
185 | 185 | //return kernel object |
186 | 186 | return $this->kernel(); |
@@ -190,11 +190,11 @@ discard block |
||
190 | 190 | * @param $class |
191 | 191 | * @param $bind |
192 | 192 | */ |
193 | - private function contextualBindCleaner($class,$bind) |
|
193 | + private function contextualBindCleaner($class, $bind) |
|
194 | 194 | { |
195 | 195 | //the context bind objects are checked again and the bind sequence submitted by |
196 | 196 | //the user is checked and forced to re-instantiate the object. |
197 | - if(isset(self::$instance[$class]) && self::$bindParams[$class]!==$bind){ |
|
197 | + if (isset(self::$instance[$class]) && self::$bindParams[$class]!==$bind) { |
|
198 | 198 | unset(self::$instance[$class]); |
199 | 199 | unset(self::$bindParams[$class]); |
200 | 200 | } |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | |
214 | 214 | // the has method can have a dotted string value so |
215 | 215 | // we need to be able to control the string or array within the container. |
216 | - foreach (explode(".",$abstract) as $item){ |
|
217 | - if(isset($container[$item])){ |
|
216 | + foreach (explode(".", $abstract) as $item) { |
|
217 | + if (isset($container[$item])) { |
|
218 | 218 | $container = $container[$item]; |
219 | 219 | } |
220 | - else{ |
|
220 | + else { |
|
221 | 221 | return null; |
222 | 222 | } |
223 | 223 | } |
@@ -240,11 +240,11 @@ discard block |
||
240 | 240 | |
241 | 241 | // the has method can have a dotted string value so |
242 | 242 | // we need to be able to control the string or array within the container. |
243 | - foreach (explode(".",$abstract) as $item){ |
|
243 | + foreach (explode(".", $abstract) as $item) { |
|
244 | 244 | |
245 | 245 | // this blog will work |
246 | 246 | // if the data in the container loop points to an array. |
247 | - if(!is_array($container)){ |
|
247 | + if (!is_array($container)) { |
|
248 | 248 | |
249 | 249 | // we are querying the value of |
250 | 250 | // the items corresponding to the dotted value in the container. |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $container = $container[$item]; |
253 | 253 | $bools[] = is_null($container) ? false : true; |
254 | 254 | } |
255 | - else{ |
|
255 | + else { |
|
256 | 256 | |
257 | 257 | // if the container array corresponds to a string, |
258 | 258 | // the bools array is filled with the isset control directly. |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | |
263 | 263 | // the method returns false if the bools sequence is false, |
264 | 264 | // otherwise it will return true. |
265 | - return in_array(false,$bools) ? false : true; |
|
265 | + return in_array(false, $bools) ? false : true; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * @throws DependencyException |
313 | 313 | * @throws NotFoundException |
314 | 314 | */ |
315 | - public function make($object=null,$callback=null,$container=false) |
|
315 | + public function make($object = null, $callback = null, $container = false) |
|
316 | 316 | { |
317 | 317 | //we check whether the boolean value of the singleton variable used |
318 | 318 | //for booting does not reset every time the object variable to be assigned to the kernel variable is true |
@@ -320,8 +320,8 @@ discard block |
||
320 | 320 | |
321 | 321 | //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound. |
322 | 322 | //The work to be done here is to bind the classes to be included in the console share privately. |
323 | - if($container){ |
|
324 | - $this->consoleShared($object,$callback); |
|
323 | + if ($container) { |
|
324 | + $this->consoleShared($object, $callback); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | //If the third parameter passed to the bind method carries a container value, |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | //If the bind method does not have parameters object and callback, the value is directly assigned to the kernel object. |
332 | 332 | //Otherwise, when the bind object and callback are sent, the closure class inherits |
333 | 333 | //the applicationProvider object and the resolve method is called |
334 | - return ($object===null) ? $this->kernel() : $this->{$makeBuild}($object,$callback); |
|
334 | + return ($object===null) ? $this->kernel() : $this->{$makeBuild}($object, $callback); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | */ |
352 | 352 | public function offsetGet($offset) { |
353 | 353 | |
354 | - return $this->resolve($this->instances['containerInstanceResolve'],[ |
|
354 | + return $this->resolve($this->instances['containerInstanceResolve'], [ |
|
355 | 355 | 'instances' => $this->instances |
356 | 356 | ])->{$offset}(); |
357 | 357 | } |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * @param null $concrete |
376 | 376 | * @return bool|mixed |
377 | 377 | */ |
378 | - public function register($key,$object,$concrete=null) |
|
378 | + public function register($key, $object, $concrete = null) |
|
379 | 379 | { |
380 | 380 | // we assign the values required |
381 | 381 | // for register to the global value variable. |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | |
386 | 386 | // If there is an instance of the application class, |
387 | 387 | // the register method is saved both in this example and in the global. |
388 | - if(defined('appInstance')){ |
|
388 | + if (defined('appInstance')) { |
|
389 | 389 | |
390 | 390 | // where we will assign both the global instance |
391 | 391 | // and the registered application object. |
@@ -404,19 +404,19 @@ discard block |
||
404 | 404 | * @param bool $withConcrete |
405 | 405 | * @return bool |
406 | 406 | */ |
407 | - private function registerProcess($instance,$withConcrete=false) |
|
407 | + private function registerProcess($instance, $withConcrete = false) |
|
408 | 408 | { |
409 | 409 | // values recorded without concrete. |
410 | 410 | // or values deleted |
411 | - if(false===$withConcrete){ |
|
411 | + if (false===$withConcrete) { |
|
412 | 412 | |
413 | 413 | //values registered without concrete |
414 | - $instance->{$this->values['key']}=$this->values['object']; |
|
414 | + $instance->{$this->values['key']} = $this->values['object']; |
|
415 | 415 | return false; |
416 | 416 | } |
417 | 417 | |
418 | 418 | //values registered with concrete |
419 | - $instance->{$this->values['key']}[$this->values['object']]=$this->values['concrete']; |
|
419 | + $instance->{$this->values['key']}[$this->values['object']] = $this->values['concrete']; |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | /** |
@@ -427,22 +427,22 @@ discard block |
||
427 | 427 | * @throws DependencyException |
428 | 428 | * @throws NotFoundException |
429 | 429 | */ |
430 | - public function resolve($class,$bind=array()) |
|
430 | + public function resolve($class, $bind = array()) |
|
431 | 431 | { |
432 | 432 | //the context bind objects are checked again and the bind sequence submitted by |
433 | 433 | //the user is checked and forced to re-instantiate the object. |
434 | - $this->contextualBindCleaner($class,$bind); |
|
434 | + $this->contextualBindCleaner($class, $bind); |
|
435 | 435 | |
436 | 436 | //We do an instance check to get the static instance values of |
437 | 437 | //the classes to be resolved with the make bind method. |
438 | - if(!isset(self::$instance[$class])){ |
|
438 | + if (!isset(self::$instance[$class])) { |
|
439 | 439 | |
440 | 440 | //bind params object |
441 | 441 | self::$bindParams[$class] = $bind; |
442 | 442 | |
443 | 443 | //By singleton checking, we solve the dependency injection of the given class. |
444 | 444 | //Thus, each class can be called together with its dependency. |
445 | - self::$instance[$class] = DIContainerManager::make($class,$this->applicationProviderBinding($this,self::$bindParams[$class])); |
|
445 | + self::$instance[$class] = DIContainerManager::make($class, $this->applicationProviderBinding($this, self::$bindParams[$class])); |
|
446 | 446 | $this->singleton()->resolved[$class] = self::$instance[$class]; |
447 | 447 | |
448 | 448 | //return resolve class |
@@ -460,9 +460,9 @@ discard block |
||
460 | 460 | * @param $class |
461 | 461 | * @return mixed |
462 | 462 | */ |
463 | - public function resolved($class){ |
|
463 | + public function resolved($class) { |
|
464 | 464 | |
465 | - if(isset($this['resolved'][$class])){ |
|
465 | + if (isset($this['resolved'][$class])) { |
|
466 | 466 | return $this['resolved'][$class]; |
467 | 467 | } |
468 | 468 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @throws DependencyException |
478 | 478 | * @throws NotFoundException |
479 | 479 | */ |
480 | - public function share($object=null,$callback=null) |
|
480 | + public function share($object = null, $callback = null) |
|
481 | 481 | { |
482 | 482 | //we check whether the boolean value of the singleton variable used |
483 | 483 | //for booting does not reset every time the object variable to be assigned to the kernel variable is true |
@@ -485,12 +485,12 @@ discard block |
||
485 | 485 | |
486 | 486 | //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound. |
487 | 487 | //The work to be done here is to bind the classes to be included in the console share privately. |
488 | - $this->consoleShared($object,$callback); |
|
488 | + $this->consoleShared($object, $callback); |
|
489 | 489 | |
490 | 490 | //If the bind method does not have parameters object and callback, the value is directly assigned to the kernel object. |
491 | 491 | //Otherwise, when the bind object and callback are sent, the closure class inherits |
492 | 492 | //the applicationProvider object and the resolve method is called |
493 | - return ($object===null) ? $this->kernel() : $this->build($object,$callback); |
|
493 | + return ($object===null) ? $this->kernel() : $this->build($object, $callback); |
|
494 | 494 | |
495 | 495 | } |
496 | 496 | |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | */ |
511 | 511 | public function singleton() |
512 | 512 | { |
513 | - if($this->singleton===false){ |
|
513 | + if ($this->singleton===false) { |
|
514 | 514 | |
515 | 515 | //after first initializing, the singleton variable is set to true, |
516 | 516 | //and subsequent incoming classes can inherit the loaded object. |
@@ -531,12 +531,12 @@ discard block |
||
531 | 531 | // for application instance |
532 | 532 | // if the values to be saved are to be saved without the concrete, |
533 | 533 | // if it is an array. |
534 | - if($this->values['concrete']===null) { |
|
534 | + if ($this->values['concrete']===null) { |
|
535 | 535 | |
536 | 536 | // Without concrete, |
537 | 537 | // the saved value will be saved |
538 | 538 | // if the it does not exist in application instance. |
539 | - if(!isset($instance->{$this->values['key']})) { |
|
539 | + if (!isset($instance->{$this->values['key']})) { |
|
540 | 540 | $this->registerProcess($instance); |
541 | 541 | } |
542 | 542 | return false; |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | |
545 | 545 | // We send concrete values to be recorded with concrete as true. |
546 | 546 | // these values will be recorded as a array. |
547 | - $this->registerProcess($instance,true); |
|
547 | + $this->registerProcess($instance, true); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | /** |
@@ -552,11 +552,11 @@ discard block |
||
552 | 552 | * @param null|string $object |
553 | 553 | * @return mixed |
554 | 554 | */ |
555 | - public function terminate($key,$object=null) |
|
555 | + public function terminate($key, $object = null) |
|
556 | 556 | { |
557 | 557 | // object null is |
558 | 558 | // sent to just terminate a key. |
559 | - if($object===null){ |
|
559 | + if ($object===null) { |
|
560 | 560 | unset(core()->{$key}); |
561 | 561 | unset($this->singleton()->{$key}); |
562 | 562 | return false; |
@@ -13,23 +13,23 @@ discard block |
||
13 | 13 | */ |
14 | 14 | public function getColoredString($string, $foreground_color = null, $background_color = null) |
15 | 15 | { |
16 | - $this->consoleLogger($string,'info'); |
|
16 | + $this->consoleLogger($string, 'info'); |
|
17 | 17 | |
18 | - if(isset($this->argument['commandCall'])) return $string; |
|
18 | + if (isset($this->argument['commandCall'])) return $string; |
|
19 | 19 | |
20 | 20 | $colored_string = ""; |
21 | 21 | |
22 | 22 | // Check if given foreground color found |
23 | 23 | if (isset($this->foreground_colors[$foreground_color])) { |
24 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
24 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
25 | 25 | } |
26 | 26 | // Check if given background color found |
27 | 27 | if (isset($this->background_colors[$background_color])) { |
28 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
28 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | // Add string and end coloring |
32 | - $colored_string .= $string . "\033[0m"; |
|
32 | + $colored_string .= $string."\033[0m"; |
|
33 | 33 | |
34 | 34 | return $colored_string; |
35 | 35 | } |
@@ -43,25 +43,25 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function info($string, $foreground_color = 'blue', $background_color = 'white') |
45 | 45 | { |
46 | - $this->consoleLogger($string,'info'); |
|
46 | + $this->consoleLogger($string, 'info'); |
|
47 | 47 | |
48 | - if(isset($this->argument['commandCall'])) return $string; |
|
48 | + if (isset($this->argument['commandCall'])) return $string; |
|
49 | 49 | |
50 | 50 | $colored_string = ""; |
51 | 51 | |
52 | 52 | // Check if given foreground color found |
53 | 53 | if (isset($this->foreground_colors[$foreground_color])) { |
54 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
54 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
55 | 55 | } |
56 | 56 | // Check if given background color found |
57 | 57 | if (isset($this->background_colors[$background_color])) { |
58 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
58 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | // Add string and end coloring |
62 | - $colored_string .= $string . "\033[0m"; |
|
62 | + $colored_string .= $string."\033[0m"; |
|
63 | 63 | |
64 | - return ''.$colored_string.'' . PHP_EOL; |
|
64 | + return ''.$colored_string.''.PHP_EOL; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -71,19 +71,19 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function red($string, $foreground_color = 'red') |
73 | 73 | { |
74 | - $this->consoleLogger($string,'info'); |
|
74 | + $this->consoleLogger($string, 'info'); |
|
75 | 75 | |
76 | - if(isset($this->argument['commandCall'])) return $string; |
|
76 | + if (isset($this->argument['commandCall'])) return $string; |
|
77 | 77 | |
78 | 78 | $colored_string = ""; |
79 | 79 | |
80 | 80 | // Check if given foreground color found |
81 | 81 | if (isset($this->foreground_colors[$foreground_color])) { |
82 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
82 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | // Add string and end coloring |
86 | - $colored_string .= $string . "\033[0m"; |
|
86 | + $colored_string .= $string."\033[0m"; |
|
87 | 87 | |
88 | 88 | return $colored_string; |
89 | 89 | } |
@@ -97,25 +97,25 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function success($string, $foreground_color = 'white', $background_color = 'yellow') |
99 | 99 | { |
100 | - $this->consoleLogger($string,'info'); |
|
100 | + $this->consoleLogger($string, 'info'); |
|
101 | 101 | |
102 | - if(isset($this->argument['commandCall'])) return $string; |
|
102 | + if (isset($this->argument['commandCall'])) return $string; |
|
103 | 103 | |
104 | 104 | $colored_string = ""; |
105 | 105 | |
106 | 106 | // Check if given foreground color found |
107 | 107 | if (isset($this->foreground_colors[$foreground_color])) { |
108 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
108 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
109 | 109 | } |
110 | 110 | // Check if given background color found |
111 | 111 | if (isset($this->background_colors[$background_color])) { |
112 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
112 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // Add string and end coloring |
116 | - $colored_string .= $string . "\033[0m"; |
|
116 | + $colored_string .= $string."\033[0m"; |
|
117 | 117 | |
118 | - return ''.$colored_string.'' . PHP_EOL; |
|
118 | + return ''.$colored_string.''.PHP_EOL; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -126,25 +126,25 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function classical($string, $foreground_color = 'red', $background_color = 'white') |
128 | 128 | { |
129 | - $this->consoleLogger($string,'info'); |
|
129 | + $this->consoleLogger($string, 'info'); |
|
130 | 130 | |
131 | - if(isset($this->argument['commandCall'])) return $string; |
|
131 | + if (isset($this->argument['commandCall'])) return $string; |
|
132 | 132 | |
133 | 133 | $colored_string = ""; |
134 | 134 | |
135 | 135 | // Check if given foreground color found |
136 | 136 | if (isset($this->foreground_colors[$foreground_color])) { |
137 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
137 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
138 | 138 | } |
139 | 139 | // Check if given background color found |
140 | 140 | if (isset($this->background_colors[$background_color])) { |
141 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
141 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | // Add string and end coloring |
145 | - $colored_string .= $string . "\033[0m"; |
|
145 | + $colored_string .= $string."\033[0m"; |
|
146 | 146 | |
147 | - return ''.$colored_string.'' . PHP_EOL; |
|
147 | + return ''.$colored_string.''.PHP_EOL; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -155,25 +155,25 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function bluePrint($string, $foreground_color = 'blue', $background_color = 'white') |
157 | 157 | { |
158 | - $this->consoleLogger($string,'info'); |
|
158 | + $this->consoleLogger($string, 'info'); |
|
159 | 159 | |
160 | - if(isset($this->argument['commandCall'])) return $string; |
|
160 | + if (isset($this->argument['commandCall'])) return $string; |
|
161 | 161 | |
162 | 162 | $colored_string = ""; |
163 | 163 | |
164 | 164 | // Check if given foreground color found |
165 | 165 | if (isset($this->foreground_colors[$foreground_color])) { |
166 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
166 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
167 | 167 | } |
168 | 168 | // Check if given background color found |
169 | 169 | if (isset($this->background_colors[$background_color])) { |
170 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
170 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | // Add string and end coloring |
174 | - $colored_string .= $string . "\033[0m"; |
|
174 | + $colored_string .= $string."\033[0m"; |
|
175 | 175 | |
176 | - return ''.$colored_string.'' . PHP_EOL; |
|
176 | + return ''.$colored_string.''.PHP_EOL; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -184,25 +184,25 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function yellowPrint($string, $foreground_color = 'black', $background_color = 'yellow') |
186 | 186 | { |
187 | - $this->consoleLogger($string,'info'); |
|
187 | + $this->consoleLogger($string, 'info'); |
|
188 | 188 | |
189 | - if(isset($this->argument['commandCall'])) return $string; |
|
189 | + if (isset($this->argument['commandCall'])) return $string; |
|
190 | 190 | |
191 | 191 | $colored_string = ""; |
192 | 192 | |
193 | 193 | // Check if given foreground color found |
194 | 194 | if (isset($this->foreground_colors[$foreground_color])) { |
195 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
195 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
196 | 196 | } |
197 | 197 | // Check if given background color found |
198 | 198 | if (isset($this->background_colors[$background_color])) { |
199 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
199 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | // Add string and end coloring |
203 | - $colored_string .= $string . "\033[0m"; |
|
203 | + $colored_string .= $string."\033[0m"; |
|
204 | 204 | |
205 | - return ''.$colored_string.'' . PHP_EOL; |
|
205 | + return ''.$colored_string.''.PHP_EOL; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -213,25 +213,25 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function blue($string, $foreground_color = 'white', $background_color = 'blue') |
215 | 215 | { |
216 | - $this->consoleLogger($string,'info'); |
|
216 | + $this->consoleLogger($string, 'info'); |
|
217 | 217 | |
218 | - if(isset($this->argument['commandCall'])) return $string; |
|
218 | + if (isset($this->argument['commandCall'])) return $string; |
|
219 | 219 | |
220 | 220 | $colored_string = ""; |
221 | 221 | |
222 | 222 | // Check if given foreground color found |
223 | 223 | if (isset($this->foreground_colors[$foreground_color])) { |
224 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
224 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
225 | 225 | } |
226 | 226 | // Check if given background color found |
227 | 227 | if (isset($this->background_colors[$background_color])) { |
228 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
228 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // Add string and end coloring |
232 | - $colored_string .= $string . "\033[0m"; |
|
232 | + $colored_string .= $string."\033[0m"; |
|
233 | 233 | |
234 | - return ''.$colored_string.'' . PHP_EOL; |
|
234 | + return ''.$colored_string.''.PHP_EOL; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -242,25 +242,25 @@ discard block |
||
242 | 242 | */ |
243 | 243 | public function yellow($string, $foreground_color = 'blue', $background_color = 'yellow') |
244 | 244 | { |
245 | - $this->consoleLogger($string,'info'); |
|
245 | + $this->consoleLogger($string, 'info'); |
|
246 | 246 | |
247 | - if(isset($this->argument['commandCall'])) return $string; |
|
247 | + if (isset($this->argument['commandCall'])) return $string; |
|
248 | 248 | |
249 | 249 | $colored_string = ""; |
250 | 250 | |
251 | 251 | // Check if given foreground color found |
252 | 252 | if (isset($this->foreground_colors[$foreground_color])) { |
253 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
253 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
254 | 254 | } |
255 | 255 | // Check if given background color found |
256 | 256 | if (isset($this->background_colors[$background_color])) { |
257 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
257 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | // Add string and end coloring |
261 | - $colored_string .= $string . "\033[0m"; |
|
261 | + $colored_string .= $string."\033[0m"; |
|
262 | 262 | |
263 | - return ''.$colored_string.'' . PHP_EOL; |
|
263 | + return ''.$colored_string.''.PHP_EOL; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -271,25 +271,25 @@ discard block |
||
271 | 271 | */ |
272 | 272 | public function cyan($string, $foreground_color = 'magenta', $background_color = 'cyan') |
273 | 273 | { |
274 | - $this->consoleLogger($string,'info'); |
|
274 | + $this->consoleLogger($string, 'info'); |
|
275 | 275 | |
276 | - if(isset($this->argument['commandCall'])) return $string; |
|
276 | + if (isset($this->argument['commandCall'])) return $string; |
|
277 | 277 | |
278 | 278 | $colored_string = ""; |
279 | 279 | |
280 | 280 | // Check if given foreground color found |
281 | 281 | if (isset($this->foreground_colors[$foreground_color])) { |
282 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
282 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
283 | 283 | } |
284 | 284 | // Check if given background color found |
285 | 285 | if (isset($this->background_colors[$background_color])) { |
286 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
286 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | // Add string and end coloring |
290 | - $colored_string .= $string . "\033[0m"; |
|
290 | + $colored_string .= $string."\033[0m"; |
|
291 | 291 | |
292 | - return ''.$colored_string.'' . PHP_EOL; |
|
292 | + return ''.$colored_string.''.PHP_EOL; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -300,23 +300,23 @@ discard block |
||
300 | 300 | */ |
301 | 301 | public function input($string, $foreground_color = 'blue', $background_color = 'light_gray') |
302 | 302 | { |
303 | - $this->consoleLogger($string,'info'); |
|
303 | + $this->consoleLogger($string, 'info'); |
|
304 | 304 | |
305 | - if(isset($this->argument['commandCall'])) return $string; |
|
305 | + if (isset($this->argument['commandCall'])) return $string; |
|
306 | 306 | |
307 | 307 | $colored_string = ""; |
308 | 308 | |
309 | 309 | // Check if given foreground color found |
310 | 310 | if (isset($this->foreground_colors[$foreground_color])) { |
311 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
311 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
312 | 312 | } |
313 | 313 | // Check if given background color found |
314 | 314 | if (isset($this->background_colors[$background_color])) { |
315 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
315 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | // Add string and end coloring |
319 | - $colored_string .= $string . "\033[0m"; |
|
319 | + $colored_string .= $string."\033[0m"; |
|
320 | 320 | |
321 | 321 | return ''.$colored_string.''; |
322 | 322 | } |
@@ -329,24 +329,24 @@ discard block |
||
329 | 329 | */ |
330 | 330 | public function error($string, $foreground_color = 'white', $background_color = 'red') |
331 | 331 | { |
332 | - $this->consoleLogger($string,'error'); |
|
332 | + $this->consoleLogger($string, 'error'); |
|
333 | 333 | |
334 | - if(isset($this->argument['commandCall'])) return $string; |
|
334 | + if (isset($this->argument['commandCall'])) return $string; |
|
335 | 335 | |
336 | 336 | $colored_string = ""; |
337 | 337 | |
338 | 338 | // Check if given foreground color found |
339 | 339 | if (isset($this->foreground_colors[$foreground_color])) { |
340 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
340 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
341 | 341 | } |
342 | 342 | // Check if given background color found |
343 | 343 | if (isset($this->background_colors[$background_color])) { |
344 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
344 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | // Add string and end coloring |
348 | - $colored_string .= "!!!! Error : ".$string . " \033[0m"; |
|
348 | + $colored_string .= "!!!! Error : ".$string." \033[0m"; |
|
349 | 349 | |
350 | - return ''.$colored_string.'' . PHP_EOL; |
|
350 | + return ''.$colored_string.''.PHP_EOL; |
|
351 | 351 | } |
352 | 352 | } |
353 | 353 | \ No newline at end of file |
@@ -15,7 +15,9 @@ discard block |
||
15 | 15 | { |
16 | 16 | $this->consoleLogger($string,'info'); |
17 | 17 | |
18 | - if(isset($this->argument['commandCall'])) return $string; |
|
18 | + if(isset($this->argument['commandCall'])) { |
|
19 | + return $string; |
|
20 | + } |
|
19 | 21 | |
20 | 22 | $colored_string = ""; |
21 | 23 | |
@@ -45,7 +47,9 @@ discard block |
||
45 | 47 | { |
46 | 48 | $this->consoleLogger($string,'info'); |
47 | 49 | |
48 | - if(isset($this->argument['commandCall'])) return $string; |
|
50 | + if(isset($this->argument['commandCall'])) { |
|
51 | + return $string; |
|
52 | + } |
|
49 | 53 | |
50 | 54 | $colored_string = ""; |
51 | 55 | |
@@ -73,7 +77,9 @@ discard block |
||
73 | 77 | { |
74 | 78 | $this->consoleLogger($string,'info'); |
75 | 79 | |
76 | - if(isset($this->argument['commandCall'])) return $string; |
|
80 | + if(isset($this->argument['commandCall'])) { |
|
81 | + return $string; |
|
82 | + } |
|
77 | 83 | |
78 | 84 | $colored_string = ""; |
79 | 85 | |
@@ -99,7 +105,9 @@ discard block |
||
99 | 105 | { |
100 | 106 | $this->consoleLogger($string,'info'); |
101 | 107 | |
102 | - if(isset($this->argument['commandCall'])) return $string; |
|
108 | + if(isset($this->argument['commandCall'])) { |
|
109 | + return $string; |
|
110 | + } |
|
103 | 111 | |
104 | 112 | $colored_string = ""; |
105 | 113 | |
@@ -128,7 +136,9 @@ discard block |
||
128 | 136 | { |
129 | 137 | $this->consoleLogger($string,'info'); |
130 | 138 | |
131 | - if(isset($this->argument['commandCall'])) return $string; |
|
139 | + if(isset($this->argument['commandCall'])) { |
|
140 | + return $string; |
|
141 | + } |
|
132 | 142 | |
133 | 143 | $colored_string = ""; |
134 | 144 | |
@@ -157,7 +167,9 @@ discard block |
||
157 | 167 | { |
158 | 168 | $this->consoleLogger($string,'info'); |
159 | 169 | |
160 | - if(isset($this->argument['commandCall'])) return $string; |
|
170 | + if(isset($this->argument['commandCall'])) { |
|
171 | + return $string; |
|
172 | + } |
|
161 | 173 | |
162 | 174 | $colored_string = ""; |
163 | 175 | |
@@ -186,7 +198,9 @@ discard block |
||
186 | 198 | { |
187 | 199 | $this->consoleLogger($string,'info'); |
188 | 200 | |
189 | - if(isset($this->argument['commandCall'])) return $string; |
|
201 | + if(isset($this->argument['commandCall'])) { |
|
202 | + return $string; |
|
203 | + } |
|
190 | 204 | |
191 | 205 | $colored_string = ""; |
192 | 206 | |
@@ -215,7 +229,9 @@ discard block |
||
215 | 229 | { |
216 | 230 | $this->consoleLogger($string,'info'); |
217 | 231 | |
218 | - if(isset($this->argument['commandCall'])) return $string; |
|
232 | + if(isset($this->argument['commandCall'])) { |
|
233 | + return $string; |
|
234 | + } |
|
219 | 235 | |
220 | 236 | $colored_string = ""; |
221 | 237 | |
@@ -244,7 +260,9 @@ discard block |
||
244 | 260 | { |
245 | 261 | $this->consoleLogger($string,'info'); |
246 | 262 | |
247 | - if(isset($this->argument['commandCall'])) return $string; |
|
263 | + if(isset($this->argument['commandCall'])) { |
|
264 | + return $string; |
|
265 | + } |
|
248 | 266 | |
249 | 267 | $colored_string = ""; |
250 | 268 | |
@@ -273,7 +291,9 @@ discard block |
||
273 | 291 | { |
274 | 292 | $this->consoleLogger($string,'info'); |
275 | 293 | |
276 | - if(isset($this->argument['commandCall'])) return $string; |
|
294 | + if(isset($this->argument['commandCall'])) { |
|
295 | + return $string; |
|
296 | + } |
|
277 | 297 | |
278 | 298 | $colored_string = ""; |
279 | 299 | |
@@ -302,7 +322,9 @@ discard block |
||
302 | 322 | { |
303 | 323 | $this->consoleLogger($string,'info'); |
304 | 324 | |
305 | - if(isset($this->argument['commandCall'])) return $string; |
|
325 | + if(isset($this->argument['commandCall'])) { |
|
326 | + return $string; |
|
327 | + } |
|
306 | 328 | |
307 | 329 | $colored_string = ""; |
308 | 330 | |
@@ -331,7 +353,9 @@ discard block |
||
331 | 353 | { |
332 | 354 | $this->consoleLogger($string,'error'); |
333 | 355 | |
334 | - if(isset($this->argument['commandCall'])) return $string; |
|
356 | + if(isset($this->argument['commandCall'])) { |
|
357 | + return $string; |
|
358 | + } |
|
335 | 359 | |
336 | 360 | $colored_string = ""; |
337 | 361 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | * @param $offset |
18 | 18 | * @param $value |
19 | 19 | */ |
20 | - final public function offsetSet($offset,$value) |
|
20 | + final public function offsetSet($offset, $value) |
|
21 | 21 | { |
22 | 22 | $this->{$offset} = $value; |
23 | 23 | } |
@@ -161,8 +161,7 @@ |
||
161 | 161 | |
162 | 162 | if($fromRoutes['namespace']===null){ |
163 | 163 | $namespace = Utils::getNamespace($fromRoutes['controller']).'\\'.$fromRoutesClass; |
164 | - } |
|
165 | - else{ |
|
164 | + } else{ |
|
166 | 165 | $namespace = Utils::getNamespace($fromRoutes['controller']).'\\'.$fromRoutes['namespace'].'\\'.$fromRoutesClass; |
167 | 166 | } |
168 | 167 | } |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function resolveMethod($method) |
58 | 58 | { |
59 | - $method=str_replace(httpMethod(),'',$method); |
|
60 | - $method=str_replace(StaticPathModel::$methodPrefix,'',$method); |
|
59 | + $method = str_replace(httpMethod(), '', $method); |
|
60 | + $method = str_replace(StaticPathModel::$methodPrefix, '', $method); |
|
61 | 61 | return $method; |
62 | 62 | } |
63 | 63 | |
@@ -105,16 +105,16 @@ discard block |
||
105 | 105 | //If controller does not have a method after checking whether the method specified in the controller class exists, |
106 | 106 | //then by default we assign a default method value of indexAction. |
107 | 107 | //This value must match the class strictly, otherwise the controller can not be called |
108 | - if(method_exists($this->app['instanceController'],$this->getPrefixMethod())){ |
|
108 | + if (method_exists($this->app['instanceController'], $this->getPrefixMethod())) { |
|
109 | 109 | |
110 | 110 | //method value as normal |
111 | - return $this->setViaDefine($this->getPrefixMethod(),$globalInstance); |
|
111 | + return $this->setViaDefine($this->getPrefixMethod(), $globalInstance); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | //by default we assign a default method value of indexAction |
115 | 115 | //this value must be a method value automatically named indexAction |
116 | 116 | //if it does not come from the url discovery value |
117 | - return $this->setViaDefine($this->getPrefixIndexMethod(),$globalInstance); |
|
117 | + return $this->setViaDefine($this->getPrefixIndexMethod(), $globalInstance); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | { |
126 | 126 | //If the path variables give values in the methods do we have a method name, |
127 | 127 | //we subtract this value from the route variables. |
128 | - return array_values(array_diff(core()->routeParameters,[$method])); |
|
128 | + return array_values(array_diff(core()->routeParameters, [$method])); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -133,12 +133,12 @@ discard block |
||
133 | 133 | * @param $globalInstance Router |
134 | 134 | * @return mixed |
135 | 135 | */ |
136 | - private function setViaDefine($method,$globalInstance) |
|
136 | + private function setViaDefine($method, $globalInstance) |
|
137 | 137 | { |
138 | 138 | // we are extracting httpMethod and prefix from |
139 | 139 | // the method variable so that we can extract the salt method name. |
140 | - $deleteHttp = str_replace(httpMethod(),'',$method); |
|
141 | - $methodName = str_replace(StaticPathModel::$methodPrefix,'',$deleteHttp); |
|
140 | + $deleteHttp = str_replace(httpMethod(), '', $method); |
|
141 | + $methodName = str_replace(StaticPathModel::$methodPrefix, '', $deleteHttp); |
|
142 | 142 | |
143 | 143 | //set as global method name |
144 | 144 | $globalInstance->setMethodNameViaDefine($methodName); |
@@ -156,19 +156,19 @@ discard block |
||
156 | 156 | $fromRoutes = Route::getRouteResolve(); |
157 | 157 | $namespace = null; |
158 | 158 | |
159 | - if(count($fromRoutes)){ |
|
160 | - $fromRoutesClass = (isset($fromRoutes['class'])) ? $fromRoutes['class'] : null; |
|
159 | + if (count($fromRoutes)) { |
|
160 | + $fromRoutesClass = (isset($fromRoutes['class'])) ? $fromRoutes['class'] : null; |
|
161 | 161 | |
162 | - if($fromRoutes['namespace']===null){ |
|
162 | + if ($fromRoutes['namespace']===null) { |
|
163 | 163 | $namespace = Utils::getNamespace($fromRoutes['controller']).'\\'.$fromRoutesClass; |
164 | 164 | } |
165 | - else{ |
|
165 | + else { |
|
166 | 166 | $namespace = Utils::getNamespace($fromRoutes['controller']).'\\'.$fromRoutes['namespace'].'\\'.$fromRoutesClass; |
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | 170 | //check namespace exists |
171 | - if(file_exists(Utils::getPathFromNamespace($namespace)) && Utils::isNamespaceExists($namespace)){ |
|
171 | + if (file_exists(Utils::getPathFromNamespace($namespace)) && Utils::isNamespaceExists($namespace)) { |
|
172 | 172 | |
173 | 173 | // the controller classes are registered in the config controller. |
174 | 174 | // the controller class is not executed if it is not available here. |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | public function checkAutoService($instance) |
189 | 189 | { |
190 | 190 | //If auto service is present, this auto service will be accepted as endpoint namespace. |
191 | - return $this->checkEndpointForAutoService()->getNamespaceForAutoService($instance,function(){ |
|
191 | + return $this->checkEndpointForAutoService()->getNamespaceForAutoService($instance, function() { |
|
192 | 192 | exception()->notFoundException('Any endpoint is not available'); |
193 | 193 | }); |
194 | 194 | } |
@@ -200,19 +200,19 @@ discard block |
||
200 | 200 | { |
201 | 201 | $configController = config('controller'); |
202 | 202 | |
203 | - if($configController===null |
|
203 | + if ($configController===null |
|
204 | 204 | OR !isset($configController[$this->endpoint()]) |
205 | - or !isset($configController[$this->endpoint()][$namespace])){ |
|
205 | + or !isset($configController[$this->endpoint()][$namespace])) { |
|
206 | 206 | exception()->badFunctionCall('The request has not been saved in your configuration settings.'); |
207 | 207 | } |
208 | 208 | |
209 | 209 | $configController = $configController[$this->endpoint()][$namespace]; |
210 | 210 | |
211 | - if(isset($configController[environment()]) and $configController[environment()]===false){ |
|
211 | + if (isset($configController[environment()]) and $configController[environment()]===false) { |
|
212 | 212 | exception()->domain('Sorry, this endpoint is not allowed to run for this environment.'); |
213 | 213 | } |
214 | 214 | |
215 | - if(isset($configController['all']) AND $configController['all']===false){ |
|
215 | + if (isset($configController['all']) AND $configController['all']===false) { |
|
216 | 216 | exception()->domain('Sorry, this endpoint is never allowed to run.'); |
217 | 217 | } |
218 | 218 | } |
@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | * @param $concrete |
20 | 20 | * @return mixed|void |
21 | 21 | */ |
22 | - public function addListener($eventName, $abstract,$concrete) |
|
22 | + public function addListener($eventName, $abstract, $concrete) |
|
23 | 23 | { |
24 | - if(!isset($this->events[$eventName][strtolower($abstract)])){ |
|
24 | + if (!isset($this->events[$eventName][strtolower($abstract)])) { |
|
25 | 25 | |
26 | 26 | $this->events[$eventName][strtolower($abstract)] = $concrete; |
27 | 27 | |
28 | 28 | //we save to kernel object value of the event-dispatcher |
29 | - $this->app->register('events',$eventName,$this->events[$eventName]); |
|
29 | + $this->app->register('events', $eventName, $this->events[$eventName]); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | * @param array $subscriber |
35 | 35 | * @return mixed|void |
36 | 36 | */ |
37 | - public function addSubscriber($subscriber=array()) |
|
37 | + public function addSubscriber($subscriber = array()) |
|
38 | 38 | { |
39 | 39 | // To take advantage of an existing event, |
40 | 40 | // you need to connect a listener to the dispatcher |
41 | 41 | // so that it can be notified when the event is dispatched. |
42 | 42 | // A call to the dispatcher's addListener() method associates any valid PHP callable to an event: |
43 | - $this->listen = array_merge($this->getListeners(),[$this->event=>['subscriber'=>$subscriber]]); |
|
43 | + $this->listen = array_merge($this->getListeners(), [$this->event=>['subscriber'=>$subscriber]]); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 |
@@ -21,19 +21,19 @@ discard block |
||
21 | 21 | * @param $event |
22 | 22 | * @param $events |
23 | 23 | */ |
24 | - protected function handlerDispatch($event,$events) |
|
24 | + protected function handlerDispatch($event, $events) |
|
25 | 25 | { |
26 | 26 | $eventName = lcfirst(class_basename($event)); |
27 | 27 | |
28 | - if(isset($events[$eventName])){ |
|
28 | + if (isset($events[$eventName])) { |
|
29 | 29 | |
30 | 30 | $listenerPath = app()->namespace()->optionalListeners(); |
31 | 31 | |
32 | - foreach($events[$eventName] as $listeners){ |
|
32 | + foreach ($events[$eventName] as $listeners) { |
|
33 | 33 | |
34 | 34 | $listenerClass = $listenerPath.'\\'.ucfirst($listeners); |
35 | 35 | |
36 | - if(Utils::isNamespaceExists($listenerClass)){ |
|
36 | + if (Utils::isNamespaceExists($listenerClass)) { |
|
37 | 37 | $this->app->resolve($listenerClass)->handle($event); |
38 | 38 | } |
39 | 39 | } |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | * @param $eventName |
48 | 48 | * @return null |
49 | 49 | */ |
50 | - protected function handlerDispatchForString($event,$eventName) |
|
50 | + protected function handlerDispatchForString($event, $eventName) |
|
51 | 51 | { |
52 | 52 | $listeners = $this->getListeners(); |
53 | 53 | |
54 | - if(isset($listeners[$event][$eventName])){ |
|
54 | + if (isset($listeners[$event][$eventName])) { |
|
55 | 55 | return $listeners[$event][$eventName]; |
56 | 56 | } |
57 | 57 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public function getListeners() |
13 | 13 | { |
14 | - if(isset($this->app['events'])){ |
|
14 | + if (isset($this->app['events'])) { |
|
15 | 15 | return $this->app['events']; |
16 | 16 | } |
17 | 17 | return $this->listen; |
@@ -23,21 +23,21 @@ discard block |
||
23 | 23 | * @param $event |
24 | 24 | * @return mixed|void |
25 | 25 | */ |
26 | - public function dispatch($event,$eventName='default') |
|
26 | + public function dispatch($event, $eventName = 'default') |
|
27 | 27 | { |
28 | 28 | //recorded events must be. |
29 | - if(isset($this->app['events'])){ |
|
29 | + if (isset($this->app['events'])) { |
|
30 | 30 | |
31 | 31 | // in the logic of the events, |
32 | 32 | // the default keyi mandatory. |
33 | 33 | $events = $this->app['events']['events'] ?? ['default'=>[]]; |
34 | 34 | |
35 | - if(is_object($event)){ |
|
36 | - return $this->handlerDispatch($event,$events[$eventName]); |
|
35 | + if (is_object($event)) { |
|
36 | + return $this->handlerDispatch($event, $events[$eventName]); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | - return $this->handlerDispatchForString($event,$eventName); |
|
40 | + return $this->handlerDispatchForString($event, $eventName); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | public function handle() |
49 | 49 | { |
50 | 50 | //set constant event-dispatcher |
51 | - define('event-dispatcher',true); |
|
51 | + define('event-dispatcher', true); |
|
52 | 52 | |
53 | 53 | //we save to kernel object value of the event-dispatcher |
54 | - $this->addListener('events','default',$this->getListeners()); |
|
54 | + $this->addListener('events', 'default', $this->getListeners()); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 |
@@ -20,15 +20,15 @@ discard block |
||
20 | 20 | * @param callable $callback |
21 | 21 | * @return mixed |
22 | 22 | */ |
23 | - public function checkLoggerConfiguration($printer,callable $callback) |
|
23 | + public function checkLoggerConfiguration($printer, callable $callback) |
|
24 | 24 | { |
25 | 25 | // logger service handler |
26 | - if(config('app.logger')){ |
|
27 | - return $this->logHandler($printer,'access',$this->getLoggerType()); |
|
26 | + if (config('app.logger')) { |
|
27 | + return $this->logHandler($printer, 'access', $this->getLoggerType()); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | //return closure object with printer |
31 | - return call_user_func_array($callback,[$printer]); |
|
31 | + return call_user_func_array($callback, [$printer]); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function handle() |
50 | 50 | { |
51 | 51 | //set define for logger |
52 | - define('logger',true); |
|
52 | + define('logger', true); |
|
53 | 53 | |
54 | 54 | //we get the logger namespace value. |
55 | 55 | $loggerNamespace = app()->namespace()->logger(); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | // if the logger file does not exist |
58 | 58 | // or request console is true |
59 | 59 | // we throw a domain exception. |
60 | - if(Utils::isNamespaceExists($loggerNamespace)){ |
|
60 | + if (Utils::isNamespaceExists($loggerNamespace)) { |
|
61 | 61 | |
62 | 62 | //We are getting the path to |
63 | 63 | //the service log file in the project's version directory. |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | // we send the resulting adapter property as |
67 | 67 | // a reference to the bind automatic instance class. |
68 | - $this->setLogger($appBase,$appBase->adapter,$this); |
|
68 | + $this->setLogger($appBase, $appBase->adapter, $this); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | } |
@@ -78,16 +78,16 @@ discard block |
||
78 | 78 | * @param string $type |
79 | 79 | * @return mixed |
80 | 80 | */ |
81 | - public function logHandler($printer,$file="access",$type='info') |
|
81 | + public function logHandler($printer, $file = "access", $type = 'info') |
|
82 | 82 | { |
83 | - if(isset($this->app['log'])){ |
|
83 | + if (isset($this->app['log'])) { |
|
84 | 84 | |
85 | 85 | //we get the log object that was previously assigned. |
86 | 86 | $log = $this->app['log']; |
87 | 87 | |
88 | 88 | $base = current($log); |
89 | 89 | |
90 | - if($this->adapter!==null){ |
|
90 | + if ($this->adapter!==null) { |
|
91 | 91 | |
92 | 92 | $log = []; |
93 | 93 | $log[$this->adapter] = $base; |
@@ -99,17 +99,16 @@ discard block |
||
99 | 99 | // we call the method specified by the adapter in the service log class |
100 | 100 | // and log the application in the customized mode for the application. |
101 | 101 | // The service log class uses the monolog class. |
102 | - if(method_exists($base,$adapter=key($log))){ |
|
102 | + if (method_exists($base, $adapter = key($log))) { |
|
103 | 103 | |
104 | 104 | // this is very important. |
105 | 105 | // in the production log messages, |
106 | 106 | // we have to get the production log message kernel variable |
107 | 107 | // in order not to show an external error to the user |
108 | 108 | $logOutput = (isset($this->app['productionLogMessage'])) ? |
109 | - $this->app['productionLogMessage'] : |
|
110 | - $printer; |
|
109 | + $this->app['productionLogMessage'] : $printer; |
|
111 | 110 | |
112 | - call_user_func_array([$base,$adapter],[$logOutput,$file,$type]); |
|
111 | + call_user_func_array([$base, $adapter], [$logOutput, $file, $type]); |
|
113 | 112 | } |
114 | 113 | |
115 | 114 | //printer back |
@@ -123,15 +122,15 @@ discard block |
||
123 | 122 | * |
124 | 123 | * @param mixed ...$params |
125 | 124 | */ |
126 | - public function setLogger(...$params){ |
|
125 | + public function setLogger(...$params) { |
|
127 | 126 | |
128 | 127 | // params list |
129 | - [$base,$adapter,$loggerService] = $params; |
|
128 | + [$base, $adapter, $loggerService] = $params; |
|
130 | 129 | |
131 | 130 | // we take the adapter attribute for the log log |
132 | 131 | // from the service log class and save it to the kernel object. |
133 | - $this->app->register('logger',app()->namespace()->logger()); |
|
134 | - $this->app->register('loggerService',$loggerService); |
|
135 | - $this->app->register('log',$adapter,$base); |
|
132 | + $this->app->register('logger', app()->namespace()->logger()); |
|
133 | + $this->app->register('loggerService', $loggerService); |
|
134 | + $this->app->register('log', $adapter, $base); |
|
136 | 135 | } |
137 | 136 | } |
138 | 137 | \ No newline at end of file |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | public function handle() |
22 | 22 | { |
23 | 23 | //set define for encrypter |
24 | - define('encrypter',true); |
|
24 | + define('encrypter', true); |
|
25 | 25 | |
26 | 26 | //get encrypter file |
27 | 27 | $encrypterFile = path()->encrypterFile(); |
28 | 28 | |
29 | 29 | //throws an exception it there is no encrypter file |
30 | - if(!file_exists($encrypterFile)){ |
|
30 | + if (!file_exists($encrypterFile)) { |
|
31 | 31 | exception()->domain('The Application key is invalid'); |
32 | 32 | } |
33 | 33 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | //we are checking two values for key comparison.1.st separated value encryption |
38 | 38 | //key second separated value crypto closure value |
39 | - $appKey = explode("__",$appKeyFile['key']); |
|
39 | + $appKey = explode("__", $appKeyFile['key']); |
|
40 | 40 | |
41 | 41 | //we are assigning a singleton object |
42 | 42 | //so that we can use our application key in the project. |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | { |
57 | 57 | //we are assigning a singleton object |
58 | 58 | //so that we can use our application key in the project. |
59 | - $this->app->register('applicationKey',current($key)); |
|
59 | + $this->app->register('applicationKey', current($key)); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 |