createdAt = new \DateTime('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 unit this template belogns to * * @return Unit * * @since 1.0.0 */ public function getUnit() : Unit { return $this->unit; } /** * Set unit this model belongs to * * Set the unit * * @param Unit $unit Unit * * @return void * * @since 1.0.0 */ public function setUnit(Unit $unit) : void { $this->unit = $unit; } /** * 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(); } /** * Set template name * * @param string $name Template name * * @return void * * @since 1.0.0 */ public function setName(string $name) : void { $this->name = $name; } /** * Get template name * * @return string * * @since 1.0.0 */ public function getName() : string { return $this->name; } /** * Set description * * @param string $description Template description * * @return void * * @since 1.0.0 */ public function setDescription(string $description) : void { $this->description = $description; } /** * Get description * * @return string * * @since 1.0.0 */ public function getDescription() : string { return $this->description; } /** * Set raw description * * @param string $description Template description * * @return void * * @since 1.0.0 */ public function setDescriptionRaw(string $description) : void { $this->descriptionRaw = $description; } /** * Get raw description * * @return string * * @since 1.0.0 */ public function getDescriptionRaw() : string { return $this->descriptionRaw; } /** * Set source media * * @param Collection $source Source * * @return void * * @since 1.0.0 */ public function setSource(Collection $source) : void { $this->source = $source; } /** * Get source media * * @return Collection * * @since 1.0.0 */ public function getSource() : Collection { return $this->source; } /** * Set creator * * @param Account $createdBy Creator * * @return void * * @since 1.0.0 */ public function setCreatedBy(Account $createdBy) : void { $this->createdBy = $createdBy; } /** * Get creator * * @return Account * * @since 1.0.0 */ public function getCreatedBy() : Account { return $this->createdBy; } /** * Get created date * * @return \DateTime * * @since 1.0.0 */ public function getCreatedAt() : \DateTime { return $this->createdAt; } /** * Set expected files from reports * * @param array $expected Expected files * * @return void * * @since 1.0.0 */ public function setExpected(array $expected) : void { $this->expected = $expected; } /** * 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 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; } /** * Set if the template needs report data * * @param bool $isStandalone Is template standalone * * @return void * * @since 1.0.0 */ public function setStandalone(bool $isStandalone) : void { $this->isStandalone = $isStandalone; } /** * Does the template need report data? * * @return bool * * @since 1.0.0 */ public function isStandalone() : bool { return $this->isStandalone; } /** * 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() { return $this->toArray(); } }