Conditions | 4 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 16 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | 2 | public function run(&$data, $key = null) |
|
11 | { |
||
12 | 2 | $new = []; |
|
13 | 2 | foreach ($data as $key => $value) { |
|
14 | 2 | if (!is_array($value)) { // check for single to be sure! |
|
15 | 2 | $oldKey = $key; |
|
16 | |||
17 | 2 | parent::run($key); |
|
18 | 2 | if ($this->options['use'] == 'raw') { |
|
19 | 1 | parent::run($value, $oldKey . '_' . $value); |
|
20 | 1 | } else { |
|
21 | 1 | parent::run($value, $key . '_' . $value); |
|
22 | } |
||
23 | |||
24 | 2 | unset($data[$oldKey]); |
|
25 | 2 | $new[$key] = $value; |
|
26 | 2 | } |
|
27 | 2 | } |
|
28 | 2 | $data += $new; // yep, union operator here! |
|
29 | 2 | } |
|
30 | } |
||
31 |