@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @param $callback null |
| 11 | 11 | * @return mixed |
| 12 | 12 | */ |
| 13 | - public function bind($object=null,$callback=null); |
|
| 13 | + public function bind($object = null, $callback = null); |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * @param $object |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @param array $arguments |
| 24 | 24 | * @return mixed |
| 25 | 25 | */ |
| 26 | - public function command($command,$arguments=array()); |
|
| 26 | + public function command($command, $arguments = array()); |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * @return array |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @param array $environment |
| 51 | 51 | * @return mixed |
| 52 | 52 | */ |
| 53 | - public function environment($environment=array()); |
|
| 53 | + public function environment($environment = array()); |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * @param $abstract |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param $instance |
| 75 | 75 | * @return mixed |
| 76 | 76 | */ |
| 77 | - public function instance ($abstract,$instance); |
|
| 77 | + public function instance($abstract, $instance); |
|
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * @return mixed |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @param array $loaders |
| 108 | 108 | * @return mixed |
| 109 | 109 | */ |
| 110 | - public function loadIfNotExistBoot($loaders=array()); |
|
| 110 | + public function loadIfNotExistBoot($loaders = array()); |
|
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | 113 | * @method bind |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @param $container false |
| 117 | 117 | * @return mixed |
| 118 | 118 | */ |
| 119 | - public function make($object=null,$callback=null,$container=false); |
|
| 119 | + public function make($object = null, $callback = null, $container = false); |
|
| 120 | 120 | |
| 121 | 121 | /** |
| 122 | 122 | * @param $maker |
@@ -140,14 +140,14 @@ discard block |
||
| 140 | 140 | * @param mixed $concrete |
| 141 | 141 | * @return mixed |
| 142 | 142 | */ |
| 143 | - public function register($key,$object,$concrete=null); |
|
| 143 | + public function register($key, $object, $concrete = null); |
|
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | 146 | * @param $class |
| 147 | 147 | * @param array $bind |
| 148 | 148 | * @return mixed |
| 149 | 149 | */ |
| 150 | - public function resolve($class,$bind=array()); |
|
| 150 | + public function resolve($class, $bind = array()); |
|
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | 153 | * @param $class |
@@ -170,14 +170,14 @@ discard block |
||
| 170 | 170 | * @param string $path |
| 171 | 171 | * @return mixed |
| 172 | 172 | */ |
| 173 | - public function setPaths($name,$path); |
|
| 173 | + public function setPaths($name, $path); |
|
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * @param null $object |
| 177 | 177 | * @param null $callback |
| 178 | 178 | * @return mixed |
| 179 | 179 | */ |
| 180 | - public function share($object=null,$callback=null); |
|
| 180 | + public function share($object = null, $callback = null); |
|
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | 183 | * @method singleton |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * @param null|string $object |
| 191 | 191 | * @return mixed |
| 192 | 192 | */ |
| 193 | - public function terminate($key,$object=null); |
|
| 193 | + public function terminate($key, $object = null); |
|
| 194 | 194 | |
| 195 | 195 | /** |
| 196 | 196 | * @return mixed |
@@ -7,12 +7,12 @@ discard block |
||
| 7 | 7 | use Resta\Contracts\ContainerContracts; |
| 8 | 8 | use Resta\Container\ContainerKernelAssigner; |
| 9 | 9 | |
| 10 | -class Container implements ContainerContracts,\ArrayAccess |
|
| 10 | +class Container implements ContainerContracts, \ArrayAccess |
|
| 11 | 11 | {
|
| 12 | 12 | /** |
| 13 | 13 | * @var $singleton |
| 14 | 14 | */ |
| 15 | - public $singleton=false; |
|
| 15 | + public $singleton = false; |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * @var $kernel |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | /** |
| 23 | 23 | * @var array $instance |
| 24 | 24 | */ |
| 25 | - private static $instance=[]; |
|
| 25 | + private static $instance = []; |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @var array $instances |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * @var array $bindParams |
| 34 | 34 | */ |
| 35 | - private static $bindParams=[]; |
|
| 35 | + private static $bindParams = []; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @var $unregister |
@@ -42,19 +42,19 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * @var array |
| 44 | 44 | */ |
| 45 | - protected $values=[]; |
|
| 45 | + protected $values = []; |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @param $make |
| 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 | /** |
@@ -65,12 +65,12 @@ discard block |
||
| 65 | 65 | * @throws \DI\DependencyException |
| 66 | 66 | * @throws \DI\NotFoundException |
| 67 | 67 | */ |
| 68 | - public function bind($object=null,$callback=null) |
|
| 68 | + public function bind($object = null, $callback = null) |
|
| 69 | 69 | {
|
| 70 | 70 | //If the bind method does not have parameters object and callback, the value is directly assigned to the kernel object. |
| 71 | 71 | //Otherwise, when the bind object and callback are sent, the closure class inherits |
| 72 | 72 | //the applicationProvider object and the resolve method is called |
| 73 | - return $this->make($object,$callback,'container'); |
|
| 73 | + return $this->make($object, $callback, 'container'); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -82,16 +82,16 @@ discard block |
||
| 82 | 82 | * @throws \DI\DependencyException |
| 83 | 83 | * @throws \DI\NotFoundException |
| 84 | 84 | */ |
| 85 | - private function build($object,$callback,$sync=false) |
|
| 85 | + private function build($object, $callback, $sync = false) |
|
| 86 | 86 | {
|
| 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) return $this->consoleKernelObjectChecker($object, $callback); |
|
| 91 | 91 | |
| 92 | 92 | //the value corresponding to the bind value for the global object is assigned and |
| 93 | 93 | //the resolve method is called for the dependency injection. |
| 94 | - $this->kernelAssigner()->setKernelObject($object,$callback); |
|
| 94 | + $this->kernelAssigner()->setKernelObject($object, $callback); |
|
| 95 | 95 | |
| 96 | 96 | //return kernel object |
| 97 | 97 | return $this->kernel(); |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | * @throws \DI\DependencyException |
| 107 | 107 | * @throws \DI\NotFoundException |
| 108 | 108 | */ |
| 109 | - private function consoleKernelObject($object,$callback,$container=false) |
|
| 109 | + private function consoleKernelObject($object, $callback, $container = false) |
|
| 110 | 110 | {
|
| 111 | 111 | //we use the console bindings class to specify the classes to be preloaded in the console application. |
| 112 | 112 | //Thus, classes that can not be bound with http are called without closure in global loaders directory. |
| 113 | - $this->resolve(ConsoleBindings::class)->console($object,$callback,$container); |
|
| 113 | + $this->resolve(ConsoleBindings::class)->console($object, $callback, $container); |
|
| 114 | 114 | |
| 115 | 115 | //The console application must always return the kernel method. |
| 116 | 116 | return $this->kernel(); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @throws \DI\DependencyException |
| 126 | 126 | * @throws \DI\NotFoundException |
| 127 | 127 | */ |
| 128 | - private function consoleKernelObjectChecker($object,$callback,$container=false) |
|
| 128 | + private function consoleKernelObjectChecker($object, $callback, $container = false) |
|
| 129 | 129 | {
|
| 130 | 130 | //we check whether the callback value is a callable function. |
| 131 | 131 | $isCallableForCallback = is_callable($callback); |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | //If the console object returns true, |
| 134 | 134 | //we do not cancel binding operations |
| 135 | 135 | //We are getting what applies to console with consoleKernelObject. |
| 136 | - if($this->console() AND $isCallableForCallback) return $this->consoleKernelObject($object,$callback,$container); |
|
| 136 | + if ($this->console() AND $isCallableForCallback) return $this->consoleKernelObject($object, $callback, $container); |
|
| 137 | 137 | |
| 138 | 138 | //If the application is not a console operation, we re-bind to existing methods synchronously. |
| 139 | - return ($container) ? $this->containerBuild($object,$callback,true) : $this->build($object,$callback,true); |
|
| 139 | + return ($container) ? $this->containerBuild($object, $callback, true) : $this->build($object, $callback, true); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | * @throws \DI\DependencyException |
| 147 | 147 | * @throws \DI\NotFoundException |
| 148 | 148 | */ |
| 149 | - private function consoleShared($object,$callback) |
|
| 149 | + private function consoleShared($object, $callback) |
|
| 150 | 150 | {
|
| 151 | 151 | //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound. |
| 152 | 152 | //The work to be done here is to bind the classes to be included in the console share privately. |
| 153 | - $this->kernelAssigner()->consoleShared($object,$callback); |
|
| 153 | + $this->kernelAssigner()->consoleShared($object, $callback); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
@@ -162,12 +162,12 @@ discard block |
||
| 162 | 162 | * @throws \DI\DependencyException |
| 163 | 163 | * @throws \DI\NotFoundException |
| 164 | 164 | */ |
| 165 | - public function containerBuild($object,$callback,$sync=false) |
|
| 165 | + public function containerBuild($object, $callback, $sync = false) |
|
| 166 | 166 | {
|
| 167 | 167 | //If the console object returns true, |
| 168 | 168 | //we do not cancel binding operations |
| 169 | 169 | //We are getting what applies to console with consoleKernelObject. |
| 170 | - if($sync===false) return $this->consoleKernelObjectChecker($object,$callback,true); |
|
| 170 | + if ($sync===false) return $this->consoleKernelObjectChecker($object, $callback, true); |
|
| 171 | 171 | |
| 172 | 172 | //Since the objects that come to the build method are objects from the container method, |
| 173 | 173 | //we need to automatically create a kernel object named serviceContainer in this method. |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | //the value corresponding to the bind value for the global object is assigned and |
| 177 | 177 | //the resolve method is called for the dependency method. |
| 178 | - $this->kernelAssigner()->setKernelObject($object,$callback,'serviceContainer'); |
|
| 178 | + $this->kernelAssigner()->setKernelObject($object, $callback, 'serviceContainer'); |
|
| 179 | 179 | |
| 180 | 180 | //return kernel object |
| 181 | 181 | return $this->kernel(); |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | * @param $class |
| 186 | 186 | * @param $bind |
| 187 | 187 | */ |
| 188 | - private function contextualBindCleaner($class,$bind) |
|
| 188 | + private function contextualBindCleaner($class, $bind) |
|
| 189 | 189 | {
|
| 190 | 190 | //the context bind objects are checked again and the bind sequence submitted by |
| 191 | 191 | //the user is checked and forced to re-instantiate the object. |
| 192 | - if(isset(self::$instance[$class]) && self::$bindParams[$class]!==$bind){
|
|
| 192 | + if (isset(self::$instance[$class]) && self::$bindParams[$class]!==$bind) {
|
|
| 193 | 193 | unset(self::$instance[$class]); |
| 194 | 194 | unset(self::$bindParams[$class]); |
| 195 | 195 | } |
@@ -208,11 +208,11 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | // the has method can have a dotted string value so |
| 210 | 210 | // we need to be able to control the string or array within the container. |
| 211 | - foreach (explode(".",$abstract) as $item){
|
|
| 212 | - if(isset($container[$item])){
|
|
| 211 | + foreach (explode(".", $abstract) as $item) {
|
|
| 212 | + if (isset($container[$item])) {
|
|
| 213 | 213 | $container = $container[$item]; |
| 214 | 214 | } |
| 215 | - else{
|
|
| 215 | + else {
|
|
| 216 | 216 | return null; |
| 217 | 217 | } |
| 218 | 218 | } |
@@ -235,11 +235,11 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | // the has method can have a dotted string value so |
| 237 | 237 | // we need to be able to control the string or array within the container. |
| 238 | - foreach (explode(".",$abstract) as $item){
|
|
| 238 | + foreach (explode(".", $abstract) as $item) {
|
|
| 239 | 239 | |
| 240 | 240 | // this blog will work |
| 241 | 241 | // if the data in the container loop points to an array. |
| 242 | - if(!is_array($container)){
|
|
| 242 | + if (!is_array($container)) {
|
|
| 243 | 243 | |
| 244 | 244 | // we are querying the value of |
| 245 | 245 | // the items corresponding to the dotted value in the container. |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $container = $container[$item]; |
| 248 | 248 | $bools[] = is_null($container) ? false : true; |
| 249 | 249 | } |
| 250 | - else{
|
|
| 250 | + else {
|
|
| 251 | 251 | |
| 252 | 252 | // if the container array corresponds to a string, |
| 253 | 253 | // the bools array is filled with the isset control directly. |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | |
| 258 | 258 | // the method returns false if the bools sequence is false, |
| 259 | 259 | // otherwise it will return true. |
| 260 | - return in_array(false,$bools) ? false : true; |
|
| 260 | + return in_array(false, $bools) ? false : true; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | * @throws \DI\DependencyException |
| 308 | 308 | * @throws \DI\NotFoundException |
| 309 | 309 | */ |
| 310 | - public function make($object=null,$callback=null,$container=false) |
|
| 310 | + public function make($object = null, $callback = null, $container = false) |
|
| 311 | 311 | {
|
| 312 | 312 | //we check whether the boolean value of the singleton variable used |
| 313 | 313 | //for booting does not reset every time the object variable to be assigned to the kernel variable is true |
@@ -315,8 +315,8 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound. |
| 317 | 317 | //The work to be done here is to bind the classes to be included in the console share privately. |
| 318 | - if($container){
|
|
| 319 | - $this->consoleShared($object,$callback); |
|
| 318 | + if ($container) {
|
|
| 319 | + $this->consoleShared($object, $callback); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | //If the third parameter passed to the bind method carries a container value, |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | //If the bind method does not have parameters object and callback, the value is directly assigned to the kernel object. |
| 327 | 327 | //Otherwise, when the bind object and callback are sent, the closure class inherits |
| 328 | 328 | //the applicationProvider object and the resolve method is called |
| 329 | - return ($object===null) ? $this->kernel() : $this->{$makeBuild}($object,$callback);
|
|
| 329 | + return ($object===null) ? $this->kernel() : $this->{$makeBuild}($object, $callback);
|
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | /** |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | */ |
| 344 | 344 | public function offsetGet($offset) {
|
| 345 | 345 | |
| 346 | - return $this->resolve($this->instances['containerInstanceResolve'],[ |
|
| 346 | + return $this->resolve($this->instances['containerInstanceResolve'], [ |
|
| 347 | 347 | 'instances' => $this->instances |
| 348 | 348 | ])->{$offset}();
|
| 349 | 349 | } |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | * @param null $concrete |
| 368 | 368 | * @return bool|mixed |
| 369 | 369 | */ |
| 370 | - public function register($key,$object,$concrete=null) |
|
| 370 | + public function register($key, $object, $concrete = null) |
|
| 371 | 371 | {
|
| 372 | 372 | // we assign the values required |
| 373 | 373 | // for register to the global value variable. |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | |
| 378 | 378 | // If there is an instance of the application class, |
| 379 | 379 | // the register method is saved both in this example and in the global. |
| 380 | - if(defined('appInstance')){
|
|
| 380 | + if (defined('appInstance')) {
|
|
| 381 | 381 | |
| 382 | 382 | // where we will assign both the global instance |
| 383 | 383 | // and the registered application object. |
@@ -396,19 +396,19 @@ discard block |
||
| 396 | 396 | * @param bool $withConcrete |
| 397 | 397 | * @return bool |
| 398 | 398 | */ |
| 399 | - private function registerProcess($instance,$withConcrete=false) |
|
| 399 | + private function registerProcess($instance, $withConcrete = false) |
|
| 400 | 400 | {
|
| 401 | 401 | // values recorded without concrete. |
| 402 | 402 | // or values deleted |
| 403 | - if(false===$withConcrete){
|
|
| 403 | + if (false===$withConcrete) {
|
|
| 404 | 404 | |
| 405 | 405 | //values registered without concrete |
| 406 | - $instance->{$this->values['key']}=$this->values['object'];
|
|
| 406 | + $instance->{$this->values['key']} = $this->values['object'];
|
|
| 407 | 407 | return false; |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | //values registered with concrete |
| 411 | - $instance->{$this->values['key']}[$this->values['object']]=$this->values['concrete'];
|
|
| 411 | + $instance->{$this->values['key']}[$this->values['object']] = $this->values['concrete'];
|
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | /** |
@@ -419,22 +419,22 @@ discard block |
||
| 419 | 419 | * @throws \DI\DependencyException |
| 420 | 420 | * @throws \DI\NotFoundException |
| 421 | 421 | */ |
| 422 | - public function resolve($class,$bind=array()) |
|
| 422 | + public function resolve($class, $bind = array()) |
|
| 423 | 423 | {
|
| 424 | 424 | //the context bind objects are checked again and the bind sequence submitted by |
| 425 | 425 | //the user is checked and forced to re-instantiate the object. |
| 426 | - $this->contextualBindCleaner($class,$bind); |
|
| 426 | + $this->contextualBindCleaner($class, $bind); |
|
| 427 | 427 | |
| 428 | 428 | //We do an instance check to get the static instance values of |
| 429 | 429 | //the classes to be resolved with the make bind method. |
| 430 | - if(!isset(self::$instance[$class])){
|
|
| 430 | + if (!isset(self::$instance[$class])) {
|
|
| 431 | 431 | |
| 432 | 432 | //bind params object |
| 433 | - self::$bindParams[$class]=$bind; |
|
| 433 | + self::$bindParams[$class] = $bind; |
|
| 434 | 434 | |
| 435 | 435 | //By singleton checking, we solve the dependency injection of the given class. |
| 436 | 436 | //Thus, each class can be called together with its dependency. |
| 437 | - self::$instance[$class] = DIContainerManager::make($class,$this->applicationProviderBinding($this,self::$bindParams[$class])); |
|
| 437 | + self::$instance[$class] = DIContainerManager::make($class, $this->applicationProviderBinding($this, self::$bindParams[$class])); |
|
| 438 | 438 | $this->singleton()->resolved[$class] = self::$instance[$class]; |
| 439 | 439 | |
| 440 | 440 | //return resolve class |
@@ -452,9 +452,9 @@ discard block |
||
| 452 | 452 | * @param $class |
| 453 | 453 | * @return mixed |
| 454 | 454 | */ |
| 455 | - public function resolved($class){
|
|
| 455 | + public function resolved($class) {
|
|
| 456 | 456 | |
| 457 | - if(isset($this['resolved'][$class])){
|
|
| 457 | + if (isset($this['resolved'][$class])) {
|
|
| 458 | 458 | return $this['resolved'][$class]; |
| 459 | 459 | } |
| 460 | 460 | |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | * @throws \DI\DependencyException |
| 470 | 470 | * @throws \DI\NotFoundException |
| 471 | 471 | */ |
| 472 | - public function share($object=null,$callback=null) |
|
| 472 | + public function share($object = null, $callback = null) |
|
| 473 | 473 | {
|
| 474 | 474 | //we check whether the boolean value of the singleton variable used |
| 475 | 475 | //for booting does not reset every time the object variable to be assigned to the kernel variable is true |
@@ -477,12 +477,12 @@ discard block |
||
| 477 | 477 | |
| 478 | 478 | //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound. |
| 479 | 479 | //The work to be done here is to bind the classes to be included in the console share privately. |
| 480 | - $this->consoleShared($object,$callback); |
|
| 480 | + $this->consoleShared($object, $callback); |
|
| 481 | 481 | |
| 482 | 482 | //If the bind method does not have parameters object and callback, the value is directly assigned to the kernel object. |
| 483 | 483 | //Otherwise, when the bind object and callback are sent, the closure class inherits |
| 484 | 484 | //the applicationProvider object and the resolve method is called |
| 485 | - return ($object===null) ? $this->kernel() : $this->build($object,$callback); |
|
| 485 | + return ($object===null) ? $this->kernel() : $this->build($object, $callback); |
|
| 486 | 486 | |
| 487 | 487 | } |
| 488 | 488 | |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | */ |
| 503 | 503 | public function singleton() |
| 504 | 504 | {
|
| 505 | - if($this->singleton===false){
|
|
| 505 | + if ($this->singleton===false) {
|
|
| 506 | 506 | |
| 507 | 507 | //after first initializing, the singleton variable is set to true, |
| 508 | 508 | //and subsequent incoming classes can inherit the loaded object. |
@@ -523,12 +523,12 @@ discard block |
||
| 523 | 523 | // for application instance |
| 524 | 524 | // if the values to be saved are to be saved without the concrete, |
| 525 | 525 | // if it is an array. |
| 526 | - if($this->values['concrete']===null) {
|
|
| 526 | + if ($this->values['concrete']===null) {
|
|
| 527 | 527 | |
| 528 | 528 | // Without concrete, |
| 529 | 529 | // the saved value will be saved |
| 530 | 530 | // if the it does not exist in application instance. |
| 531 | - if(!isset($instance->{$this->values['key']})) {
|
|
| 531 | + if (!isset($instance->{$this->values['key']})) {
|
|
| 532 | 532 | $this->registerProcess($instance); |
| 533 | 533 | } |
| 534 | 534 | return false; |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | |
| 537 | 537 | // We send concrete values to be recorded with concrete as true. |
| 538 | 538 | // these values will be recorded as a array. |
| 539 | - $this->registerProcess($instance,true); |
|
| 539 | + $this->registerProcess($instance, true); |
|
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | /** |
@@ -544,11 +544,11 @@ discard block |
||
| 544 | 544 | * @param null|string $object |
| 545 | 545 | * @return mixed |
| 546 | 546 | */ |
| 547 | - public function terminate($key,$object=null) |
|
| 547 | + public function terminate($key, $object = null) |
|
| 548 | 548 | {
|
| 549 | 549 | // object null is |
| 550 | 550 | // sent to just terminate a key. |
| 551 | - if($object===null){
|
|
| 551 | + if ($object===null) {
|
|
| 552 | 552 | unset(core()->{$key});
|
| 553 | 553 | return false; |
| 554 | 554 | } |
@@ -14,13 +14,13 @@ discard block |
||
| 14 | 14 | * @param null $name |
| 15 | 15 | * @param array $params |
| 16 | 16 | */ |
| 17 | - public function __construct($app,$name=null,$params=array()) |
|
| 17 | + public function __construct($app, $name = null, $params = array()) |
|
| 18 | 18 | {
|
| 19 | 19 | parent::__construct($app); |
| 20 | 20 | |
| 21 | 21 | // we help the user to pull a special message from |
| 22 | 22 | // the translate section to be specified by the user for the exception. |
| 23 | - $this->exceptionTranslate($name,$params); |
|
| 23 | + $this->exceptionTranslate($name, $params); |
|
| 24 | 24 | |
| 25 | 25 | // for real file path with |
| 26 | 26 | // debug backtrace method are doing follow. |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | * @param $name |
| 34 | 34 | * @param array $params |
| 35 | 35 | */ |
| 36 | - private function exceptionTranslate($name,$params=array()) |
|
| 36 | + private function exceptionTranslate($name, $params = array()) |
|
| 37 | 37 | {
|
| 38 | - if($name!==null){
|
|
| 39 | - if(count($params)){
|
|
| 40 | - $this->app->register('exceptionTranslateParams',$name,$params);
|
|
| 38 | + if ($name!==null) {
|
|
| 39 | + if (count($params)) {
|
|
| 40 | + $this->app->register('exceptionTranslateParams', $name, $params);
|
|
| 41 | 41 | } |
| 42 | - $this->app->register('exceptionTranslate',$name);
|
|
| 42 | + $this->app->register('exceptionTranslate', $name);
|
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
@@ -50,23 +50,23 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function debugBackTrace() |
| 52 | 52 | {
|
| 53 | - foreach (debug_backtrace() as $key=>$value){
|
|
| 53 | + foreach (debug_backtrace() as $key=>$value) {
|
|
| 54 | 54 | |
| 55 | - if(isset(debug_backtrace()[$key],debug_backtrace()[$key]['file'])) |
|
| 55 | + if (isset(debug_backtrace()[$key], debug_backtrace()[$key]['file'])) |
|
| 56 | 56 | {
|
| 57 | - $this->app->register('exceptionFile',debug_backtrace()[$key]['file']);
|
|
| 58 | - $this->app->register('exceptionLine',debug_backtrace()[$key]['line']);
|
|
| 57 | + $this->app->register('exceptionFile', debug_backtrace()[$key]['file']);
|
|
| 58 | + $this->app->register('exceptionLine', debug_backtrace()[$key]['line']);
|
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | Dependencies::loadBootstrapperNeedsForException(); |
| 62 | 62 | |
| 63 | - if(isset($value['file']) && isset(core()->urlComponent)){
|
|
| 64 | - if(preg_match('@'.core()->urlComponent['project'].'|boot|providers@',$value['file'])){
|
|
| 63 | + if (isset($value['file']) && isset(core()->urlComponent)) {
|
|
| 64 | + if (preg_match('@'.core()->urlComponent['project'].'|boot|providers@', $value['file'])) {
|
|
| 65 | 65 | |
| 66 | 66 | $this->app->terminate('exceptionFile');
|
| 67 | 67 | $this->app->terminate('exceptionLine');
|
| 68 | - $this->app->register('exceptionFile',$value['file']);
|
|
| 69 | - $this->app->register('exceptionLine',$value['line']);
|
|
| 68 | + $this->app->register('exceptionFile', $value['file']);
|
|
| 69 | + $this->app->register('exceptionLine', $value['line']);
|
|
| 70 | 70 | |
| 71 | 71 | break; |
| 72 | 72 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @param $name |
| 89 | 89 | * @param null|string $msg |
| 90 | 90 | */ |
| 91 | - public function customException($name,$msg=null) |
|
| 91 | + public function customException($name, $msg = null) |
|
| 92 | 92 | {
|
| 93 | 93 | //We use the magic method for the exception and |
| 94 | 94 | //call the exception class in the application to get the instance. |
@@ -97,20 +97,20 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | // first, you are looking for an exception |
| 99 | 99 | // in the application directory class. |
| 100 | - if(Utils::isNamespaceExists($nameNamespace)){
|
|
| 100 | + if (Utils::isNamespaceExists($nameNamespace)) {
|
|
| 101 | 101 | $callNamespace = new $nameNamespace; |
| 102 | 102 | } |
| 103 | - else{
|
|
| 103 | + else {
|
|
| 104 | 104 | |
| 105 | 105 | // if you do not have an exception in the application directory, |
| 106 | 106 | // this time we are looking for an exception in the core directory. |
| 107 | 107 | $nameNamespace = __NAMESPACE__.'\\'.$nameException; |
| 108 | - if(Utils::isNamespaceExists($nameNamespace)){
|
|
| 108 | + if (Utils::isNamespaceExists($nameNamespace)) {
|
|
| 109 | 109 | $callNamespace = new $nameNamespace; |
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if(isset($callNamespace)){
|
|
| 113 | + if (isset($callNamespace)) {
|
|
| 114 | 114 | |
| 115 | 115 | // we will set the information about the exception trace, |
| 116 | 116 | // and then bind it specifically to the event method. |
@@ -122,19 +122,19 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | |
| 124 | 124 | // we register the custom exception trace value with the global kernel object. |
| 125 | - $this->app->register('exceptiontrace',$customExceptionTrace);
|
|
| 125 | + $this->app->register('exceptiontrace', $customExceptionTrace);
|
|
| 126 | 126 | |
| 127 | 127 | //If the developer wants to execute an event when calling a special exception, |
| 128 | 128 | //we process the event method. |
| 129 | - if(method_exists($callNamespace,'event')){
|
|
| 129 | + if (method_exists($callNamespace, 'event')) {
|
|
| 130 | 130 | $callNamespace->event($customExceptionTrace); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | //throw exception |
| 134 | - if($msg===null){
|
|
| 134 | + if ($msg===null) {
|
|
| 135 | 135 | throw new $callNamespace; |
| 136 | 136 | } |
| 137 | - else{
|
|
| 137 | + else {
|
|
| 138 | 138 | throw new $callNamespace($msg); |
| 139 | 139 | } |
| 140 | 140 | |
@@ -149,6 +149,6 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function __call($name, $arguments) |
| 151 | 151 | {
|
| 152 | - $this->customException($name,current($arguments)); |
|
| 152 | + $this->customException($name, current($arguments)); |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | \ No newline at end of file |
@@ -99,8 +99,7 @@ discard block |
||
| 99 | 99 | // in the application directory class. |
| 100 | 100 | if(Utils::isNamespaceExists($nameNamespace)){
|
| 101 | 101 | $callNamespace = new $nameNamespace; |
| 102 | - } |
|
| 103 | - else{
|
|
| 102 | + } else{
|
|
| 104 | 103 | |
| 105 | 104 | // if you do not have an exception in the application directory, |
| 106 | 105 | // this time we are looking for an exception in the core directory. |
@@ -133,8 +132,7 @@ discard block |
||
| 133 | 132 | //throw exception |
| 134 | 133 | if($msg===null){
|
| 135 | 134 | throw new $callNamespace; |
| 136 | - } |
|
| 137 | - else{
|
|
| 135 | + } else{
|
|
| 138 | 136 | throw new $callNamespace($msg); |
| 139 | 137 | } |
| 140 | 138 | |