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

MenuView   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 22
rs 10
wmc 2
lcom 1
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A display() 0 9 1
A createMenu() 0 7 1
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