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 |
||
29 | 2 | public function run(&$data, $key = null) |
|
30 | { |
||
31 | 2 | $new = []; |
|
32 | 2 | foreach ($data as $key => $value) { |
|
33 | 2 | if (is_array($value)) { // check for option to be sure! |
|
34 | 2 | $oldKey = $key; |
|
35 | |||
36 | 2 | $key = $this->get($key); |
|
37 | 2 | if ($this->options['use'] == 'raw') { |
|
38 | 1 | parent::run($value, $oldKey); |
|
39 | 1 | } else { |
|
40 | 1 | parent::run($value, $key); |
|
41 | } |
||
42 | |||
43 | 2 | unset($data[$oldKey]); |
|
44 | 2 | $new[$key] = $value; |
|
45 | 2 | } |
|
46 | 2 | } |
|
47 | 2 | $data += $new; // yep, union operator here! |
|
48 | 2 | } |
|
49 | } |
||
50 |