| Conditions | 10 |
| Paths | 18 |
| Total Lines | 24 |
| Code Lines | 14 |
| 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 |
||
| 33 | protected function buildCompositeInCondition(?string $operator, $columns, $values, &$params): string |
||
| 34 | { |
||
| 35 | $quotedColumns = []; |
||
| 36 | |||
| 37 | foreach ($columns as $i => $column) { |
||
| 38 | $quotedColumns[$i] = strpos($column, '(') === false ? $this->queryBuilder->db->quoteColumnName($column) : $column; |
||
|
|
|||
| 39 | } |
||
| 40 | |||
| 41 | $vss = []; |
||
| 42 | |||
| 43 | foreach ($values as $value) { |
||
| 44 | $vs = []; |
||
| 45 | foreach ($columns as $i => $column) { |
||
| 46 | if (isset($value[$column])) { |
||
| 47 | $phName = $this->queryBuilder->bindParam($value[$column], $params); |
||
| 48 | $vs[] = $quotedColumns[$i] . ($operator === 'IN' ? ' = ' : ' != ') . $phName; |
||
| 49 | } else { |
||
| 50 | $vs[] = $quotedColumns[$i] . ($operator === 'IN' ? ' IS' : ' IS NOT') . ' NULL'; |
||
| 51 | } |
||
| 52 | } |
||
| 53 | $vss[] = '(' . implode($operator === 'IN' ? ' AND ' : ' OR ', $vs) . ')'; |
||
| 54 | } |
||
| 55 | |||
| 56 | return '(' . implode($operator === 'IN' ? ' OR ' : ' AND ', $vss) . ')'; |
||
| 57 | } |
||
| 59 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.