Conditions | 10 |
Paths | 18 |
Total Lines | 21 |
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 |
||
21 | protected function buildCompositeInCondition($operator, $columns, $values, &$params) |
||
22 | { |
||
23 | $quotedColumns = []; |
||
24 | foreach ($columns as $i => $column) { |
||
25 | $quotedColumns[$i] = strpos($column, '(') === false ? $this->queryBuilder->db->quoteColumnName($column) : $column; |
||
26 | } |
||
27 | $vss = []; |
||
28 | foreach ($values as $value) { |
||
29 | $vs = []; |
||
30 | foreach ($columns as $i => $column) { |
||
31 | if (isset($value[$column])) { |
||
32 | $phName = $this->queryBuilder->bindParam($value[$column], $params); |
||
33 | $vs[] = $quotedColumns[$i] . ($operator === 'IN' ? ' = ' : ' != ') . $phName; |
||
34 | } else { |
||
35 | $vs[] = $quotedColumns[$i] . ($operator === 'IN' ? ' IS' : ' IS NOT') . ' NULL'; |
||
36 | } |
||
37 | } |
||
38 | $vss[] = '(' . implode($operator === 'IN' ? ' AND ' : ' OR ', $vs) . ')'; |
||
39 | } |
||
40 | |||
41 | return '(' . implode($operator === 'IN' ? ' OR ' : ' AND ', $vss) . ')'; |
||
42 | } |
||
44 |
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.