AbstractElement   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 42
rs 10
c 0
b 0
f 0
ccs 8
cts 8
cp 1
wmc 4
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 6 1
A getView() 0 4 1
A setView() 0 6 2
1
<?php
2
namespace Malezha\Menu\Element;
3
4
use Malezha\Menu\Contracts\Element;
5
use Malezha\Menu\Contracts\MenuRender;
6
use Serafim\Properties\Properties;
7
8
/**
9
 * Class AbstractElement
10
 * @package Malezha\Menu\Element
11
 */
12
abstract class AbstractElement implements Element
13
{
14
    use Properties;
15
16
    /**
17
     * @var string
18
     */
19
    protected $view;
20
21
    /**
22
     * @var MenuRender
23
     */
24
    protected $render;
25
26
    /**
27
     * @inheritdoc
28
     */
29 1
    public function getView()
30
    {
31 1
        return $this->view;
32
    }
33
34
    /**
35
     * @inheritdoc
36
     */
37 1
    public function setView($view)
38
    {
39 1
        if ($this->render->exists($view)) {
40 1
            $this->view = $view;
41
        }
42 1
    }
43
44
    /**
45
     * @inheritDoc
46
     */
47 3
    public function toArray()
48
    {
49
        return [
50 3
            'view' => $this->view,
51
        ];
52
    }
53
}