Passed
Push — develop ( 653998...1c9254 )
by Daniel
05:33
created

AbstractNavigationItem::getFragment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Silverback\ApiComponentBundle\Entity\Component\Navigation;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Silverback\ApiComponentBundle\Entity\Component\AbstractComponent;
7
use Silverback\ApiComponentBundle\Entity\Route\Route;
8
use Symfony\Component\Serializer\Annotation\Groups;
9
10
/**
11
 * Class AbstractNavigationItem
12
 * @package Silverback\ApiComponentBundle\Entity\Navigation
13
 * @author Daniel West <[email protected]>
14
 */
15
abstract class AbstractNavigationItem extends AbstractComponent implements NavigationItemInterface
16
{
17
    /**
18
     * @ORM\Column()
19
     * @Groups({"layout", "component", "component_item"})
20
     * @var string
21
     */
22
    protected $label;
23
24
    /**
25
     * @ORM\ManyToOne(targetEntity="Silverback\ApiComponentBundle\Entity\Route\Route")
26
     * @ORM\JoinColumn(referencedColumnName="route")
27
     * @Groups({"layout", "component", "component_item"})
28
     * @var null|Route
29
     */
30
    protected $route;
31
32
    /**
33
     * @ORM\Column(nullable=true)
34
     * @Groups({"layout", "component", "component_item"})
35
     * @var null|string
36
     */
37
    protected $fragment;
38
39
    /**
40
     * @return string
41
     */
42 3
    public function getLabel(): string
43
    {
44 3
        return $this->label;
45
    }
46
47
    /**
48
     * @param string $label
49
     * @return AbstractNavigationItem
50
     */
51 4
    public function setLabel(string $label): AbstractNavigationItem
52
    {
53 4
        $this->label = $label;
54 4
        return $this;
55
    }
56
57
    /**
58
     * @return null|Route
59
     */
60
    public function getRoute(): ?Route
61
    {
62
        return $this->route;
63
    }
64
65
    /**
66
     * @param null|Route $route
67
     * @return AbstractNavigationItem
68
     */
69 4
    public function setRoute(?Route $route): AbstractNavigationItem
70
    {
71 4
        $this->route = $route;
72 4
        return $this;
73
    }
74
75
    /**
76
     * @return null|string
77
     */
78
    public function getFragment(): ?string
79
    {
80
        return $this->fragment;
81
    }
82
83
    /**
84
     * @param null|string $fragment
85
     * @return AbstractNavigationItem
86
     */
87 4
    public function setFragment(?string $fragment): AbstractNavigationItem
88
    {
89 4
        $this->fragment = $fragment;
90 4
        return $this;
91
    }
92
}
93