Conditions | 3 |
Paths | 3 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
15 | public static function fromString($string, Translations $translations, array $options = []) |
||
16 | { |
||
17 | $handle = fopen('php://memory', 'w'); |
||
18 | |||
19 | fputs($handle, $string); |
||
20 | rewind($handle); |
||
21 | |||
22 | $entries = []; |
||
|
|||
23 | |||
24 | while ($row = fgetcsv($handle)) { |
||
25 | $translation = $translations->insert(array_shift($row), array_shift($row)); |
||
26 | |||
27 | if (!empty($row)) { |
||
28 | $translation->setTranslation(array_shift($row)); |
||
29 | $translation->setPluralTranslations($row); |
||
30 | } |
||
31 | } |
||
32 | |||
33 | fclose($handle); |
||
34 | |||
35 | return $translations; |
||
36 | } |
||
37 | } |
||
38 |
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.