1 | <?php |
||
5 | class Loop |
||
6 | { |
||
7 | |||
8 | /** |
||
9 | * The array that is being iterated |
||
10 | * |
||
11 | * @var array |
||
12 | */ |
||
13 | protected $items = []; |
||
14 | |||
15 | /** |
||
16 | * The data for the current $loop item |
||
17 | * |
||
18 | * @var array |
||
19 | */ |
||
20 | protected $data; |
||
21 | |||
22 | /** |
||
23 | * The parent loop, if any |
||
24 | * |
||
25 | * @var Loop |
||
26 | */ |
||
27 | protected $parentLoop; |
||
28 | |||
29 | protected $loopFactory; |
||
30 | |||
31 | /** |
||
32 | * Sets the parent loop |
||
33 | * |
||
34 | * @param Loop $parentLoop |
||
35 | * {@inheritdocs} |
||
36 | */ |
||
37 | public function setParentLoop(Loop $parentLoop) |
||
42 | |||
43 | /** |
||
44 | * Returns the full loop stack of the LoopFactory |
||
45 | * |
||
46 | * @return array |
||
47 | */ |
||
48 | public function getLoopStack() |
||
52 | |||
53 | /** |
||
54 | * Resets the loop stack of the LoopFactory |
||
55 | */ |
||
56 | public function resetLoopStack() |
||
60 | |||
61 | /** |
||
62 | * Instantiates the class |
||
63 | * |
||
64 | * @param array $items The array that's being iterated |
||
65 | */ |
||
66 | public function __construct(LoopFactory $loopFactory, $items) |
||
71 | |||
72 | /** |
||
73 | * Sets the array to monitor |
||
74 | * |
||
75 | * @param array $items The array that's being iterated |
||
76 | */ |
||
77 | public function setItems($items) |
||
96 | |||
97 | public function getItems() |
||
101 | |||
102 | /** |
||
103 | * Magic method to access the loop data properties |
||
104 | * |
||
105 | * @param $key |
||
106 | * |
||
107 | * @return mixed |
||
108 | */ |
||
109 | public function __get($key) |
||
113 | |||
114 | /** |
||
115 | * To be called first in a loop before anything else |
||
116 | */ |
||
117 | public function before() |
||
137 | |||
138 | /** |
||
139 | * To be called last in a loop after everything else |
||
140 | */ |
||
141 | public function after() |
||
148 | } |
||
149 |
This check looks for calls to
isset(...)
orempty()
on variables that are yet undefined. These calls will always produce the same result and can be removed.This is most likely caused by the renaming of a variable or the removal of a function/method parameter.