Completed
Push — master ( 01cdd8...cceadc )
by Mikołaj
02:40
created

View::getMenuCollection()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 1
nop 0
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
1
<?php
2
3
namespace Rudolf\Modules\Dashboard;
4
5
use Rudolf\Component\Helpers\Navigation\MenuItem;
6
use Rudolf\Framework\View\AdminView;
7
8
class View extends AdminView
9
{
10
    public function dashboard()
11
    {
12
        $this->pageTitle = _('Dashboard');
13
        $this->head->setTitle($this->pageTitle);
14
15
        $this->template = 'dashboard';
16
    }
17
18
    public function getMenuCollection()
19
    {
20
        $items = array_filter($this->getMenuItems()->getAll(), function($a) {
21
            /** @var MenuItem $a */
22
            return 0 === $a->getParentId() && 'main' === $a->getType();
23
        });
24
25
        usort($items, function($a, $b) {
26
            /** @var MenuItem $a */
27
            /** @var MenuItem $b */
28
            return $a->getPosition() > $b->getPosition();
29
        });
30
31
        return $items;
32
    }
33
}
34