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