Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
18 | 4 | public function findByName($name) |
|
19 | { |
||
20 | 4 | $this->rewind(); |
|
21 | 4 | while ($this->valid()) { |
|
22 | /** @var FieldInterface $field */ |
||
23 | 3 | $field = $this->current(); |
|
24 | 3 | if ($field->getName() == $name) { |
|
25 | 3 | return $field; |
|
26 | } |
||
27 | 1 | $this->next(); |
|
28 | } |
||
29 | 1 | $this->rewind(); |
|
30 | 1 | return null; |
|
31 | } |
||
32 | /** |
||
64 | } |
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.