Test Setup Failed
Push β€” master ( 713012...25bb0d )
by Php Easy Api
20:24 queued 16:08
created
src/resta/Contracts/ContainerContracts.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      * @param null|string $alias
12 12
      * @return mixed
13 13
      */
14
-    public function bind($object=null,$callback=null,$alias=null);
14
+    public function bind($object = null, $callback = null, $alias = null);
15 15
 
16 16
     /**
17 17
      * @param $abstract
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      * @param $container false
39 39
      * @return mixed
40 40
      */
41
-    public function make($object=null,$callback=null,$container=false);
41
+    public function make($object = null, $callback = null, $container = false);
42 42
 
43 43
     /**
44 44
      * @param $key
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
      * @param null $concrete
47 47
      * @return mixed
48 48
      */
49
-    public function register($key,$object,$concrete=null);
49
+    public function register($key, $object, $concrete = null);
50 50
 
51 51
     /**
52 52
      * @param null $object
53 53
      * @param null $callback
54 54
      * @return mixed
55 55
      */
56
-    public function share($object=null,$callback=null);
56
+    public function share($object = null, $callback = null);
57 57
 
58 58
     /**
59 59
      * @method singleton
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      * @param array $bind
67 67
      * @return mixed
68 68
      */
69
-    public function resolve($class,$bind=array());
69
+    public function resolve($class, $bind = array());
70 70
 
71 71
     /**
72 72
      * @param $class
Please login to merge, or discard this patch.
src/resta/Container/Container.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,12 +66,12 @@  discard block
 block discarded – undo
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 71
         //If the bind method does not have parameters object and callback, the value is directly assigned to the kernel object.
72 72
         //Otherwise, when the bind object and callback are sent, the closure class inherits
73 73
         //the applicationProvider object and the resolve method is called
74
-        return $this->make($object,$callback,'container');
74
+        return $this->make($object, $callback, 'container');
75 75
     }
76 76
 
77 77
     /**
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
      * @throws DependencyException
84 84
      * @throws NotFoundException
85 85
      */
86
-    private function build($object,$callback,$sync=false)
86
+    private function build($object, $callback, $sync = false)
87 87
     {
88 88
         //If the console object returns true,
89 89
         //we do not cancel binding operations
90 90
         //We are getting what applies to console with consoleKernelObject.
91
-        if($sync===false) return $this->consoleKernelObjectChecker($object,$callback);
91
+        if ($sync===false) return $this->consoleKernelObjectChecker($object, $callback);
92 92
 
93 93
         //the value corresponding to the bind value for the global object is assigned and
94 94
         //the resolve method is called for the dependency injection.
95
-        $this->kernelAssigner()->setKernelObject($object,$callback);
95
+        $this->kernelAssigner()->setKernelObject($object, $callback);
96 96
 
97 97
         //return kernel object
98 98
         return $this->kernel();
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
      * @throws DependencyException
108 108
      * @throws NotFoundException
109 109
      */
110
-    private function consoleKernelObject($object,$callback,$container=false)
110
+    private function consoleKernelObject($object, $callback, $container = false)
111 111
     {
112 112
         //we use the console bindings class to specify the classes to be preloaded in the console application.
113 113
         //Thus, classes that can not be bound with http are called without closure in global loaders directory.
114
-        $this->resolve(ConsoleBindings::class)->console($object,$callback,$container);
114
+        $this->resolve(ConsoleBindings::class)->console($object, $callback, $container);
115 115
 
116 116
         //The console application must always return the kernel method.
117 117
         return $this->kernel();
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      * @throws DependencyException
127 127
      * @throws NotFoundException
128 128
      */
129
-    private function consoleKernelObjectChecker($object,$callback,$container=false)
129
+    private function consoleKernelObjectChecker($object, $callback, $container = false)
130 130
     {
131 131
         //we check whether the callback value is a callable function.
132 132
         $isCallableForCallback = is_callable($callback);
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
         //If the console object returns true,
135 135
         //we do not cancel binding operations
136 136
         //We are getting what applies to console with consoleKernelObject.
137
-        if($this->console() AND $isCallableForCallback) return $this->consoleKernelObject($object,$callback,$container);
137
+        if ($this->console() AND $isCallableForCallback) return $this->consoleKernelObject($object, $callback, $container);
138 138
 
139 139
         //If the application is not a console operation, we re-bind to existing methods synchronously.
140
-        return ($container) ? $this->containerBuild($object,$callback,true) : $this->build($object,$callback,true);
140
+        return ($container) ? $this->containerBuild($object, $callback, true) : $this->build($object, $callback, true);
141 141
     }
142 142
 
143 143
     /**
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
      * @throws DependencyException
148 148
      * @throws NotFoundException
149 149
      */
150
-    private function consoleShared($object,$callback)
150
+    private function consoleShared($object, $callback)
151 151
     {
152 152
         //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound.
153 153
         //The work to be done here is to bind the classes to be included in the console share privately.
154
-        $this->kernelAssigner()->consoleShared($object,$callback);
154
+        $this->kernelAssigner()->consoleShared($object, $callback);
155 155
     }
156 156
 
157 157
     /**
@@ -163,12 +163,12 @@  discard block
 block discarded – undo
163 163
      * @throws DependencyException
164 164
      * @throws NotFoundException
165 165
      */
166
-    public function containerBuild($object,$callback,$sync=false)
166
+    public function containerBuild($object, $callback, $sync = false)
167 167
     {
168 168
         //If the console object returns true,
169 169
         //we do not cancel binding operations
170 170
         //We are getting what applies to console with consoleKernelObject.
171
-        if($sync===false) return $this->consoleKernelObjectChecker($object,$callback,true);
171
+        if ($sync===false) return $this->consoleKernelObjectChecker($object, $callback, true);
172 172
 
173 173
         //Since the objects that come to the build method are objects from the container method,
174 174
         //we need to automatically create a kernel object named serviceContainer in this method.
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
         //the value corresponding to the bind value for the global object is assigned and
178 178
         //the resolve method is called for the dependency method.
179
-        $this->kernelAssigner()->setKernelObject($object,$callback,'serviceContainer');
179
+        $this->kernelAssigner()->setKernelObject($object, $callback, 'serviceContainer');
180 180
 
181 181
         //return kernel object
182 182
         return $this->kernel();
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
      * @param $class
187 187
      * @param $bind
188 188
      */
189
-    private function contextualBindCleaner($class,$bind)
189
+    private function contextualBindCleaner($class, $bind)
190 190
     {
191 191
         //the context bind objects are checked again and the bind sequence submitted by
192 192
         //the user is checked and forced to re-instantiate the object.
193
-        if(isset(self::$instance[$class]) && self::$bindParams[$class]!==$bind){
193
+        if (isset(self::$instance[$class]) && self::$bindParams[$class]!==$bind) {
194 194
             unset(self::$instance[$class]);
195 195
             unset(self::$bindParams[$class]);
196 196
         }
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
 
210 210
         // the has method can have a dotted string value so
211 211
         // we need to be able to control the string or array within the container.
212
-        foreach (explode(".",$abstract) as $item){
213
-            if(isset($container[$item])){
212
+        foreach (explode(".", $abstract) as $item) {
213
+            if (isset($container[$item])) {
214 214
                 $container = $container[$item];
215 215
             }
216
-            else{
216
+            else {
217 217
                 return null;
218 218
             }
219 219
         }
@@ -236,11 +236,11 @@  discard block
 block discarded – undo
236 236
 
237 237
         // the has method can have a dotted string value so
238 238
         // we need to be able to control the string or array within the container.
239
-        foreach (explode(".",$abstract) as $item){
239
+        foreach (explode(".", $abstract) as $item) {
240 240
 
241 241
             // this blog will work
242 242
             // if the data in the container loop points to an array.
243
-            if(!is_array($container)){
243
+            if (!is_array($container)) {
244 244
 
245 245
                 // we are querying the value of
246 246
                 // the items corresponding to the dotted value in the container.
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
                 $container = $container[$item];
249 249
                 $bools[] = is_null($container) ? false : true;
250 250
             }
251
-            else{
251
+            else {
252 252
 
253 253
                 // if the container array corresponds to a string,
254 254
                 // the bools array is filled with the isset control directly.
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
         // the method returns false if the bools sequence is false,
260 260
         // otherwise it will return true.
261
-        return in_array(false,$bools) ? false : true;
261
+        return in_array(false, $bools) ? false : true;
262 262
     }
263 263
 
264 264
     /**
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      * @throws DependencyException
309 309
      * @throws NotFoundException
310 310
      */
311
-    public function make($object=null,$callback=null,$container=false)
311
+    public function make($object = null, $callback = null, $container = false)
312 312
     {
313 313
         //we check whether the boolean value of the singleton variable used
314 314
         //for booting does not reset every time the object variable to be assigned to the kernel variable is true
@@ -316,8 +316,8 @@  discard block
 block discarded – undo
316 316
 
317 317
         //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound.
318 318
         //The work to be done here is to bind the classes to be included in the console share privately.
319
-        if($container){
320
-            $this->consoleShared($object,$callback);
319
+        if ($container) {
320
+            $this->consoleShared($object, $callback);
321 321
         }
322 322
 
323 323
         //If the third parameter passed to the bind method carries a container value,
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
         //If the bind method does not have parameters object and callback, the value is directly assigned to the kernel object.
328 328
         //Otherwise, when the bind object and callback are sent, the closure class inherits
329 329
         //the applicationProvider object and the resolve method is called
330
-        return ($object===null) ? $this->kernel() : $this->{$makeBuild}($object,$callback);
330
+        return ($object===null) ? $this->kernel() : $this->{$makeBuild}($object, $callback);
331 331
     }
332 332
 
333 333
     /**
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
      */
348 348
     public function offsetGet($offset) {
349 349
 
350
-        return $this->resolve($this->instances['containerInstanceResolve'],[
350
+        return $this->resolve($this->instances['containerInstanceResolve'], [
351 351
             'instances' => $this->instances
352 352
         ])->{$offset}();
353 353
     }
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
      * @param null $concrete
372 372
      * @return bool|mixed
373 373
      */
374
-    public function register($key,$object,$concrete=null)
374
+    public function register($key, $object, $concrete = null)
375 375
     {
376 376
         // we assign the values ​​required
377 377
         // for register to the global value variable.
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 
382 382
         // If there is an instance of the application class,
383 383
         // the register method is saved both in this example and in the global.
384
-        if(defined('appInstance')){
384
+        if (defined('appInstance')) {
385 385
 
386 386
             // where we will assign both the global instance
387 387
             // and the registered application object.
@@ -400,19 +400,19 @@  discard block
 block discarded – undo
400 400
      * @param bool $withConcrete
401 401
      * @return bool
402 402
      */
403
-    private function registerProcess($instance,$withConcrete=false)
403
+    private function registerProcess($instance, $withConcrete = false)
404 404
     {
405 405
         // values recorded without concrete.
406 406
         // or values deleted
407
-        if(false===$withConcrete){
407
+        if (false===$withConcrete) {
408 408
 
409 409
             //values registered without concrete
410
-            $instance->{$this->values['key']}=$this->values['object'];
410
+            $instance->{$this->values['key']} = $this->values['object'];
411 411
             return false;
412 412
         }
413 413
 
414 414
         //values registered with concrete
415
-        $instance->{$this->values['key']}[$this->values['object']]=$this->values['concrete'];
415
+        $instance->{$this->values['key']}[$this->values['object']] = $this->values['concrete'];
416 416
     }
417 417
 
418 418
     /**
@@ -423,22 +423,22 @@  discard block
 block discarded – undo
423 423
      * @throws DependencyException
424 424
      * @throws NotFoundException
425 425
      */
426
-    public function resolve($class,$bind=array())
426
+    public function resolve($class, $bind = array())
427 427
     {
428 428
         //the context bind objects are checked again and the bind sequence submitted by
429 429
         //the user is checked and forced to re-instantiate the object.
430
-        $this->contextualBindCleaner($class,$bind);
430
+        $this->contextualBindCleaner($class, $bind);
431 431
 
432 432
         //We do an instance check to get the static instance values of
433 433
         //the classes to be resolved with the make bind method.
434
-        if(!isset(self::$instance[$class])){
434
+        if (!isset(self::$instance[$class])) {
435 435
 
436 436
             //bind params object
437 437
             self::$bindParams[$class] = $bind;
438 438
 
439 439
             //By singleton checking, we solve the dependency injection of the given class.
440 440
             //Thus, each class can be called together with its dependency.
441
-            self::$instance[$class] = DIContainerManager::make($class,$this->applicationProviderBinding($this,self::$bindParams[$class]));
441
+            self::$instance[$class] = DIContainerManager::make($class, $this->applicationProviderBinding($this, self::$bindParams[$class]));
442 442
             $this->singleton()->resolved[$class] = self::$instance[$class];
443 443
 
444 444
             //return resolve class
@@ -456,9 +456,9 @@  discard block
 block discarded – undo
456 456
      * @param $class
457 457
      * @return mixed
458 458
      */
459
-    public function resolved($class){
459
+    public function resolved($class) {
460 460
 
461
-        if(isset($this['resolved'][$class])){
461
+        if (isset($this['resolved'][$class])) {
462 462
             return $this['resolved'][$class];
463 463
         }
464 464
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
      * @throws DependencyException
474 474
      * @throws NotFoundException
475 475
      */
476
-    public function share($object=null,$callback=null)
476
+    public function share($object = null, $callback = null)
477 477
     {
478 478
         //we check whether the boolean value of the singleton variable used
479 479
         //for booting does not reset every time the object variable to be assigned to the kernel variable is true
@@ -481,12 +481,12 @@  discard block
 block discarded – undo
481 481
 
482 482
         //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound.
483 483
         //The work to be done here is to bind the classes to be included in the console share privately.
484
-        $this->consoleShared($object,$callback);
484
+        $this->consoleShared($object, $callback);
485 485
 
486 486
         //If the bind method does not have parameters object and callback, the value is directly assigned to the kernel object.
487 487
         //Otherwise, when the bind object and callback are sent, the closure class inherits
488 488
         //the applicationProvider object and the resolve method is called
489
-        return ($object===null) ? $this->kernel() : $this->build($object,$callback);
489
+        return ($object===null) ? $this->kernel() : $this->build($object, $callback);
490 490
 
491 491
     }
492 492
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
      */
507 507
     public function singleton()
508 508
     {
509
-        if($this->singleton===false){
509
+        if ($this->singleton===false) {
510 510
 
511 511
             //after first initializing, the singleton variable is set to true,
512 512
             //and subsequent incoming classes can inherit the loaded object.
@@ -527,12 +527,12 @@  discard block
 block discarded – undo
527 527
         // for application instance
528 528
         // if the values ​​to be saved are to be saved without the concrete,
529 529
         // if it is an array.
530
-        if($this->values['concrete']===null) {
530
+        if ($this->values['concrete']===null) {
531 531
 
532 532
             // Without concrete,
533 533
             // the saved value will be saved
534 534
             // if the it does not exist in application instance.
535
-            if(!isset($instance->{$this->values['key']})) {
535
+            if (!isset($instance->{$this->values['key']})) {
536 536
                 $this->registerProcess($instance);
537 537
             }
538 538
             return false;
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 
541 541
         // We send concrete values to be recorded with concrete as true.
542 542
         // these values will be recorded as a array.
543
-        $this->registerProcess($instance,true);
543
+        $this->registerProcess($instance, true);
544 544
     }
545 545
 
546 546
     /**
@@ -548,11 +548,11 @@  discard block
 block discarded – undo
548 548
      * @param null|string $object
549 549
      * @return mixed
550 550
      */
551
-    public function terminate($key,$object=null)
551
+    public function terminate($key, $object = null)
552 552
     {
553 553
         // object null is
554 554
         // sent to just terminate a key.
555
-        if($object===null){
555
+        if ($object===null) {
556 556
             unset(core()->{$key});
557 557
             unset($this->singleton()->{$key});
558 558
             return false;
Please login to merge, or discard this patch.