1 | <?php |
||
5 | class LoopFactory |
||
6 | { |
||
7 | |||
8 | /** |
||
9 | * The stack of Loop instances |
||
10 | * |
||
11 | * @var array $stack |
||
12 | */ |
||
13 | protected $stack = []; |
||
14 | |||
15 | /** |
||
16 | * Creates a new loop with the given array and adds it to the stack |
||
17 | * |
||
18 | * @param array $items The array that will be iterated |
||
19 | */ |
||
20 | public function newLoop($items) |
||
24 | |||
25 | /** |
||
26 | * Adds a Loop to the stack |
||
27 | * |
||
28 | * @param Loop $stackItem |
||
29 | */ |
||
30 | protected function addLoopStack(Loop $stackItem) |
||
39 | |||
40 | /** |
||
41 | * Returns the stack |
||
42 | * |
||
43 | * @return array |
||
44 | */ |
||
45 | public function getStack() |
||
49 | |||
50 | /** |
||
51 | * getLastStack method |
||
52 | * |
||
53 | * @return Loop |
||
54 | */ |
||
55 | public function getLastStack() |
||
59 | |||
60 | /** |
||
61 | * Resets the stack |
||
62 | */ |
||
63 | public function reset() |
||
67 | |||
68 | /** |
||
69 | * To be called first inside the foreach loop. Returns the current loop |
||
70 | * |
||
71 | * @return Loop $current The current loop data |
||
72 | */ |
||
73 | public function loop() |
||
80 | |||
81 | /** |
||
82 | * To be called before the end of the loop |
||
83 | */ |
||
84 | public function looped() |
||
90 | |||
91 | /** |
||
92 | * Should be called after the loop has finished |
||
93 | * |
||
94 | * @param $loop |
||
95 | */ |
||
96 | public function endLoop(&$loop) |
||
108 | } |
||
109 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.