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