File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ public function add($entry) {
7070 $ this ->closureEntries [] = $ entry ;
7171 return ;
7272 }
73- $ this ->init ();
73+ $ this ->init (false );
7474
7575 $ id = $ entry ['id ' ];
7676
@@ -106,10 +106,6 @@ public function add($entry) {
106106 */
107107 public function getAll (string $ type = 'link ' ): array {
108108 $ this ->init ();
109- foreach ($ this ->closureEntries as $ c ) {
110- $ this ->add ($ c ());
111- }
112- $ this ->closureEntries = [];
113109
114110 $ result = $ this ->entries ;
115111 if ($ type !== 'all ' ) {
@@ -195,7 +191,13 @@ public function getActiveEntry() {
195191 return $ this ->activeEntry ;
196192 }
197193
198- private function init () {
194+ private function init (bool $ resolveClosures = true ): void {
195+ if ($ resolveClosures ) {
196+ while ($ c = array_pop ($ this ->closureEntries )) {
197+ $ this ->add ($ c ());
198+ }
199+ }
200+
199201 if ($ this ->init ) {
200202 return ;
201203 }
You can’t perform that action at this time.
0 commit comments