Entry   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
c 0
b 0
f 0
dl 0
loc 54
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setWeight() 0 5 1
A getWeight() 0 3 1
A setUrl() 0 5 1
A setName() 0 5 1
A getUrl() 0 3 1
A getName() 0 3 1
1
<?php
2
3
/**
4
 * This file is part of Cecil.
5
 *
6
 * (c) Arnaud Ligny <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Cecil\Collection\Menu;
15
16
use Cecil\Collection\Item;
17
18
/**
19
 * Menu entry class.
20
 *
21
 * Represents a menu entry in a collection, providing methods to set and get the entry's name, URL, and weight.
22
 */
23
class Entry extends Item
24
{
25
    /**
26
     * Set the menu entry name.
27
     */
28
    public function setName(string $value): self
29
    {
30
        $this->offsetSet('name', $value);
31
32
        return $this;
33
    }
34
35
    /**
36
     * Get menu entry name.
37
     */
38
    public function getName(): ?string
39
    {
40
        return $this->offsetGet('name');
41
    }
42
43
    /**
44
     * Set the menu entry URL.
45
     */
46
    public function setUrl(?string $value = null): self
47
    {
48
        $this->offsetSet('url', $value);
49
50
        return $this;
51
    }
52
53
    /**
54
     * Get menu entry URL.
55
     */
56
    public function getUrl(): ?string
57
    {
58
        return $this->offsetGet('url');
59
    }
60
61
    /**
62
     * Set menu entry weight.
63
     */
64
    public function setWeight(int $value): self
65
    {
66
        $this->offsetSet('weight', $value);
67
68
        return $this;
69
    }
70
71
    /**
72
     * Get menu entry weight.
73
     */
74
    public function getWeight(): ?int
75
    {
76
        return $this->offsetGet('weight');
77
    }
78
}
79