Code Duplication    Length = 25-25 lines in 2 locations

module/UIComponents/src/UIComponents/View/Helper/Components/Toolbar.php 1 location

@@ 121-145 (lines=25) @@
118
            $depth = $iterator->getDepth();
119
            $page->set('level', $depth);
120
            $isActive = $page->isActive(true);
121
            if ($depth < $minDepth || !$this->accept($page)) {
122
                // page is below minDepth or not accepted by acl/visibility
123
                continue;
124
            } elseif ($onlyActive && !$isActive) {
125
                // page is not active itself, but might be in the active branch
126
                $accept = false;
127
                if ($foundPage) {
128
                    if ($foundPage->hasPage($page)) {
129
                        // accept if page is a direct child of the active page
130
                        $accept = true;
131
                    } elseif ($foundPage->getParent()->hasPage($page)) {
132
                        // page is a sibling of the active page...
133
                        if (!$foundPage->hasPages(!$this->renderInvisible) ||
134
                            is_int($maxDepth) && $foundDepth + 1 > $maxDepth) {
135
                            // accept if active page has no children, or the
136
                            // children are too deep to be rendered
137
                            $accept = true;
138
                        }
139
                    }
140
                }
141
142
                if (!$accept) {
143
                    continue;
144
                }
145
            }
146
147
            // make sure indentation is correct
148
            $depth -= $minDepth;

module/UIComponents/src/UIComponents/View/Helper/Navigation/Menu.php 1 location

@@ 234-258 (lines=25) @@
231
            $depth = $iterator->getDepth();
232
            $page->set('level', $depth);
233
            $isActive = $page->isActive(true);
234
            if ($depth < $minDepth || !$this->accept($page)) {
235
                // page is below minDepth or not accepted by acl/visibility
236
                continue;
237
            } elseif ($onlyActive && !$isActive) {
238
                // page is not active itself, but might be in the active branch
239
                $accept = false;
240
                if ($foundPage) {
241
                    if ($foundPage->hasPage($page)) {
242
                        // accept if page is a direct child of the active page
243
                        $accept = true;
244
                    } elseif ($foundPage->getParent()->hasPage($page)) {
245
                        // page is a sibling of the active page...
246
                        if (!$foundPage->hasPages(!$this->renderInvisible) ||
247
                            is_int($maxDepth) && $foundDepth + 1 > $maxDepth) {
248
                            // accept if active page has no children, or the
249
                            // children are too deep to be rendered
250
                            $accept = true;
251
                        }
252
                    }
253
                }
254
255
                if (!$accept) {
256
                    continue;
257
                }
258
            }
259
260
            // make sure indentation is correct
261
            $depth -= $minDepth;