@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace PHPKitchen\Platform\Collection\Base; |
4 | 4 | |
5 | 5 | use PHPKitchen\Platform\Collection\Mixin; |
6 | -use PHPKitchen\Platform\Contract; |
|
7 | 6 | |
8 | 7 | /** |
9 | 8 | * Represents a base class for collections based on arrays. |
@@ -13,16 +13,32 @@ discard block |
||
13 | 13 | * @author Dmitry Kolodko <[email protected]> |
14 | 14 | */ |
15 | 15 | interface ArrayBasedCollection extends ArrayAccess, Countable, IteratorAggregate, JsonSerializable { |
16 | + |
|
17 | + /** |
|
18 | + * @return \PHPKitchen\Platform\Collection\Base\ArrayBasedCollection |
|
19 | + */ |
|
16 | 20 | public static function from($data); |
17 | 21 | |
18 | 22 | ///region ----------------- DATA CLEANING METHODS ----------------- |
19 | 23 | |
24 | + /** |
|
25 | + * @return void |
|
26 | + */ |
|
20 | 27 | public function clear(): void; |
21 | 28 | |
29 | + /** |
|
30 | + * @return void |
|
31 | + */ |
|
22 | 32 | public function remove($element): void; |
23 | 33 | |
34 | + /** |
|
35 | + * @return void |
|
36 | + */ |
|
24 | 37 | public function removeAll($element): void; |
25 | 38 | |
39 | + /** |
|
40 | + * @return void |
|
41 | + */ |
|
26 | 42 | public function removeAt($index): void; |
27 | 43 | |
28 | 44 | ////endregion |
@@ -33,10 +49,19 @@ discard block |
||
33 | 49 | |
34 | 50 | public function onEachRecursive(callable $do): bool; |
35 | 51 | |
52 | + /** |
|
53 | + * @return void |
|
54 | + */ |
|
36 | 55 | public function filter(callable $by): void; |
37 | 56 | |
57 | + /** |
|
58 | + * @return void |
|
59 | + */ |
|
38 | 60 | public function map(callable $by): void; |
39 | 61 | |
62 | + /** |
|
63 | + * @return void |
|
64 | + */ |
|
40 | 65 | public function reduce(callable $by): void; |
41 | 66 | |
42 | 67 | ///endregion |
@@ -57,12 +82,24 @@ discard block |
||
57 | 82 | |
58 | 83 | public function lastKeyOf($element); |
59 | 84 | |
85 | + /** |
|
86 | + * @return \PHPKitchen\Platform\Collection\Base\ArrayBasedCollection |
|
87 | + */ |
|
60 | 88 | public function allKeysOf($element); |
61 | 89 | |
90 | + /** |
|
91 | + * @return \PHPKitchen\Platform\Collection\Base\ArrayBasedCollection |
|
92 | + */ |
|
62 | 93 | public function getKeys(); |
63 | 94 | |
95 | + /** |
|
96 | + * @return \PHPKitchen\Platform\Collection\Base\ArrayBasedCollection |
|
97 | + */ |
|
64 | 98 | public function getValues(); |
65 | 99 | |
100 | + /** |
|
101 | + * @return \PHPKitchen\Platform\Collection\Base\ArrayBasedCollection |
|
102 | + */ |
|
66 | 103 | public function countValues(); |
67 | 104 | |
68 | 105 | public function calculateAverage(); |
@@ -11,8 +11,15 @@ |
||
11 | 11 | * @author Dmitry Kolodko <[email protected]> |
12 | 12 | */ |
13 | 13 | interface Collection extends Base\ArrayBasedCollection, ValueObject { |
14 | + |
|
15 | + /** |
|
16 | + * @return void |
|
17 | + */ |
|
14 | 18 | public function add($element); |
15 | 19 | |
20 | + /** |
|
21 | + * @return \PHPKitchen\Platform\Collection\Collection |
|
22 | + */ |
|
16 | 23 | public function chunkKeepingKeysBy(int $size); |
17 | 24 | |
18 | 25 | public function pushToTheEnd(...$elements): bool; |
@@ -11,11 +11,21 @@ |
||
11 | 11 | * @author Dmitry Kolodko <[email protected]> |
12 | 12 | */ |
13 | 13 | interface Map extends Base\ArrayBasedCollection, ValueObject { |
14 | + |
|
15 | + /** |
|
16 | + * @return void |
|
17 | + */ |
|
14 | 18 | public function add(string $key, $element); |
15 | 19 | |
16 | 20 | public function get(string $key); |
17 | 21 | |
22 | + /** |
|
23 | + * @return void |
|
24 | + */ |
|
18 | 25 | public function keysToLowerCase(): void; |
19 | 26 | |
27 | + /** |
|
28 | + * @return void |
|
29 | + */ |
|
20 | 30 | public function keysToUpperCase(): void; |
21 | 31 | } |
22 | 32 | \ No newline at end of file |