1 | <?php |
||
13 | class Result implements Iterator, Countable |
||
14 | { |
||
15 | /** |
||
16 | * Collections list. |
||
17 | * |
||
18 | * @var array |
||
19 | */ |
||
20 | protected $collections = []; |
||
21 | |||
22 | /** |
||
23 | * @param Model $item |
||
24 | * @param $key string Item key in collection |
||
25 | */ |
||
26 | public function addItem(Model $item, ?string $key = null): void |
||
34 | |||
35 | /** |
||
36 | * Get Model by key from collection |
||
37 | * @param string $key |
||
38 | * @return Model|null |
||
39 | */ |
||
40 | public function getBy(string $key): ?Model |
||
48 | |||
49 | /** |
||
50 | * @return Model[] |
||
51 | */ |
||
52 | public function getItems(): array |
||
56 | |||
57 | /** |
||
58 | * Reset collection. |
||
59 | * @return Model |
||
60 | */ |
||
61 | public function rewind(): Model |
||
65 | |||
66 | /** |
||
67 | * @return Model |
||
68 | */ |
||
69 | public function current(): Model |
||
73 | |||
74 | /** |
||
75 | * @return int|null|string |
||
76 | */ |
||
77 | public function key() |
||
81 | |||
82 | /** |
||
83 | * {@inheritDoc} |
||
84 | */ |
||
85 | public function next() |
||
89 | |||
90 | /** |
||
91 | * @return bool |
||
92 | */ |
||
93 | public function valid(): bool |
||
97 | |||
98 | /** |
||
99 | * Count elements of an object |
||
100 | * @return int The custom count as an integer. |
||
101 | * The return value is cast to an integer. |
||
102 | */ |
||
103 | public function count(): int |
||
107 | } |
||
108 |