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

PublishableTrait::setPublishedDate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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