app = new NullWikiApp(); } /** * Get id. * * @return int Model id * * @since 1.0.0 */ public function getId() : int { return $this->id; } /** * Get app * * @return WikiApp * * @since 1.0.0 */ public function getApp() : WikiApp { return $this->app ?? new NullWikiApp(); } /** * Set app * * @param null|WikiApp $app App * * @return void * * @since 1.0.0 */ public function setApp(?WikiApp $app) : void { $this->app = $app; } /** * Get name * * @return string * * @since 1.0.0 */ public function getName() : string { return $this->name instanceof WikiCategoryL11n ? $this->name->getName() : $this->name; } /** * Set name * * @param string|TagL11n $name Tag article name * * @return void * * @since 1.0.0 */ public function setName($name, string $lang = ISO639x1Enum::_EN) : void { if ($name instanceof WikiCategoryL11n) { $this->name = $name; } elseif ($this->name instanceof WikiCategoryL11n && \is_string($name)) { $this->name->setName($name); } elseif (\is_string($name)) { $this->name = new WikiCategoryL11n(); $this->name->setName($name); $this->name->setLanguage($lang); } } /** * Get parent category * * @return self * * @since 1.0.0 */ public function getParent() : self { return $this->parent ?? new NullWikiCategory(); } /** * Set parent category * * @param null|self $parent Parent category * * @return void * * @since 1.0.0 */ public function setParent(?self $parent) : void { $this->parent = $parent; } /** * {@inheritdoc} */ public function toArray() : array { return [ 'id' => $this->id, 'app' => $this->app, 'name' => $this->name, ]; } /** * {@inheritdoc} */ public function jsonSerialize() { return $this->toArray(); } }