| Conditions | 5 |
| Paths | 6 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 58 | public function apply(array $data): array |
||
| 59 | { |
||
| 60 | if (!array_key_exists($this->key, $data)) { |
||
| 61 | return $data; |
||
| 62 | } |
||
| 63 | |||
| 64 | $result = []; |
||
| 65 | foreach ($data as $k => $v) { |
||
| 66 | if ($k === $this->beforeKey) { |
||
| 67 | $result[$this->key] = $data[$this->key]; |
||
| 68 | } |
||
| 69 | if ($k !== $this->key) { |
||
| 70 | $result[$k] = $v; |
||
| 71 | } |
||
| 72 | } |
||
| 73 | |||
| 74 | return $result; |
||
| 75 | } |
||
| 77 |