Passed
Push — develop ( 2fd44e...eb8080 )
by Daniel
06:05
created

Layout   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 90
Duplicated Lines 0 %

Test Coverage

Coverage 68.42%

Importance

Changes 0
Metric Value
dl 0
loc 90
ccs 13
cts 19
cp 0.6842
rs 10
c 0
b 0
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getNavBar() 0 3 1
A getClassName() 0 3 1
A setDefault() 0 3 1
A getId() 0 3 1
A setClassName() 0 3 1
A isDefault() 0 3 1
A __construct() 0 3 1
A setNavBar() 0 3 1
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"})
37
     * @var null|NavBar
38
     */
39
    private $navBar;
40
41
    /**
42
     * @ORM\Column(nullable=true)
43
     * @Groups({"layout"})
44
     * @var null|string
45
     */
46
    private $className;
47
48 5
    public function __construct()
49
    {
50 5
        $this->id = Uuid::uuid4()->getHex();
51 5
    }
52
53
    /**
54
     * @return string
55
     */
56
    public function getId(): string
57
    {
58
        return $this->id;
59
    }
60
61
    /**
62
     * @return bool
63
     */
64 1
    public function isDefault(): bool
65
    {
66 1
        return $this->default;
67
    }
68
69
    /**
70
     * @param bool $default
71
     */
72 3
    public function setDefault(bool $default): void
73
    {
74 3
        $this->default = $default;
75 3
    }
76
77
    /**
78
     * @return null|NavBar
79
     */
80 1
    public function getNavBar(): ?NavBar
81
    {
82 1
        return $this->navBar;
83
    }
84
85
    /**
86
     * @param null|NavBar $navBar
87
     */
88 1
    public function setNavBar(?NavBar $navBar): void
89
    {
90 1
        $this->navBar = $navBar;
91 1
    }
92
93
    /**
94
     * @return null|string
95
     */
96
    public function getClassName(): ?string
97
    {
98
        return $this->className;
99
    }
100
101
    /**
102
     * @param null|string $className
103
     */
104
    public function setClassName(?string $className): void
105
    {
106
        $this->className = $className;
107
    }
108
}
109