setL11n($name); } /** * @return string * * @since 1.0.0 */ public function getL11n() : string { return $this->title instanceof BaseStringL11n ? $this->title->content : $this->title; } /** * Set title * * @param string|BaseStringL11n $title Media article title * @param string $lang Language * * @return void * * @since 1.0.0 */ public function setL11n(string | BaseStringL11n $title, string $lang = ISO639x1Enum::_EN) : void { if ($title instanceof BaseStringL11n) { $this->title = $title; } elseif ($this->title instanceof BaseStringL11n) { $this->title->content = $title; } else { $this->title = new BaseStringL11n(); $this->title->ref = $this->id; $this->title->content = $title; $this->title->language = $lang; } } /** * {@inheritdoc} */ public function toArray() : array { return [ 'id' => $this->id, 'title' => $this->title, 'name' => $this->name, ]; } /** * {@inheritdoc} */ public function jsonSerialize() : mixed { return $this->toArray(); } }