Completed
Push — develop ( fa4b42...772557 )
by Daniel
06:08
created

Layout::getNavBar()   A

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 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Silverback\ApiComponentBundle\Entity\Layout;
4
5
use ApiPlatform\Core\Annotation\ApiResource;
6
use Doctrine\ORM\Mapping as ORM;
7
use Ramsey\Uuid\Uuid;
8
use Silverback\ApiComponentBundle\Entity\Content\Component\Navigation\NavBar\NavBar;
9
use Symfony\Component\Serializer\Annotation\Groups;
10
11
/**
12
 * Class Layout
13
 * @package Silverback\ApiComponentBundle\Entity\Layout
14
 * @ApiResource()
15
 * @ORM\Entity(repositoryClass="Silverback\ApiComponentBundle\Repository\LayoutRepository")
16
 */
17
class Layout
18
{
19
    /**
20
     * @ORM\Id()
21
     * @ORM\Column(type="string")
22
     * @var string
23
     */
24
    private $id;
25
26
    /**
27
     * @ORM\Column(type="boolean", name="is_default")
28
     * @Groups({"layout"})
29
     * @var bool
30
     */
31
    private $default = false;
32
33
    /**
34
     * @ORM\ManyToOne(targetEntity="Silverback\ApiComponentBundle\Entity\Content\Component\Navigation\NavBar\NavBar")
35
     * @ORM\JoinColumn(onDelete="SET NULL")
36
     * @Groups({"layout", "default"})
37
     * @var null|NavBar
38
     */
39
    private $navBar;
40
41 4
    public function __construct()
42
    {
43 4
        $this->id = Uuid::uuid4()->getHex();
44 4
    }
45
46
    /**
47
     * @return string
48
     */
49
    public function getId(): string
50
    {
51
        return $this->id;
52
    }
53
54
    /**
55
     * @return bool
56
     */
57 1
    public function isDefault(): bool
58
    {
59 1
        return $this->default;
60
    }
61
62
    /**
63
     * @param bool $default
64
     */
65 2
    public function setDefault(bool $default): void
66
    {
67 2
        $this->default = $default;
68 2
    }
69
70
    /**
71
     * @return null|NavBar
72
     */
73 1
    public function getNavBar(): ?NavBar
74
    {
75 1
        return $this->navBar;
76
    }
77
78
    /**
79
     * @param null|NavBar $navBar
80
     */
81 1
    public function setNavBar(?NavBar $navBar): void
82
    {
83 1
        $this->navBar = $navBar;
84 1
    }
85
}
86