createdAt = new \DateTime('NOW'); $this->publish = new \DateTime('NOW'); } public function getBadges() : array { return $this->badges; } public function addBadge(Badge $badge) /* : void */ { $this->badges[] = $badge; } /** * @return string * * @since 1.0.0 */ public function getContent() : string { return $this->content; } /** * @param string $content * * @return void * * @since 1.0.0 */ public function setContent(string $content) { $this->content = $content; } /** * @param string $plain * * @return void * * @since 1.0.0 */ public function setPlain(string $plain) { $this->plain = $plain; } /** * @return string * * @since 1.0.0 */ public function getPlain() : string { return $this->plain; } /** * @return \DateTime * * @since 1.0.0 */ public function getCreatedAt() : \DateTime { return $this->createdAt; } /** * @return int * * @since 1.0.0 */ public function getId() : int { return $this->id; } /** * @return string * * @since 1.0.0 */ public function getLanguage() : string { return $this->language; } /** * @return \DateTime * * @since 1.0.0 */ public function getPublish() : \DateTime { return $this->publish; } /** * @param string $language * * @return void * * @since 1.0.0 */ public function setLanguage(string $language) { if(!ISO639x1Enum::isValidValue($language)) { throw new InvalidEnumValue($language); } $this->language = $language; } /** * @param \DateTime $publish * * @return void * * @since 1.0.0 */ public function setPublish(\DateTime $publish) { $this->publish = $publish; } /** * @return int * * @since 1.0.0 */ public function getCreatedBy() { return $this->createdBy; } /** * @param int $id * * @since 1.0.0 */ public function setCreatedBy($id) { $this->createdBy = $id; } /** * @param \DateTime $createdAt * * @return void * * @since 1.0.0 */ public function setCreatedAt(\DateTime $createdAt) { $this->createdAt = $createdAt; } /** * @return string * * @since 1.0.0 */ public function getTitle() : string { return $this->title; } /** * @param string $title * * @return mixed * * @since 1.0.0 */ public function setTitle(string $title) { $this->title = $title; } /** * @return int * * @since 1.0.0 */ public function getType() : int { return $this->type; } /** * @param int $type * * @return void * * @since 1.0.0 */ public function setType(int $type) { if(!NewsType::isValidValue($type)) { throw new InvalidEnumValue($type); } $this->type = $type; } /** * @return int * * @since 1.0.0 */ public function getStatus() : int { return $this->status; } /** * @param int $status * * @return void * * @throws InvalidEnumValue * * @since 1.0.0 */ public function setStatus(int $status) { if(!NewsStatus::isValidValue($status)) { throw new InvalidEnumValue($status); } $this->status = $status; } /** * @return bool * * @since 1.0.0 */ public function isFeatured() : bool { return $this->featured; } /** * @param bool $featured * * @return void * * @since 1.0.0 */ public function setFeatured(bool $featured) { $this->featured = $featured; } public function toArray() : array { return [ 'id' => $this->id, 'title' => $this->title, 'plain' => $this->plain, 'content' => $this->content, 'type' => $this->type, 'status' => $this->status, 'featured' => $this->featured, 'publish' => $this->publish, 'createdAt' => $this->createdAt, 'createdBy' => $this->createdBy, ]; } public function __toString() { return json_encode($this->toArray()); } public function jsonSerialize() { return $this->toArray(); } }