Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
60 | 4 | protected function getCSV($file_name, $search) |
|
61 | { |
||
62 | 4 | $ch = fopen($file_name, "r"); |
|
63 | 4 | $header_row = fgetcsv($ch); |
|
|
|||
64 | |||
65 | // This will loop through all the rows until it reaches the end |
||
66 | 4 | while ($row = fgetcsv($ch)) { |
|
67 | 4 | if (in_array($search, $row)) { |
|
68 | 1 | return $row; |
|
69 | } |
||
70 | 4 | } |
|
71 | 3 | } |
|
72 | } |
||
73 |
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.