| Total Complexity | 8 |
| Total Lines | 63 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 46 | final class MoveValueBeforeKey extends Modifier implements DataModifierInterface |
||
| 47 | { |
||
| 48 | /** |
||
| 49 | * @var int|string |
||
| 50 | */ |
||
| 51 | private $key; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @var int|string |
||
| 55 | */ |
||
| 56 | private $beforeKey; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @param int|string $key |
||
| 60 | * @param int|string $beforeKey |
||
| 61 | */ |
||
| 62 | 5 | public function __construct($key, $beforeKey) |
|
| 66 | 5 | } |
|
| 67 | |||
| 68 | /** |
||
| 69 | * @param int|string $key |
||
| 70 | * |
||
| 71 | * @return self |
||
| 72 | */ |
||
| 73 | 1 | public function withKey($key): self |
|
| 74 | { |
||
| 75 | 1 | $new = clone $this; |
|
| 76 | 1 | $new->key = $key; |
|
| 77 | 1 | return $new; |
|
| 78 | } |
||
| 79 | |||
| 80 | /** |
||
| 81 | * @param int|string $key |
||
| 82 | * |
||
| 83 | * @return self |
||
| 84 | */ |
||
| 85 | 1 | public function beforeKey($key): self |
|
| 86 | { |
||
| 87 | 1 | $new = clone $this; |
|
| 88 | 1 | $new->beforeKey = $key; |
|
| 89 | 1 | return $new; |
|
| 90 | } |
||
| 91 | |||
| 92 | 5 | public function apply(array $data): array |
|
| 109 | } |
||
| 110 | } |
||
| 111 |