Conditions | 13 |
Paths | 35 |
Total Lines | 51 |
Code Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
116 | public function __invoke($target=null) |
||
117 | { |
||
118 | if (is_object($this->expectedTarget)) { |
||
119 | if ($target) { |
||
120 | throw new TargetAlreadyDefinedException($this, $this->expectedTarget, $target); |
||
121 | } |
||
122 | |||
123 | $out = $this->expectedTarget; |
||
124 | } |
||
125 | elseif (is_string($this->expectedTarget)) { |
||
126 | if (class_exists($this->expectedTarget)) { |
||
127 | if (! $target instanceof $this->expectedTarget) { |
||
128 | throw new BadTargetClassException($this, $this->expectedTarget, $target); |
||
129 | } |
||
130 | } |
||
131 | elseif (interface_exists($this->expectedTarget)) { |
||
132 | if (! $target instanceof $this->expectedTarget) { |
||
133 | throw new BadTargetInterfaceException($this, $this->expectedTarget, $target); |
||
134 | } |
||
135 | } |
||
136 | elseif (type_exists($this->expectedTarget)) { |
||
137 | if (gettype($target) != $this->expectedTarget) { |
||
138 | throw new BadTargetTypeException($this, $this->expectedTarget, $target); |
||
139 | } |
||
140 | } |
||
141 | else { |
||
142 | throw new UndefinedTargetClassException($this, $this->expectedTarget); |
||
143 | } |
||
144 | |||
145 | $out = $target; |
||
146 | } |
||
147 | else { |
||
148 | $out = $target; |
||
149 | } |
||
150 | |||
151 | foreach ($this->stack as $i => $call) { |
||
152 | try { |
||
153 | if (isset($call['method'])) { |
||
154 | $out = call_user_func_array([$out, $call['method']], $call['arguments']); |
||
155 | } |
||
156 | else { |
||
157 | $out = $out[ $call['entry'] ]; |
||
158 | } |
||
159 | } |
||
160 | catch (\Exception $e) { |
||
161 | // Throw $e with the good stack (usage exception) |
||
162 | throw $e; |
||
163 | } |
||
164 | } |
||
165 | |||
166 | return $out; |
||
167 | } |
||
211 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths