1 | <?php |
||
5 | class LoopFactory |
||
6 | { |
||
7 | /** |
||
8 | * The stack of Loop instances |
||
9 | * |
||
10 | * @var Loop[] $stack |
||
11 | */ |
||
12 | protected $stack = []; |
||
13 | |||
14 | /** |
||
15 | * Creates a new loop with the given array and adds it to the stack |
||
16 | * |
||
17 | * @param array $items The array that will be iterated |
||
18 | * @return Loop |
||
19 | 15 | */ |
|
20 | public function newLoop($items) |
||
33 | 3 | ||
34 | 3 | /** |
|
35 | * Should be called after the loop has finished |
||
36 | 15 | * |
|
37 | 15 | * @param $loop |
|
38 | */ |
||
39 | public function endLoop(&$loop) |
||
51 | |||
52 | /** |
||
53 | * To be called first inside the foreach loop. Returns the current loop |
||
54 | 15 | * |
|
55 | * @return Loop $current The current loop data |
||
56 | 15 | */ |
|
57 | public function loop() |
||
64 | } |
||
65 |