| 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 |
||
| 45 | public function make($element) |
||
| 46 | { |
||
| 47 | // decorate attachment |
||
| 48 | if ($this->model instanceof AttachableInterface |
||
| 49 | && method_exists($this->model, 'getAttachedFiles') |
||
| 50 | && array_key_exists($element, $this->model->getAttachedFiles()) |
||
| 51 | ) { |
||
| 52 | $file = $this->model->getAttachedFiles()[$element]; |
||
| 53 | if ($file->variants()) { |
||
| 54 | return Image::make($element, $element); |
||
| 55 | } |
||
| 56 | |||
| 57 | return File::make($element, $element); |
||
| 58 | } |
||
| 59 | |||
| 60 | // decorate translatable attachment |
||
| 61 | if ($this->model instanceof Translatable) { |
||
| 62 | $translation = $this->model->getTranslationModel(); |
||
| 63 | |||
| 64 | if ($translation instanceof AttachableInterface |
||
| 65 | && method_exists($translation, 'getAttachedFiles') |
||
| 66 | && array_key_exists($element, $translation->getAttachedFiles()) |
||
| 67 | ) { |
||
| 68 | return Image::make($element); |
||
| 69 | } |
||
| 70 | } |
||
| 71 | |||
| 72 | // decorate table column |
||
| 73 | if ($this->realColum($element)) { |
||
| 74 | $field = $this->detectField($element); |
||
| 75 | |||
| 76 | if (is_object($field)) { |
||
| 77 | return $field; |
||
| 78 | } |
||
| 79 | |||
| 80 | return forward_static_call_array([$field, 'make'], [$element, $element]); |
||
| 81 | } |
||
| 82 | |||
| 83 | return Text::make($element, $element); |
||
| 84 | } |
||
| 158 |
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