Conditions | 10 |
Paths | 32 |
Total Lines | 52 |
Code Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 |
||
25 | public function build(QueryInterface $query, array $params = []): array |
||
26 | { |
||
27 | $query = $query->prepare($this->queryBuilder); |
||
28 | |||
29 | $params = empty($params) ? $query->getParams() : array_merge($params, $query->getParams()); |
||
30 | |||
31 | $clauses = [ |
||
32 | $this->buildSelect($query->getSelect(), $params, $query->getDistinct(), $query->getSelectOption()), |
||
33 | $this->buildFrom($query->getFrom(), $params), |
||
34 | $this->buildJoin($query->getJoin(), $params), |
||
35 | $this->buildWhere($query->getWhere(), $params), |
||
36 | $this->buildGroupBy($query->getGroupBy()), |
||
37 | $this->buildHaving($query->getHaving(), $params), |
||
38 | ]; |
||
39 | |||
40 | $orderBy = $query->getOrderBy(); |
||
41 | $sql = implode($this->separator, array_filter($clauses)); |
||
42 | $sql = $this->buildOrderByAndLimit($sql, $orderBy, $query->getLimit(), $query->getOffset()); |
||
43 | |||
44 | if (!empty($orderBy)) { |
||
45 | /** @psalm-var array<string|ExpressionInterface> $orderBy */ |
||
46 | foreach ($orderBy as $expression) { |
||
47 | if ($expression instanceof ExpressionInterface) { |
||
48 | $this->buildExpression($expression, $params); |
||
49 | } |
||
50 | } |
||
51 | } |
||
52 | |||
53 | $groupBy = $query->getGroupBy(); |
||
54 | |||
55 | if (!empty($groupBy)) { |
||
56 | /** @psalm-var array<string|ExpressionInterface> $groupBy */ |
||
57 | foreach ($groupBy as $expression) { |
||
58 | if ($expression instanceof ExpressionInterface) { |
||
59 | $this->buildExpression($expression, $params); |
||
60 | } |
||
61 | } |
||
62 | } |
||
63 | |||
64 | $union = $this->buildUnion($query->getUnion(), $params); |
||
65 | |||
66 | if ($union !== '') { |
||
67 | $sql = "$sql$this->separator$union"; |
||
68 | } |
||
69 | |||
70 | $with = $this->buildWithQueries($query->getWithQueries(), $params); |
||
71 | |||
72 | if ($with !== '') { |
||
73 | $sql = "$with$this->separator$sql"; |
||
74 | } |
||
75 | |||
76 | return [$sql, $params]; |
||
77 | } |
||
139 |
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