1 | <?php declare(strict_types=1); |
||
8 | class Collection |
||
9 | { |
||
10 | public const ASC = 1; |
||
11 | public const DESC = 0; |
||
12 | |||
13 | private $generic; |
||
14 | |||
15 | private $collection = []; |
||
16 | |||
17 | 13 | public function __construct(string $class) |
|
21 | |||
22 | 10 | public function addOne(object $object): self |
|
31 | |||
32 | 5 | public function addAll(array $objects): self |
|
38 | |||
39 | 3 | public function count(): int |
|
43 | |||
44 | 2 | public function immutable(): self |
|
48 | |||
49 | 3 | public function getGeneric(): string |
|
50 | { |
||
51 | 3 | return $this->generic; |
|
52 | } |
||
53 | |||
54 | 1 | private function cmp(string $key, int $order): callable |
|
60 | |||
61 | public function where(string $query): self |
||
67 | |||
68 | 1 | public function sort(string $key, int $order = Collection::ASC): self |
|
74 | |||
75 | 3 | public function limit(int $limit, int $offset = 0): self |
|
81 | |||
82 | 6 | public function get(): array |
|
86 | } |
||
87 |