Total Complexity | 11 |
Total Lines | 72 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class ArrayProcessor implements Arrayable |
||
9 | { |
||
10 | protected $items = []; |
||
11 | |||
12 | protected $keys_as_string = false; |
||
13 | |||
14 | 10 | public function keysAsString(): self |
|
15 | { |
||
16 | 10 | $this->keys_as_string = true; |
|
17 | |||
18 | 10 | return $this; |
|
19 | } |
||
20 | |||
21 | 18 | public function of(array $items): self |
|
26 | } |
||
27 | |||
28 | 2 | public function push($value): self |
|
29 | { |
||
30 | 2 | array_push($this->items, $value); |
|
31 | |||
32 | 2 | return $this; |
|
33 | } |
||
34 | |||
35 | 11 | public function merge(array $array): self |
|
44 | } |
||
45 | |||
46 | 18 | public function unique(): self |
|
51 | } |
||
52 | |||
53 | 18 | public function values(): self |
|
54 | { |
||
55 | 18 | $this->items = array_values($this->items); |
|
56 | |||
57 | 18 | return $this; |
|
58 | } |
||
59 | |||
60 | 2 | public function sort(): self |
|
61 | { |
||
62 | 2 | $this->items = ArrHelper::sort($this->items); |
|
63 | |||
64 | 2 | return $this; |
|
65 | } |
||
66 | |||
67 | 18 | public function toArray(): array |
|
68 | { |
||
69 | 18 | return $this->items; |
|
70 | } |
||
71 | |||
72 | 18 | protected function stringingKeys(array $array): array |
|
80 | 10 | }); |
|
81 | } |
||
82 | } |
||
83 |