| Conditions | 11 |
| Paths | 9 |
| Total Lines | 40 |
| Code Lines | 26 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 21 | public static function getTargetProcessApplication($execution = null): ?ProcessApplicationReferenceInterface |
||
| 22 | { |
||
| 23 | if ($execution == null) { |
||
| 24 | return null; |
||
| 25 | } |
||
| 26 | |||
| 27 | if ($execution instanceof ExecutionEntity) { |
||
| 28 | $processApplicationForDeployment = self::getTargetProcessApplication($execution->getProcessDefinition()); |
||
| 29 | return $processApplicationForDeployment; |
||
| 30 | } elseif ($execution instanceof TaskEntity) { |
||
| 31 | if ($execution->getProcessDefinition() != null) { |
||
| 32 | return self::getTargetProcessApplication($execution->getProcessDefinition()); |
||
| 33 | } |
||
| 34 | return null; |
||
| 35 | } elseif ($execution instanceof ResourceDefinitionEntity) { |
||
| 36 | $reference = self::getTargetProcessApplication($execution->getDeploymentId()); |
||
| 37 | |||
| 38 | if ($reference == null && self::areProcessApplicationsRegistered()) { |
||
| 39 | $previous = $execution->getPreviousDefinition(); |
||
| 40 | |||
| 41 | // do it in a iterative way instead of recursive to avoid |
||
| 42 | // a possible StackOverflowException in cases with a lot |
||
| 43 | // of versions of a definition |
||
| 44 | while ($previous != null) { |
||
| 45 | $reference = self::getTargetProcessApplication($previous->getDeploymentId()); |
||
| 46 | if ($reference == null) { |
||
| 47 | $previous = $previous->getPreviousDefinition(); |
||
| 48 | } else { |
||
| 49 | return $reference; |
||
| 50 | } |
||
| 51 | } |
||
| 52 | } |
||
| 53 | return $reference; |
||
| 54 | } elseif (is_string($execution)) { |
||
| 55 | $processEngineConfiguration = Context::getProcessEngineConfiguration(); |
||
| 56 | $processApplicationManager = $processEngineConfiguration->getProcessApplicationManager(); |
||
| 57 | $processApplicationForDeployment = $processApplicationManager->getProcessApplicationForDeployment($execution); |
||
| 58 | return $processApplicationForDeployment; |
||
| 59 | } |
||
| 60 | return null; |
||
| 61 | } |
||
| 98 |
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