Conditions | 10 |
Paths | 18 |
Total Lines | 31 |
Code Lines | 15 |
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 |
||
62 | protected function buildCompositeInCondition( |
||
63 | ?string $operator, |
||
64 | Traversable|array $columns, |
||
65 | Traversable|array $values, |
||
66 | array &$params = [] |
||
67 | ): string { |
||
68 | $quotedColumns = []; |
||
69 | |||
70 | /** @psalm-var string[]|Traversable $columns */ |
||
71 | foreach ($columns as $i => $column) { |
||
72 | $quotedColumns[$i] = !str_contains($column, '(') |
||
73 | ? $this->queryBuilder->quoter()->quoteColumnName($column) : $column; |
||
74 | } |
||
75 | |||
76 | $vss = []; |
||
77 | |||
78 | /** @psalm-var string[][] $values */ |
||
79 | foreach ($values as $value) { |
||
80 | $vs = []; |
||
81 | foreach ($columns as $i => $column) { |
||
82 | if (isset($value[$column])) { |
||
83 | $phName = $this->queryBuilder->bindParam($value[$column], $params); |
||
84 | $vs[] = $quotedColumns[$i] . ($operator === 'IN' ? ' = ' : ' != ') . $phName; |
||
85 | } else { |
||
86 | $vs[] = $quotedColumns[$i] . ($operator === 'IN' ? ' IS' : ' IS NOT') . ' NULL'; |
||
87 | } |
||
88 | } |
||
89 | $vss[] = '(' . implode($operator === 'IN' ? ' AND ' : ' OR ', $vs) . ')'; |
||
90 | } |
||
91 | |||
92 | return '(' . implode($operator === 'IN' ? ' OR ' : ' AND ', $vss) . ')'; |
||
93 | } |
||
95 |
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