Completed
Push — develop ( e326d5...b2cbdf )
by Daniel
09:21
created

Layout::getClassName()   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 1
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Silverback\ApiComponentBundle\Entity\Layout;
6
7
use Doctrine\ORM\Mapping as ORM;
8
use Ramsey\Uuid\Uuid;
9
use Silverback\ApiComponentBundle\Entity\Component\Navigation\NavBar\NavBar;
10
use Symfony\Component\Serializer\Annotation\Groups;
11
12
/**
13
 * Class Layout
14
 * @package Silverback\ApiComponentBundle\Entity\Layout
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\Component\Navigation\NavBar\NavBar")
35
     * @ORM\JoinColumn(onDelete="SET NULL")
36
     * @Groups({"layout", "route"})
37
     * @var null|NavBar
38
     */
39
    private $navBar;
40
41
    /**
42
     * @ORM\Column(nullable=true)
43
     * @Groups({"layout"})
44
     * @var null|string
45
     */
46 1
    private $className;
47
48 1
    public function __construct()
49 1
    {
50
        $this->id = Uuid::uuid4()->getHex();
51
    }
52
53
    /**
54
     * @return string
55
     */
56
    public function getId(): string
57
    {
58
        return $this->id;
59
    }
60
61
    /**
62
     * @return bool
63
     */
64
    public function isDefault(): bool
65
    {
66
        return $this->default;
67
    }
68
69
    /**
70
     * @param bool $default
71
     * @return Layout
72
     */
73
    public function setDefault(bool $default): self
74
    {
75
        $this->default = $default;
76
        return $this;
77
    }
78
79
    /**
80
     * @return null|NavBar
81
     */
82
    public function getNavBar(): ?NavBar
83
    {
84
        return $this->navBar;
85
    }
86
87
    /**
88
     * @param null|NavBar $navBar
89
     * @return Layout
90
     */
91
    public function setNavBar(?NavBar $navBar): self
92
    {
93
        $this->navBar = $navBar;
94
        return $this;
95
    }
96
97
    /**
98
     * @return null|string
99
     */
100
    public function getClassName(): ?string
101
    {
102
        return $this->className;
103
    }
104
105
    /**
106
     * @param null|string $className
107
     * @return Layout
108
     */
109
    public function setClassName(?string $className): self
110
    {
111
        $this->className = $className;
112
        return $this;
113
    }
114
}
115