Entry   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 24
c 0
b 0
f 0
dl 0
loc 60
ccs 26
cts 26
cp 1
rs 10
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A canGoSub() 0 3 1
A getPosition() 0 3 1
A setPosition() 0 4 1
A getName() 0 3 1
A addSubmenu() 0 4 1
A setData() 0 9 1
A getSubmenu() 0 3 1
A getDesc() 0 3 1
1
<?php
2
3
namespace kalanis\kw_menu\Menu;
4
5
6
/**
7
 * Class Entry
8
 * @package kalanis\kw_menu\Menu
9
 * Menu entries
10
 */
11
class Entry
12
{
13
    protected string $id = '';
14
    protected string $name = '';
15
    protected string $desc = '';
16
    protected int $position = 0;
17
    protected bool $goSub = false;
18
    protected ?Menu $submenu = null;
19
20 16
    public function setData(string $id, string $name, string $desc, int $position, bool $goSub = false): self
21
    {
22 16
        $this->id = $id;
23 16
        $this->name = $name;
24 16
        $this->desc = $desc;
25 16
        $this->position = $position;
26 16
        $this->goSub = $goSub;
27 16
        $this->submenu = null;
28 16
        return $this;
29
    }
30
31 3
    public function setPosition(int $position): self
32
    {
33 3
        $this->position = $position;
34 3
        return $this;
35
    }
36
37 1
    public function addSubmenu(?Menu $menu): self
38
    {
39 1
        $this->submenu = $menu;
40 1
        return $this;
41
    }
42
43 13
    public function getId(): string
44
    {
45 13
        return $this->id;
46
    }
47
48 9
    public function getName(): string
49
    {
50 9
        return $this->name;
51
    }
52
53 9
    public function getDesc(): string
54
    {
55 9
        return $this->desc;
56
    }
57
58 14
    public function getPosition(): int
59
    {
60 14
        return $this->position;
61
    }
62
63 9
    public function canGoSub(): bool
64
    {
65 9
        return $this->goSub;
66
    }
67
68 2
    public function getSubmenu(): ?Menu
69
    {
70 2
        return $this->submenu;
71
    }
72
}
73