Completed
Push — master ( d015d4...c50906 )
by Mikołaj
02:42
created

MenuView::display()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 9
rs 9.6666
1
<?php
2
3
namespace Rudolf\Modules\Appearance\Menu;
4
5
use Rudolf\Component\Helpers\Navigation\MenuItemCollection;
6
use Rudolf\Framework\View\AdminView;
7
8
class MenuView extends AdminView
9
{
10
    private $items;
11
12
    public function display(MenuItemCollection $items, $types)
13
    {
14
        $this->pageTitle = _('Menu editor');
15
        $this->head->setTitle($this->pageTitle);
16
        $this->items = $items;
17
        $this->types = $types;
0 ignored issues
show
Bug introduced by
The property types does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
18
19
        $this->template = 'appearance-menu-editor';
20
    }
21
22
    public function createMenu($type)
23
    {
24
        $nav = new Navigation();
25
        $nav->setType($type);
26
        $nav->setItems($this->items);
27
        return $nav->create();
28
    }
29
}
30