name = $name; } /** * Set l11n * * @param string|BaseStringL11n $l11n Tag article l11n * @param string $lang Language * * @return void * * @since 1.0.0 */ public function setL11n(string | BaseStringL11n $l11n, string $lang = ISO639x1Enum::_EN) : void { if ($l11n instanceof BaseStringL11n) { $this->l11n = $l11n; } elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) { $this->l11n->content = $l11n; $this->l11n->language = $lang; } else { $this->l11n = new BaseStringL11n(); $this->l11n->content = $l11n; $this->l11n->ref = $this->id; $this->l11n->language = $lang; } } /** * @return string * * @since 1.0.0 */ public function getL11n() : string { if (!isset($this->l11n)) { return ''; } return $this->l11n instanceof BaseStringL11n ? $this->l11n->content : $this->l11n; } /** * Add rendering template * * @param Collection $template Template * * @return void * * @since 1.0.0 */ public function addTemplate(Collection $template) : void { $this->templates[] = $template; } /** * Get templates * * @return Collection[] * * @since 1.0.0 */ public function getTemplates() : array { return $this->templates; } /** * {@inheritdoc} */ public function toArray() : array { return [ 'id' => $this->id, 'numberFormat' => $this->numberFormat, 'transferType' => $this->transferType, ]; } /** * {@inheritdoc} */ public function jsonSerialize() : mixed { return $this->toArray(); } }