createdAt = new \DateTimeImmutable('now'); $this->unit = new NullUnit(); $this->source = new NullCollection(); $this->createdBy = new NullAccount(); } /** * Get model id * * @return int * * @since 1.0.0 */ public function getId() : int { return $this->id; } /** * Get newest report for template. * * @return Report * * @since 1.0.0 */ public function getNewestReport() : Report { if (!empty($this->reports)) { return \end($this->reports); } return new NullReport(); } /** * Get expected files from report * * @return array * * @since 1.0.0 */ public function getExpected() : array { return $this->expected; } /** * Add expected file from report * * @param string $expected Expected file * * @return void * * @since 1.0.0 */ public function addExpected(string $expected) : void { $this->expected[] = $expected; } /** * Set expected file from report * * @param array $expected Expected file * * @return void * * @since 1.0.0 */ public function setExpected(array $expected) : void { $this->expected = $expected; } /** * Set activity satuus * * @param int $status Template status (is active?) * * @return void * * @since 1.0.0 */ public function setStatus(int $status) : void { $this->status = $status; } /** * Get activity status * * @return int * * @since 1.0.0 */ public function getStatus() : int { return $this->status; } /** * Set data type basis * * @param int $datatype Template datatype source * * @return void * * @since 1.0.0 */ public function setDatatype(int $datatype) : void { $this->datatype = $datatype; } /** * Get data type basis * * @return int * * @since 1.0.0 */ public function getDatatype() : int { return $this->datatype; } /** * Get tags * * @return array * * @since 1.0.0 */ public function getTags() : array { return $this->tags; } /** * Add tag * * @param Tag $tag Tag * * @return void * * @since 1.0.0 */ public function addTag(Tag $tag) : void { $this->tags[] = $tag; } /** * {@inheritdoc} */ public function toArray() : array { return [ 'id' => $this->id, 'createdBy' => $this->createdBy, 'createdAt' => $this->createdAt, 'name' => $this->name, 'description' => $this->description, 'descriptionRaw' => $this->descriptionRaw, 'status' => $this->status, 'datatype' => $this->datatype, 'standalone' => $this->isStandalone, ]; } /** * {@inheritdoc} */ public function jsonSerialize() : mixed { return $this->toArray(); } }