| Conditions | 11 |
| Paths | 26 |
| Total Lines | 38 |
| Code Lines | 24 |
| 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 |
||
| 57 | protected function workOutLinksForModel($obj, $model, $modelAdminLink, $modelAdmin) |
||
| 58 | { |
||
| 59 | $links = []; |
||
| 60 | $sanitizedModel = AllLinks::sanitise_class_name($model); |
||
| 61 | $modelLink = $modelAdminLink . $sanitizedModel . '/'; |
||
| 62 | for ($i = 0; $i < $this->numberOfExamples; ++$i) { |
||
| 63 | $item = $this->getRandomArchivedItem($model); |
||
| 64 | $exceptionMethod = ''; |
||
| 65 | foreach ($this->Config()->get('model_admin_alternatives') as $test => $method) { |
||
| 66 | if (! $method) { |
||
| 67 | $method = 'do-not-use'; |
||
| 68 | } |
||
| 69 | |||
| 70 | if (false !== strpos($modelAdminLink, $test)) { |
||
| 71 | $exceptionMethod = $method; |
||
| 72 | } |
||
| 73 | } |
||
| 74 | |||
| 75 | if ($exceptionMethod) { |
||
| 76 | if ($item && $item->hasMethod($exceptionMethod)) { |
||
| 77 | $links = array_merge($links, $item->{$exceptionMethod}($modelAdminLink)); |
||
| 78 | } |
||
| 79 | } else { |
||
| 80 | //needs to stay here for exception! |
||
| 81 | $links[] = $modelLink; |
||
| 82 | if ($item) { |
||
| 83 | $test1 = is_subclass_of($model, SiteTree::class); |
||
| 84 | $test2 = SiteTree::class === (string) $model; |
||
| 85 | if ($test1 || $test2) { |
||
| 86 | $links[] = $modelLink . 'EditForm/field/Pages/item/' . $item->ID . '/view/'; |
||
| 87 | } else { |
||
| 88 | $links[] = $modelLink . 'EditForm/field/Others/item/' . $item->ID . '/view/'; |
||
| 89 | } |
||
| 90 | } |
||
| 91 | } |
||
| 92 | } |
||
| 93 | |||
| 94 | return $links; |
||
| 95 | } |
||
| 128 |
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