Conditions | 5 |
Paths | 5 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 8.9038 |
Changes | 0 |
1 | <?php |
||
17 | 3 | public function __construct($type, QueryExpression $left, QueryExpression ...$others) |
|
18 | { |
||
19 | switch ($type) { |
||
20 | 3 | case 'AND': |
|
21 | case 'OR': |
||
22 | 3 | $this->type = $type; |
|
23 | 3 | break; |
|
24 | case 'NOT': |
||
25 | if (!empty($others)) { |
||
26 | throw new QueryException("NOT Operator can only accept 1 argument"); |
||
27 | } |
||
28 | $this->type = $type; |
||
29 | break; |
||
30 | default: |
||
31 | throw new QueryException(sprintf("Invalid predicate operator \"%s\"", $type)); |
||
32 | } |
||
33 | |||
34 | 3 | $this->conditions = array_merge([$left], $others); |
|
35 | 3 | } |
|
36 | |||
72 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.