owner ?? new NullAccount(); } /** * Set created by * * @param Account $id Created by * * @return void * * @since 1.0.0 */ public function setOwner(Account $id) : void { $this->owner = $id; } /** * Get type. * * @return int * * @since 1.0.0 */ public function getType() : int { return $this->type; } /** * Set type. * * @param int $type Tag type * * @return void * * @since 1.0.0 */ public function setType(int $type = TagType::SINGLE) : void { $this->type = $type; } /** * Get color * * @return string * * @since 1.0.0 */ public function getColor() : string { return $this->color; } /** * Set color * * @param string $color Tag article color * * @return void * * @since 1.0.0 */ public function setColor(string $color) : void { $this->color = $color; } /** * Get id * * @return int * * @since 1.0.0 */ public function getId() : int { return $this->id; } /** * @return string * * @since 1.0.0 */ public function getTitle() : string { return $this->title instanceof TagL11n ? $this->title->title : $this->title; } /** * Set title * * @param string|TagL11n $title Tag article title * @param string $lang Language * * @return void * * @since 1.0.0 */ public function setTitle($title, string $lang = ISO639x1Enum::_EN) : void { if ($title instanceof TagL11n) { $this->title = $title; } elseif ($this->title instanceof TagL11n && \is_string($title)) { $this->title->title = $title; } elseif (\is_string($title)) { $this->title = new TagL11n(); $this->title->title = $title; $this->title->setLanguage($lang); } } /** * {@inheritdoc} */ public function toArray() : array { return [ 'id' => $this->id, 'title' => $this->title, 'color' => $this->color, 'type' => $this->type, 'owner' => $this->owner, ]; } /** * {@inheritdoc} */ public function jsonSerialize() { return $this->toArray(); } }