Conditions | 4 |
Paths | 2 |
Total Lines | 23 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 16 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
33 | 1 | private function getNodes($z, $flowJson) |
|
34 | { |
||
35 | 1 | $rawNodes = json_decode($flowJson, true); |
|
36 | |||
37 | 1 | $idMap = []; |
|
38 | |||
39 | 1 | foreach ($rawNodes as $node) { |
|
40 | 1 | $idMap[$node['id']] = uniqid(); |
|
41 | 1 | } |
|
42 | |||
43 | 1 | return array_map(function ($node) use ($z, $idMap){ |
|
44 | 1 | $node['id'] = $idMap[$node['id']]; |
|
45 | 1 | $node['z'] = $z; |
|
46 | |||
47 | 1 | foreach ($node['wires'] as &$wire) { |
|
48 | 1 | foreach ($wire as &$id) { |
|
49 | 1 | $id = $idMap[$id]; |
|
50 | 1 | } |
|
51 | 1 | } |
|
52 | |||
53 | 1 | return $node; |
|
54 | 1 | }, json_decode($flowJson, true)); |
|
55 | } |
||
56 | } |
||
57 |
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.