| Total Complexity | 4 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 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) |
||
| 58 | } |
||
| 59 | } |
||
| 60 |