remotelyliving /
php-collection
| 1 | <?php |
||
| 2 | |||
| 3 | namespace RemotelyLiving\PHPCollection; |
||
| 4 | |||
| 5 | interface CollectionInterface extends \Traversable, \Countable, \IteratorAggregate, \Serializable, \JsonSerializable |
||
| 6 | { |
||
| 7 | public function count(): int; |
||
| 8 | |||
| 9 | public function map(callable $fn): self; |
||
| 10 | |||
| 11 | public function filter(callable $fn): self; |
||
| 12 | |||
| 13 | public function each(callable $fn): self; |
||
| 14 | |||
| 15 | public function chunk(int $size, callable $fn): self; |
||
| 16 | |||
| 17 | public function reverse(): self; |
||
| 18 | |||
| 19 | public function reIndex(): self; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @return mixed|null |
||
| 23 | */ |
||
| 24 | public function first(); |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @return mixed|null |
||
| 28 | */ |
||
| 29 | public function last(); |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @param callable $fn |
||
| 33 | * @param null $initial |
||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
| 34 | * |
||
| 35 | * @return mixed |
||
| 36 | */ |
||
| 37 | public function reduce(callable $fn, $initial = null); |
||
| 38 | |||
| 39 | public function unique(): self; |
||
| 40 | |||
| 41 | public function diff(CollectionInterface $collection): self; |
||
| 42 | |||
| 43 | public function merge(CollectionInterface $collection): self; |
||
| 44 | |||
| 45 | public function union(CollectionInterface $collection): self; |
||
| 46 | |||
| 47 | public function intersect(CollectionInterface $collection): self; |
||
| 48 | |||
| 49 | public function sort(callable $comparator = null): self; |
||
| 50 | |||
| 51 | public function kSort(callable $comparator = null): self; |
||
| 52 | |||
| 53 | public function empty(): bool; |
||
| 54 | |||
| 55 | public function all(): array; |
||
| 56 | |||
| 57 | public function deferred(): \Generator; |
||
| 58 | |||
| 59 | public function values(): array; |
||
| 60 | |||
| 61 | public function equals(CollectionInterface $collection): bool; |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @param string|int $offset |
||
| 65 | * |
||
| 66 | * @return bool |
||
| 67 | */ |
||
| 68 | public function has($offset): bool; |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @param mixed $value |
||
| 72 | * |
||
| 73 | * @return bool |
||
| 74 | */ |
||
| 75 | public function contains($value): bool; |
||
| 76 | |||
| 77 | public function some(callable $evaluation): bool; |
||
| 78 | |||
| 79 | /** |
||
| 80 | * @param string|int $offset |
||
| 81 | * @param mixed|null $default |
||
| 82 | * |
||
| 83 | * @return mixed|null |
||
| 84 | */ |
||
| 85 | public function get($offset, $default = null); |
||
| 86 | |||
| 87 | /** |
||
| 88 | * @return mixed |
||
| 89 | */ |
||
| 90 | public function rand(); |
||
| 91 | |||
| 92 | /** |
||
| 93 | * @param string|int ...$offset |
||
| 94 | */ |
||
| 95 | public function unset(...$offset): self; |
||
| 96 | |||
| 97 | /** |
||
| 98 | * @param string|int $offset |
||
| 99 | * @param mixed $value |
||
| 100 | * |
||
| 101 | * @return $this |
||
| 102 | */ |
||
| 103 | public function set($offset, $value): self; |
||
| 104 | |||
| 105 | /** |
||
| 106 | * @param mixed $value |
||
| 107 | */ |
||
| 108 | public function push($value): self; |
||
| 109 | |||
| 110 | /** |
||
| 111 | * @param mixed $values |
||
| 112 | * |
||
| 113 | * @return $this |
||
| 114 | */ |
||
| 115 | public function unshift(...$value): self; |
||
| 116 | } |
||
| 117 |