These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | declare(strict_types = 1); |
||
3 | |||
4 | namespace Innmind\Immutable; |
||
5 | |||
6 | interface SequenceInterface extends SizeableInterface, PrimitiveInterface, \Countable, \Iterator, \ArrayAccess |
||
7 | { |
||
8 | /** |
||
9 | * Return the element at the given index |
||
10 | * |
||
11 | * @param int $index |
||
12 | * |
||
13 | * @throws OutOfBoundException |
||
14 | * |
||
15 | * @return mixed |
||
16 | */ |
||
17 | public function get(int $index); |
||
18 | |||
19 | /** |
||
20 | * Return the diff between this sequence and another |
||
21 | * |
||
22 | * @param self $seq |
||
23 | * |
||
24 | * @return self |
||
25 | */ |
||
26 | public function diff(self $seq): self; |
||
27 | |||
28 | /** |
||
29 | * Remove all duplicates from the sequence |
||
30 | * |
||
31 | * @return self |
||
32 | */ |
||
33 | public function distinct(): self; |
||
34 | |||
35 | /** |
||
36 | * Remove the n first elements |
||
37 | * |
||
38 | * @param int $size |
||
39 | * |
||
40 | * @return self |
||
41 | */ |
||
42 | public function drop(int $size): self; |
||
43 | |||
44 | /** |
||
45 | * Remove the n last elements |
||
46 | * |
||
47 | * @param int $size |
||
48 | * |
||
49 | * @return self |
||
50 | */ |
||
51 | public function dropEnd(int $size): self; |
||
52 | |||
53 | /** |
||
54 | * Check if the two sequences are equal |
||
55 | * |
||
56 | * @param self $seq |
||
57 | * |
||
58 | * @return bool |
||
59 | */ |
||
60 | public function equals(self $seq): bool; |
||
61 | |||
62 | /** |
||
63 | * Return all elements that satisfy the given predicate |
||
64 | * |
||
65 | * @param Closure $predicate |
||
66 | * |
||
67 | * @return self |
||
68 | */ |
||
69 | public function filter(\Closure $predicate): self; |
||
70 | |||
71 | /** |
||
72 | * Apply the given function to all elements of the sequence |
||
73 | * |
||
74 | * @param Closure $function |
||
75 | * |
||
76 | * @return self |
||
77 | */ |
||
78 | public function foreach(\Closure $function): self; |
||
79 | |||
80 | /** |
||
81 | * Return a new map of pairs grouped by keys determined with the given |
||
82 | * discriminator function |
||
83 | * |
||
84 | * @param Closure $discriminator |
||
85 | * |
||
86 | * @return MapInterface |
||
87 | */ |
||
88 | public function groupBy(\Closure $discriminator): MapInterface; |
||
89 | |||
90 | /** |
||
91 | * Return the first element |
||
92 | * |
||
93 | * @return mixed |
||
94 | */ |
||
95 | public function first(); |
||
96 | |||
97 | /** |
||
98 | * Return the last element |
||
99 | * |
||
100 | * @return mixed |
||
101 | */ |
||
102 | public function last(); |
||
103 | |||
104 | /** |
||
105 | * Check if the sequence contains the given element |
||
106 | * |
||
107 | * @param mixed $element |
||
108 | * |
||
109 | * @return bool |
||
110 | */ |
||
111 | public function contains($element): bool; |
||
112 | |||
113 | /** |
||
114 | * Return the index for the given element |
||
115 | * |
||
116 | * @param mixed $element |
||
117 | * |
||
118 | * @throws ElementNotFoundException |
||
119 | * |
||
120 | * @return int |
||
121 | */ |
||
122 | public function indexOf($element): int; |
||
123 | |||
124 | /** |
||
125 | * Return the list of indices |
||
126 | * |
||
127 | * @return self |
||
128 | */ |
||
129 | public function indices(): self; |
||
130 | |||
131 | /** |
||
132 | * Return a new sequence by applying the given function to all elements |
||
133 | * |
||
134 | * @param Closure $function |
||
135 | * |
||
136 | * @return self |
||
137 | */ |
||
138 | public function map(\Closure $function): self; |
||
139 | |||
140 | /** |
||
141 | * Pad the sequence to a defined size with the given element |
||
142 | * |
||
143 | * @param int $size |
||
144 | * @param mixed $element |
||
145 | * |
||
146 | * @return self |
||
147 | */ |
||
148 | public function pad(int $size, $element): self; |
||
149 | |||
150 | /** |
||
151 | * Return a sequence of 2 sequences partitioned according to the given predicate |
||
152 | * |
||
153 | * @param Closure $predicate |
||
154 | * |
||
155 | * @return self[self] |
||
0 ignored issues
–
show
|
|||
156 | */ |
||
157 | public function partition(\Closure $predicate): self; |
||
158 | |||
159 | /** |
||
160 | * Slice the sequence |
||
161 | * |
||
162 | * @param int $from |
||
163 | * @param int $until |
||
164 | * |
||
165 | * @return self |
||
166 | */ |
||
167 | public function slice(int $from, int $until): self; |
||
168 | |||
169 | /** |
||
170 | * Split the sequence in a sequence of 2 sequences splitted at the given position |
||
171 | * |
||
172 | * @param int $position |
||
173 | * |
||
174 | * @throws OutOfBoundException |
||
175 | * |
||
176 | * @return self[self] |
||
0 ignored issues
–
show
The doc-type
self[self] could not be parsed: Expected "]" at position 2, but found "self". (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
177 | */ |
||
178 | public function splitAt(int $position): self; |
||
179 | |||
180 | /** |
||
181 | * Return a sequence with the n first elements |
||
182 | * |
||
183 | * @param int $size |
||
184 | * |
||
185 | * @return self |
||
186 | */ |
||
187 | public function take(int $size): self; |
||
188 | |||
189 | /** |
||
190 | * Return a sequence with the n last elements |
||
191 | * |
||
192 | * @param int $size |
||
193 | * |
||
194 | * @return self |
||
195 | */ |
||
196 | public function takeEnd(int $size): self; |
||
197 | |||
198 | /** |
||
199 | * Append the given sequence to the current one |
||
200 | * |
||
201 | * @param self $seq |
||
202 | * |
||
203 | * @return self |
||
204 | */ |
||
205 | public function append(self $seq): self; |
||
206 | |||
207 | /** |
||
208 | * Return a sequence with all elements from the current one that exist |
||
209 | * in the given one |
||
210 | * |
||
211 | * @param self $seq |
||
212 | * |
||
213 | * @return self |
||
214 | */ |
||
215 | public function intersect(self $seq): self; |
||
216 | |||
217 | /** |
||
218 | * Concatenate all elements with the given separator |
||
219 | * |
||
220 | * @param string $separator |
||
221 | * |
||
222 | * @return StringPrimitive |
||
223 | */ |
||
224 | public function join(string $separator): StringPrimitive; |
||
225 | |||
226 | /** |
||
227 | * Add the given element at the end of the sequence |
||
228 | * |
||
229 | * @param mixed $element |
||
230 | * |
||
231 | * @return self |
||
232 | */ |
||
233 | public function add($element): self; |
||
234 | } |
||
235 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.