| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 2 |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 16 | 17 | public function __construct($value, $default = null) |
|
| 17 | { |
||
| 18 | 17 | if ($value === null) { |
|
| 19 | 1 | $value = $default; |
|
| 20 | 1 | } |
|
| 21 | |||
| 22 | $options = [ |
||
| 23 | 17 | 'flags' => \FILTER_NULL_ON_FAILURE, |
|
| 24 | 17 | ]; |
|
| 25 | |||
| 26 | 17 | $value = filter_var($value, \FILTER_VALIDATE_BOOLEAN, $options); |
|
| 27 | |||
| 28 | 17 | $assert = that($value)->boolean(); |
|
|
|
|||
| 29 | |||
| 30 | 13 | $this->value = $value; |
|
| 31 | 13 | } |
|
| 32 | |||
| 38 |
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.