setL11n($name); } /** * Get id * * @return int * * @since 1.0.0 */ public function getId() : int { return $this->id; } /** * Set l11n * * @param string|TicketAttributeTypeL11n $l11n Tag article l11n * @param string $lang Language * * @return void * * @since 1.0.0 */ public function setL11n(string | TicketAttributeTypeL11n $l11n, string $lang = ISO639x1Enum::_EN) : void { if ($l11n instanceof TicketAttributeTypeL11n) { $this->l11n = $l11n; } elseif (isset($this->l11n) && $this->l11n instanceof TicketAttributeTypeL11n) { $this->l11n->title = $l11n; } else { $this->l11n = new TicketAttributeTypeL11n(); $this->l11n->title = $l11n; $this->l11n->setLanguage($lang); } } /** * @return string * * @since 1.0.0 */ public function getL11n() : string { return $this->l11n instanceof TicketAttributeTypeL11n ? $this->l11n->title : $this->l11n; } /** * {@inheritdoc} */ public function toArray() : array { return [ 'id' => $this->id, 'name' => $this->name, 'fields' => $this->fields, 'custom' => $this->custom, 'validationPattern' => $this->validationPattern, 'isRequired' => $this->isRequired, ]; } /** * {@inheritdoc} */ public function jsonSerialize() { return $this->toArray(); } }