Test Failed
Push — develop ( 05150f...e72854 )
by Daniel
04:23
created

PublishableTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 9
dl 0
loc 50
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setPublishedDate() 0 4 1
A setPublished() 0 4 1
A getPublishedDate() 0 3 1
A isPublished() 0 3 1
1
<?php
2
3
namespace Silverback\ApiComponentBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Symfony\Component\Serializer\Annotation\Groups;
7
8
trait PublishableTrait
9
{
10
    /**
11
     * @ORM\Column(type="boolean", nullable=false)
12
     * @var bool
13
     * @Groups({"default"})
14
     */
15
    protected $published = true;
16
17
    /**
18
     * @ORM\Column(type="datetime", nullable=true)
19
     * @var null|\DateTime
20
     * @Groups({"default"})
21
     */
22
    protected $publishedDate;
23
24
    /**
25
     * @return bool
26
     */
27
    public function isPublished(): bool
28
    {
29
        return $this->published;
30
    }
31
32
    /**
33
     * @param bool $published
34
     * @return static
35
     */
36
    public function setPublished(bool $published)
37
    {
38
        $this->published = $published;
39
        return $this;
40
    }
41
42
    /**
43
     * @return \DateTime|null
44
     */
45
    public function getPublishedDate(): ?\DateTime
46
    {
47
        return $this->publishedDate;
48
    }
49
50
    /**
51
     * @param \DateTime|null $publishedDate
52
     * @return static
53
     */
54
    public function setPublishedDate(\DateTime $publishedDate)
55
    {
56
        $this->publishedDate = $publishedDate;
57
        return $this;
58
    }
59
}
60