Total Complexity | 3 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
5 | trait AbstractCollection |
||
6 | { |
||
7 | /** |
||
8 | * The collection items. |
||
9 | * |
||
10 | * @var array |
||
11 | */ |
||
12 | protected $items = []; |
||
13 | |||
14 | /** |
||
15 | * The collection items keys. |
||
16 | * |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $keys = []; |
||
20 | |||
21 | /** |
||
22 | * Determines if lazy loading was already initiated. |
||
23 | * |
||
24 | * @var bool |
||
25 | */ |
||
26 | protected $lazyLoadInitiated = false; |
||
27 | |||
28 | /** |
||
29 | * Performs lazy iterator items load. |
||
30 | */ |
||
31 | abstract public function lazyLoad(); |
||
32 | |||
33 | /** |
||
34 | * Generates item keys. |
||
35 | */ |
||
36 | abstract public function generateKeys(); |
||
37 | |||
38 | /** |
||
39 | * Performs lazy load checks and loads items if required. |
||
40 | */ |
||
41 | protected function checkLazyLoad() |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * Determines if lazy load was already initiated. |
||
55 | * |
||
56 | * @return bool |
||
57 | */ |
||
58 | protected function lazyLoadInitiated(): bool |
||
63 |