Passed
Branch master (2de6ce)
by Jean
02:35
created
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   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -92,8 +92,7 @@  discard block
 block discarded – undo
92 92
         $string = '(new ' . get_called_class();
93 93
         if (is_string($this->expectedTarget)) {
94 94
             $string .= '(' . var_export($this->expectedTarget, true) . ')';
95
-        }
96
-        elseif (is_object($this->expectedTarget)) {
95
+        } elseif (is_object($this->expectedTarget)) {
97 96
             $string .= '( ' . get_class($this->expectedTarget) . '#' . spl_object_id($this->expectedTarget) . ' )';
98 97
         }
99 98
         $string .= ')';
@@ -106,8 +105,7 @@  discard block
 block discarded – undo
106 105
                     return var_export($argument, true);
107 106
                 }, $call['arguments']));
108 107
                 $string .= ')';
109
-            }
110
-            else {
108
+            } else {
111 109
                 $string .= '[' . var_export($call['entry'], true) . ']';
112 110
             }
113 111
         }
@@ -129,30 +127,25 @@  discard block
 block discarded – undo
129 127
             }
130 128
             
131 129
             $out = $this->expectedTarget;
132
-        }
133
-        elseif (is_string($this->expectedTarget)) {
130
+        } elseif (is_string($this->expectedTarget)) {
134 131
             if (class_exists($this->expectedTarget)) {
135 132
                 if (! $target instanceof $this->expectedTarget) {
136 133
                     throw new BadTargetClassException($this, $this->expectedTarget, $target);
137 134
                 }
138
-            }
139
-            elseif (interface_exists($this->expectedTarget)) {
135
+            } elseif (interface_exists($this->expectedTarget)) {
140 136
                 if (! $target instanceof $this->expectedTarget) {
141 137
                     throw new BadTargetInterfaceException($this, $this->expectedTarget, $target);
142 138
                 }
143
-            }
144
-            elseif (type_exists($this->expectedTarget)) {
139
+            } elseif (type_exists($this->expectedTarget)) {
145 140
                 if (gettype($target) != $this->expectedTarget) {
146 141
                     throw new BadTargetTypeException($this, $this->expectedTarget, $target);
147 142
                 }
148
-            }
149
-            else {
143
+            } else {
150 144
                 throw new UndefinedTargetClassException($this, $this->expectedTarget);
151 145
             }
152 146
             
153 147
             $out = $target;
154
-        }
155
-        else {
148
+        } else {
156 149
             $out = $target;
157 150
         }
158 151
         
@@ -160,12 +153,10 @@  discard block
 block discarded – undo
160 153
             try {
161 154
                 if (isset($call['method'])) {
162 155
                     $out = call_user_func_array([$out, $call['method']], $call['arguments']);
163
-                }
164
-                else {
156
+                } else {
165 157
                     $out = $out[ $call['entry'] ];
166 158
                 }
167
-            }
168
-            catch (\Exception $e) {
159
+            } catch (\Exception $e) {
169 160
                 // Throw $e with the good stack (usage exception)
170 161
                 throw $e;
171 162
             }
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.
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.