| Conditions | 5 |
| Paths | 5 |
| Total Lines | 23 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 18 |
| CRAP Score | 5 |
| Changes | 2 | ||
| Bugs | 1 | 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 single to be sure! |
|
| 34 | 2 | $oldKey = $key; |
|
| 35 | |||
| 36 | 2 | parent::run($key); |
|
| 37 | |||
| 38 | 2 | if ($value) { |
|
| 39 | 2 | if ($this->options['use'] == 'raw') { |
|
| 40 | 1 | parent::run($value, $oldKey . '_' . $value); |
|
| 41 | 1 | } else { |
|
| 42 | 1 | parent::run($value, $key . '_' . $value); |
|
| 43 | } |
||
| 44 | 2 | } |
|
| 45 | |||
| 46 | 2 | unset($data[$oldKey]); |
|
| 47 | 2 | $new[$key] = $value; |
|
| 48 | 2 | } |
|
| 49 | 2 | } |
|
| 50 | 2 | $data += $new; // yep, union operator here! |
|
| 51 | 2 | } |
|
| 52 | } |
||
| 53 |