| Total Complexity | 6 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | trait PublishableTrait |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * @Assert\NotNull |
||
| 25 | */ |
||
| 26 | private ?\DateTimeInterface $publishedAt = null; |
||
| 27 | |||
| 28 | private ?self $publishedResource = null; |
||
| 29 | |||
| 30 | /** @return static */ |
||
| 31 | public function setPublishedAt(?\DateTimeInterface $publishedAt) |
||
| 32 | { |
||
| 33 | $this->publishedAt = $publishedAt; |
||
| 34 | |||
| 35 | return $this; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function getPublishedAt(): ?\DateTimeInterface |
||
| 39 | { |
||
| 40 | return $this->publishedAt; |
||
| 41 | } |
||
| 42 | |||
| 43 | public function isPublished(): bool |
||
| 44 | { |
||
| 45 | return null !== $this->publishedAt && new \DateTimeImmutable() >= $this->publishedAt; |
||
| 46 | } |
||
| 47 | |||
| 48 | /** @return static */ |
||
| 49 | public function setPublishedResource($publishedResource) |
||
| 50 | { |
||
| 51 | $this->publishedResource = $publishedResource; |
||
| 52 | |||
| 53 | return $this; |
||
| 54 | } |
||
| 55 | |||
| 56 | public function getPublishedResource(): ?self |
||
| 59 | } |
||
| 60 | } |
||
| 61 |