Menu::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace kalanis\kw_menu\Menu;
4
5
6
/**
7
 * Class Menu
8
 * @package kalanis\kw_menu\Menu
9
 * Menu header
10
 */
11
class Menu
12
{
13
    protected string $file = '';
14
    protected string $name = '';
15
    protected string $title = '';
16
    protected int $displayCount = 0;
17
    /** @var Entry[] */
18
    protected array $entries = [];
19
20 2
    public function clear(): self
21
    {
22 2
        return $this->setData('', '', '', 0);
23
    }
24
25 15
    public function setData(string $file, string $name, string $title, int $count): self
26
    {
27 15
        $this->name = strval($name);
28 15
        $this->title = strval($title);
29 15
        $this->file = strval($file);
30 15
        $this->displayCount = intval($count);
31 15
        $this->entries = [];
32 15
        return $this;
33
    }
34
35 12
    public function addItem(Entry $entry): self
36
    {
37 12
        $this->entries[$entry->getId()] = $entry;
38 12
        return $this;
39
    }
40
41 13
    public function getName(): string
42
    {
43 13
        return strval($this->name);
44
    }
45
46 15
    public function getTitle(): string
47
    {
48 15
        return strval($this->title);
49
    }
50
51 17
    public function getFile(): string
52
    {
53 17
        return strval($this->file);
54
    }
55
56 13
    public function getDisplayCount(): int
57
    {
58 13
        return intval($this->displayCount);
59
    }
60
61
    /**
62
     * @return Entry[]
63
     */
64 16
    public function getEntries(): array
65
    {
66 16
        return $this->entries;
67
    }
68
}
69