| Conditions | 11 |
| Paths | 9 |
| Total Lines | 39 |
| Code Lines | 19 |
| 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 |
||
| 58 | public function make($element) |
||
| 59 | { |
||
| 60 | // decorate attachment |
||
| 61 | if ($this->model instanceof AttachableInterface |
||
| 62 | && method_exists($this->model, 'getAttachedFiles') |
||
| 63 | && array_key_exists($element, $this->model->getAttachedFiles()) |
||
| 64 | ) { |
||
| 65 | $file = $this->model->getAttachedFiles()[$element]; |
||
| 66 | if ($file->variants()) { |
||
| 67 | return Image::make($element, $element); |
||
| 68 | } |
||
| 69 | |||
| 70 | return File::make($element, $element); |
||
| 71 | } |
||
| 72 | |||
| 73 | // decorate translatable attachment |
||
| 74 | if ($this->model instanceof Translatable) { |
||
| 75 | $translation = $this->model->getTranslationModel(); |
||
| 76 | |||
| 77 | if ($translation instanceof AttachableInterface |
||
| 78 | && method_exists($translation, 'getAttachedFiles') |
||
| 79 | && array_key_exists($element, $translation->getAttachedFiles()) |
||
| 80 | ) { |
||
| 81 | return Image::make($element); |
||
| 82 | } |
||
| 83 | } |
||
| 84 | |||
| 85 | // decorate table column |
||
| 86 | if ($this->realColum($element)) { |
||
| 87 | $field = $this->detectField($element); |
||
| 88 | |||
| 89 | if (is_object($field)) { |
||
| 90 | return $field; |
||
| 91 | } |
||
| 92 | |||
| 93 | return forward_static_call_array([$field, 'make'], [$element, $element]); |
||
| 94 | } |
||
| 95 | |||
| 96 | return Text::make($element, $element); |
||
| 97 | } |
||
| 139 |
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