Completed
Push — master ( 67e168...53226a )
by Jean
02:28
created
src/Exceptions/TargetAlreadyDefinedException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 {
15 15
     public function __construct($callchain, $expected_target, $target)
16 16
     {
17
-        $this->message = "You are trying to define the target ".spl_object_id($target)." for the $callchain which already has one: ".spl_object_id($expected_target)
17
+        $this->message = "You are trying to define the target " . spl_object_id($target) . " for the $callchain which already has one: " . spl_object_id($expected_target)
18 18
     }
19 19
     
20 20
     /**/
Please login to merge, or discard this patch.
src/Exceptions/BadTargetTypeException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 {
15 15
     public function __construct($callchain, $expected_target, $target)
16 16
     {
17
-        $this->message = "You are trying to define a target of type ".gettype($target)." for the $callchain allowing only: ".$expected_target;
17
+        $this->message = "You are trying to define a target of type " . gettype($target) . " for the $callchain allowing only: " . $expected_target;
18 18
     }
19 19
     
20 20
     /**/
Please login to merge, or discard this patch.
src/Exceptions/BadTargetClassException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 {
15 15
     public function __construct($callchain, $expected_target, $target)
16 16
     {
17
-        $this->message = "You are trying to define a target of class ".get_class($target)." for the $callchain allowing only targets of class ".$expected_target;
17
+        $this->message = "You are trying to define a target of class " . get_class($target) . " for the $callchain allowing only targets of class " . $expected_target;
18 18
     }
19 19
     
20 20
     /**/
Please login to merge, or discard this patch.
src/Exceptions/UndefinedTargetClassException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 {
15 15
     public function __construct($callchain, $expected_target)
16 16
     {
17
-        $this->message = "The expected target of $callchain is neither a defined class nor a native type: ". $expected_target;
17
+        $this->message = "The expected target of $callchain is neither a defined class nor a native type: " . $expected_target;
18 18
     }
19 19
     
20 20
     /**/
Please login to merge, or discard this patch.
src/Exceptions/BadTargetInterfaceException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 {
15 15
     public function __construct($callchain, $expected_target, $target)
16 16
     {
17
-        $this->message = "You are trying to define a target of class ".get_class($target)." for the $callchain allowing only targets implementing ".$expected_target;
17
+        $this->message = "You are trying to define a target of class " . get_class($target) . " for the $callchain allowing only targets implementing " . $expected_target;
18 18
     }
19 19
     
20 20
     /**/
Please login to merge, or discard this patch.
src/DeferredCallChain.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      * 
32 32
      * @param string $key The entry to acces
33 33
      */
34
-    public function __construct($class_type_or_instance=null)
34
+    public function __construct($class_type_or_instance = null)
35 35
     {
36 36
         if ($class_type_or_instance) {
37 37
             $this->expectedTarget = $class_type_or_instance;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         foreach ($this->stack as $i => $call) {
94 94
             if (isset($call['method'])) {
95 95
                 $string .= '->';
96
-                $string .= $call['method'].'(';
96
+                $string .= $call['method'] . '(';
97 97
                 $string .= implode(', ', array_map(function($argument) {
98 98
                     return var_export($argument, true);
99 99
                 }, $call['arguments']));
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      * @param  $target The target to apply the callchain on
114 114
      * @return The value returned once the call chain is called uppon $target
115 115
      */
116
-    public function __invoke($target=null)
116
+    public function __invoke($target = null)
117 117
     {
118 118
         if (is_object($this->expectedTarget)) {
119 119
             if ($target) {
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
         }
125 125
         elseif (is_string($this->expectedTarget)) {
126 126
             if (class_exists($this->expectedTarget)) {
127
-                if (! $target instanceof $this->expectedTarget) {
127
+                if (!$target instanceof $this->expectedTarget) {
128 128
                     throw new BadTargetClassException($this, $this->expectedTarget, $target);
129 129
                 }
130 130
             }
131 131
             elseif (interface_exists($this->expectedTarget)) {
132
-                if (! $target instanceof $this->expectedTarget) {
132
+                if (!$target instanceof $this->expectedTarget) {
133 133
                     throw new BadTargetInterfaceException($this, $this->expectedTarget, $target);
134 134
                 }
135 135
             }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                     $out = call_user_func_array([$out, $call['method']], $call['arguments']);
155 155
                 }
156 156
                 else {
157
-                    $out = $out[ $call['entry'] ];
157
+                    $out = $out[$call['entry']];
158 158
                 }
159 159
             }
160 160
             catch (\Exception $e) {
Please login to merge, or discard this patch.
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -98,8 +98,7 @@  discard block
 block discarded – undo
98 98
                     return var_export($argument, true);
99 99
                 }, $call['arguments']));
100 100
                 $string .= ')';
101
-            }
102
-            else {
101
+            } else {
103 102
                 $string .= '[' . var_export($call['entry'], true) . ']';
104 103
             }
105 104
         }
@@ -121,30 +120,25 @@  discard block
 block discarded – undo
121 120
             }
122 121
             
123 122
             $out = $this->expectedTarget;
124
-        }
125
-        elseif (is_string($this->expectedTarget)) {
123
+        } elseif (is_string($this->expectedTarget)) {
126 124
             if (class_exists($this->expectedTarget)) {
127 125
                 if (! $target instanceof $this->expectedTarget) {
128 126
                     throw new BadTargetClassException($this, $this->expectedTarget, $target);
129 127
                 }
130
-            }
131
-            elseif (interface_exists($this->expectedTarget)) {
128
+            } elseif (interface_exists($this->expectedTarget)) {
132 129
                 if (! $target instanceof $this->expectedTarget) {
133 130
                     throw new BadTargetInterfaceException($this, $this->expectedTarget, $target);
134 131
                 }
135
-            }
136
-            elseif (type_exists($this->expectedTarget)) {
132
+            } elseif (type_exists($this->expectedTarget)) {
137 133
                 if (gettype($target) != $this->expectedTarget) {
138 134
                     throw new BadTargetTypeException($this, $this->expectedTarget, $target);
139 135
                 }
140
-            }
141
-            else {
136
+            } else {
142 137
                 throw new UndefinedTargetClassException($this, $this->expectedTarget);
143 138
             }
144 139
             
145 140
             $out = $target;
146
-        }
147
-        else {
141
+        } else {
148 142
             $out = $target;
149 143
         }
150 144
         
@@ -152,12 +146,10 @@  discard block
 block discarded – undo
152 146
             try {
153 147
                 if (isset($call['method'])) {
154 148
                     $out = call_user_func_array([$out, $call['method']], $call['arguments']);
155
-                }
156
-                else {
149
+                } else {
157 150
                     $out = $out[ $call['entry'] ];
158 151
                 }
159
-            }
160
-            catch (\Exception $e) {
152
+            } catch (\Exception $e) {
161 153
                 // Throw $e with the good stack (usage exception)
162 154
                 throw $e;
163 155
             }
Please login to merge, or discard this patch.
src/functions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! function_exists('spl_object_id')) {
3
+if (!function_exists('spl_object_id')) {
4 4
     /**
5 5
      * @see https://secure.php.net/manual/en/function.spl-object-id.php
6 6
      * This method doesn't exist before PHP 7.2.0
Please login to merge, or discard this patch.