createdAt = new \DateTimeImmutable('now'); } /** * @return SurveyTemplateL11n * * @since 1.0.0 */ public function getL11n() : SurveyTemplateL11n { return $this->l11n ?? new NullSurveyTemplateL11n(); } /** * Set l11n * * @param SurveyTemplateL11n $l11n Template l11n * @param string $lang Language * * @return void * * @since 1.0.0 */ public function setL11n(SurveyTemplateL11n $l11n, string $lang = ISO639x1Enum::_EN) : void { $this->l11n = $l11n; } /** * Add element * * @param SurveyTemplateElement $element Survey element to add * * @return void * * @since 1.0.0 */ public function addElement(SurveyTemplateElement $element) : void { $this->elements[] = $element; } /** * {@inheritdoc} */ public function toArray() : array { return [ 'id' => $this->id, 'status' => $this->status, 'hasPublicResult' => $this->hasPublicResult, 'createdAt' => $this->createdAt, 'start' => $this->start, 'end' => $this->end, 'virtualPath' => $this->virtualPath, 'tags' => $this->tags, 'elements' => $this->elements, 'media' => $this->files, ]; } /** * {@inheritdoc} */ public function jsonSerialize() : mixed { return $this->toArray(); } use \Modules\Media\Models\MediaListTrait; }