| Conditions | 10 |
| Total Lines | 34 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 67 | public function raise() |
||
| 68 | { |
||
| 69 | $originException = $this->exceptionObject; |
||
| 70 | $delegateException = null; |
||
| 71 | if ($originException instanceof DelegateException) { |
||
| 72 | // 複数レイヤ間で例外がやりとりされる場合、すでにDelegateExceptionでラップ済みなので戻す |
||
| 73 | $originException = $originException->getOriginException(); |
||
| 74 | } |
||
| 75 | $invokeMethods = []; |
||
| 76 | foreach ($this->exceptionHandler as $exceptionHandlerAnnotation) { |
||
| 77 | $exceptions = $exceptionHandlerAnnotation->exceptions; |
||
| 78 | $refMethod = $exceptionHandlerAnnotation->method; |
||
| 79 | foreach ($exceptions as $exception) { |
||
| 80 | if (is_a($originException, is_object($exception) ? get_class($exception) : $exception)) { |
||
| 81 | // 一つのメソッドに複数の捕捉例外が指定された場合(派生例外クラス含む)、先勝で1回のみ実行する |
||
| 82 | // そうでなければ複数回メソッドが実行されるため |
||
| 83 | // ただし同一クラス内に限る(親クラスの同一名のメソッドは実行する) |
||
| 84 | $classpath = $refMethod->class . "#" . $refMethod->name; |
||
| 85 | if (!array_key_exists($classpath, $invokeMethods)) { |
||
| 86 | $invokeMethods[$classpath] = $refMethod; |
||
| 87 | } |
||
| 88 | } |
||
| 89 | } |
||
| 90 | } |
||
| 91 | if (count($invokeMethods) > 0) { |
||
| 92 | $delegateException = new DelegateException($this->exceptionObject); |
||
| 93 | $delegateException->enableHandled(); |
||
| 94 | } |
||
| 95 | foreach ($invokeMethods as $classpath => $invokeMethod) { |
||
| 96 | $params = ["class" => get_class($this->instance), "method" => $this->method, "exception" => $originException]; |
||
| 97 | $invokeMethod->invokeArgs($this->instance, [$params]); |
||
| 98 | $this->logger->debug("Execution of handling is success: " . $classpath); |
||
| 99 | } |
||
| 100 | throw $delegateException ?: $originException; |
||
| 101 | } |
||
| 103 |
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