| Conditions | 10 |
| Paths | 8 |
| Total Lines | 43 |
| Code Lines | 31 |
| 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 |
||
| 50 | public function toSearchableArray() |
||
| 51 | { |
||
| 52 | if (!sizeof($this->searchableColumns)) { |
||
| 53 | $result = collect($this); |
||
| 54 | } else { |
||
| 55 | $result = collect([ |
||
| 56 | 'id' => $this['id'], |
||
| 57 | ]); |
||
| 58 | foreach ($this->searchableColumns as $searchableColumn) { |
||
| 59 | $result->put($searchableColumn, collect($this)->get($searchableColumn)); |
||
| 60 | } |
||
| 61 | } |
||
| 62 | if (sizeof($this->searchableInnerColumns)) { |
||
| 63 | foreach ($this->searchableInnerColumns as $searchableInnerColumnKey => $searchableInnerColumnValue) { |
||
| 64 | $searchableInnerColumnKey = explode('-', $searchableInnerColumnKey)[0]; |
||
| 65 | $innerModels = explode('.', $searchableInnerColumnKey); |
||
| 66 | $values = $this; |
||
| 67 | foreach ($innerModels as $innerModel) { |
||
| 68 | $values = $values->{$innerModel}; |
||
| 69 | } |
||
| 70 | $values = collect($values); |
||
| 71 | $result->put($searchableInnerColumnKey . '-' . $searchableInnerColumnValue, |
||
| 72 | collect($values)->get($searchableInnerColumnValue)); |
||
| 73 | } |
||
| 74 | } |
||
| 75 | if (sizeof($this->searchableManyInnerColumns)) { |
||
| 76 | foreach ($this->searchableManyInnerColumns as $searchableInnerColumnKey => $searchableInnerColumnValue) { |
||
| 77 | $searchableInnerColumnKey = explode('-', $searchableInnerColumnKey)[0]; |
||
| 78 | $innerModels = explode('.', $searchableInnerColumnKey); |
||
| 79 | $values = $this; |
||
| 80 | foreach ($innerModels as $innerModel) { |
||
| 81 | $values = $values->{$innerModel}; |
||
| 82 | } |
||
| 83 | $values = collect($values); |
||
| 84 | $counter = 0; |
||
| 85 | foreach ($values as $value) { |
||
| 86 | $result->put($searchableInnerColumnKey . '-' . $searchableInnerColumnValue . '-' . $counter, |
||
| 87 | collect($value)->get($searchableInnerColumnValue)); |
||
| 88 | $counter++; |
||
| 89 | } |
||
| 90 | } |
||
| 91 | } |
||
| 92 | return $result->toArray(); |
||
| 93 | } |
||
| 133 |
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