Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | /** |
3 | * Pop PHP Framework (http://www.popphp.org/) |
4 | * |
5 | * @link https://github.com/popphp/popphp-framework |
6 | * @author Nick Sagona, III <dev@nolainteractive.com> |
7 | * @copyright Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com) |
8 | * @license http://www.popphp.org/license New BSD License |
9 | */ |
10 | |
11 | /** |
12 | * @namespace |
13 | */ |
14 | namespace Pop\Utils; |
15 | |
16 | /** |
17 | * Pop utils arrayable interface |
18 | * |
19 | * @category Pop |
20 | * @package Pop\Utils |
21 | * @author Nick Sagona, III <dev@nolainteractive.com> |
22 | * @copyright Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com) |
23 | * @license http://www.popphp.org/license New BSD License |
24 | * @version 2.1.0 |
25 | */ |
26 | interface ArrayableInterface |
27 | { |
28 | |
29 | /** |
30 | * Get the first item of the array |
31 | * |
32 | * @return mixed |
33 | */ |
34 | public function first(): mixed; |
35 | |
36 | /** |
37 | * Get the next item of the array |
38 | * |
39 | * @return mixed |
40 | */ |
41 | public function next(): mixed; |
42 | |
43 | /** |
44 | * Get the current item of the array |
45 | * |
46 | * @return mixed |
47 | */ |
48 | public function current(): mixed; |
49 | |
50 | /** |
51 | * Get the last item of the array |
52 | * |
53 | * @return mixed |
54 | */ |
55 | public function last(): mixed; |
56 | |
57 | /** |
58 | * Get the key of the current item of the array |
59 | * |
60 | * @return mixed |
61 | */ |
62 | public function key(): mixed; |
63 | |
64 | /** |
65 | * Determine if an item exists in the array |
66 | * |
67 | * @param mixed $key |
68 | * @param bool $strict |
69 | * @return bool |
70 | */ |
71 | public function contains(mixed $key, bool $strict = false): bool; |
72 | |
73 | /** |
74 | * Sort array |
75 | * |
76 | * @param int $flags |
77 | * @param bool $assoc |
78 | * @param bool $descending |
79 | * @return array |
80 | */ |
81 | public function sort(int $flags = SORT_REGULAR, bool $assoc = true, bool $descending = false): static; |
82 | |
83 | /** |
84 | * Sort array descending |
85 | * |
86 | * @param int $flags |
87 | * @param bool $assoc |
88 | * @return static |
89 | */ |
90 | public function sortDesc(int $flags = SORT_REGULAR, bool $assoc = true): static; |
91 | |
92 | /** |
93 | * Sort array by keys |
94 | * |
95 | * @param int $flags |
96 | * @param bool $descending |
97 | * @return array |
98 | */ |
99 | public function ksort(int $flags = SORT_REGULAR, bool $descending = false): static; |
100 | |
101 | /** |
102 | * Sort array by keys, descending |
103 | * |
104 | * @param int $flags |
105 | * @return static |
106 | */ |
107 | public function ksortDesc(int $flags = SORT_REGULAR): static; |
108 | |
109 | /** |
110 | * Sort array by user-defined callback |
111 | * |
112 | * @param mixed $callback |
113 | * @param bool $assoc |
114 | * @return static |
115 | */ |
116 | public function usort(mixed $callback, bool $assoc = true): static; |
117 | |
118 | /** |
119 | * Sort array by user-defined callback using keys |
120 | * |
121 | * @param mixed $callback |
122 | * @return array |
123 | */ |
124 | public function uksort(mixed $callback): static; |
125 | |
126 | /** |
127 | * Split a string into an array object |
128 | * |
129 | * @param string $string |
130 | * @param string $separator |
131 | * @param int $limit |
132 | * @return static |
133 | */ |
134 | public static function split(string $string, string $separator, int $limit = PHP_INT_MAX): static; |
135 | |
136 | /** |
137 | * Join the array values into a string |
138 | * |
139 | * @param string $glue |
140 | * @param string $finalGlue |
141 | * @return string |
142 | */ |
143 | public function join(string $glue, string $finalGlue = ''): string; |
144 | |
145 | /** |
146 | * Get the array object as an array. |
147 | * |
148 | * @return array |
149 | */ |
150 | public function toArray(): array; |
151 | |
152 | } |