Conditions | 5 |
Paths | 2 |
Total Lines | 25 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 18 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | 1 | private function getNodes($z, $flowJson) |
|
32 | { |
||
33 | 1 | $rawNodes = json_decode($flowJson, true); |
|
34 | |||
35 | 1 | $idMap = []; |
|
36 | |||
37 | 1 | foreach ($rawNodes as $node) { |
|
38 | 1 | $idMap[$node['id']] = uniqid(); |
|
39 | 1 | } |
|
40 | |||
41 | 1 | return array_map(function ($node) use ($z, $idMap){ |
|
42 | 1 | $node['id'] = $idMap[$node['id']]; |
|
43 | 1 | $node['z'] = $z; |
|
44 | |||
45 | 1 | if (isset($node['wires'])) { |
|
46 | 1 | foreach ($node['wires'] as &$wire) { |
|
47 | 1 | foreach ($wire as &$id) { |
|
48 | 1 | $id = $idMap[$id]; |
|
49 | 1 | } |
|
50 | 1 | } |
|
51 | 1 | } |
|
52 | |||
53 | 1 | return $node; |
|
54 | 1 | }, json_decode($flowJson, true)); |
|
55 | } |
||
56 | } |
||
57 |