Conditions | 3 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
30 | 14 | public function filter($query, $key, $value) |
|
31 | { |
||
32 | 14 | $methodScope = 'scope' . studly_case($key); |
|
33 | 14 | if (is_object($this->model) && method_exists($this->model, $methodScope)) { |
|
34 | 2 | $methodName = camel_case($key); |
|
35 | 2 | $query = $query->{$methodName}($value); |
|
|
|||
36 | 2 | return true; |
|
37 | } |
||
38 | |||
39 | 13 | return false; |
|
40 | } |
||
41 | } |
||
42 |
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.