Passed
Push — develop ( 0112d6...38c008 )
by Daniel
05:14
created

Layout::setDefault()   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 1
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 Doctrine\ORM\Mapping as ORM;
6
use Ramsey\Uuid\Uuid;
7
use Silverback\ApiComponentBundle\Entity\Content\Component\Navigation\NavBar\NavBar;
8
use Symfony\Component\Serializer\Annotation\Groups;
9
10
/**
11
 * Class Layout
12
 * @package Silverback\ApiComponentBundle\Entity\Layout
13
 * @ORM\Entity(repositoryClass="Silverback\ApiComponentBundle\Repository\LayoutRepository")
14
 */
15
class Layout
16
{
17
    /**
18
     * @ORM\Id()
19
     * @ORM\Column(type="string")
20
     * @var string
21
     */
22
    private $id;
23
24
    /**
25
     * @ORM\Column(type="boolean", name="is_default")
26
     * @Groups({"layout"})
27
     * @var bool
28
     */
29
    private $default = false;
30
31
    /**
32
     * @ORM\ManyToOne(targetEntity="Silverback\ApiComponentBundle\Entity\Content\Component\Navigation\NavBar\NavBar")
33
     * @ORM\JoinColumn(onDelete="SET NULL")
34
     * @Groups({"layout", "route"})
35
     * @var null|NavBar
36
     */
37
    private $navBar;
38
39
    /**
40
     * @ORM\Column(nullable=true)
41
     * @Groups({"layout"})
42
     * @var null|string
43
     */
44
    private $className;
45
46 5
    public function __construct()
47
    {
48 5
        $this->id = Uuid::uuid4()->getHex();
49 5
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getId(): string
55
    {
56
        return $this->id;
57
    }
58
59
    /**
60
     * @return bool
61
     */
62 1
    public function isDefault(): bool
63
    {
64 1
        return $this->default;
65
    }
66
67
    /**
68
     * @param bool $default
69
     */
70 3
    public function setDefault(bool $default): void
71
    {
72 3
        $this->default = $default;
73 3
    }
74
75
    /**
76
     * @return null|NavBar
77
     */
78 1
    public function getNavBar(): ?NavBar
79
    {
80 1
        return $this->navBar;
81
    }
82
83
    /**
84
     * @param null|NavBar $navBar
85
     */
86 1
    public function setNavBar(?NavBar $navBar): void
87
    {
88 1
        $this->navBar = $navBar;
89 1
    }
90
91
    /**
92
     * @return null|string
93
     */
94
    public function getClassName(): ?string
95
    {
96
        return $this->className;
97
    }
98
99
    /**
100
     * @param null|string $className
101
     */
102
    public function setClassName(?string $className): void
103
    {
104
        $this->className = $className;
105
    }
106
}
107