certs = new \ArrayObject(); parent::__construct($document); } /** * Get the start date * * @return \DateTime */ public function getStartDate(): \DateTime { if ($this->startDate) { $date = new \DateTime($this->startDate); $date->setTime(0, 0); return $date; } return null; } /** * Get the end date * * @return \DateTime */ public function getEndDate(): \DateTime { if ($this->endDate) { $date = new \DateTime($this->endDate); $date->setTime(23, 59, 59); return $date; } $date = new \DateTime(); $date->setTime(23, 59, 59); return $date; } /** * Get the tag for this entry * * @return string */ public function getTag(): string { return $this->tag; } /** * get the company name * * @return string */ public function getCompany(): string { return $this->company; } /** * Get the qualification obtained * * @return string */ public function getQualification(): string { return $this->qualification; } /** * Get the position/job title * * @return string */ public function getPosition(): string { return $this->position; } /** * Get the achievements * * @return array */ public function getAchievements(): array { return $this->achievements; } /** * Get the obtained skills * * @return array */ public function getSkills(): array { return $this->skills; } /** * Get the industry * * @return string */ public function getIndustry(): string { return $this->industry; } /** * Get notes * * @return string */ public function getNotes(): string { return $this->notes; } /** * Check if this entry should be included in the resume * * @return bool */ public function useInResume(): bool { return $this->useInResume; } /** * Get the attachted certificates * * @return \ArrayObject(\Magdev\Dossier\Model\CurriculumVitae\Entry\Certificate[]) */ public function getCertificates(): \ArrayObject { return $this->certs; } /** * Check if entry has certificates * * @return bool */ public function hasCertificates(): bool { return $this->certs->count() > 0; } /** * Get the toolbox * * @return \ArrayObject */ public function getToolbox(): \ArrayObject { return new \ArrayObject($this->toolbox); } /** * Get the length of this entry in seconds * * @return int */ public function getExperienceLength(): int { return $this->getEndDate()->format('U') - $this->getStartDate()->format('U'); } /** * {@inheritDoc} * @see \Magdev\Dossier\Analyzer\Base\AnalyzableInterface::getAnalyzerData() */ public function getAnalyzerData(): array { $props = get_object_vars($this); foreach ($this->ignoredProperties as $prop) { unset($props[$prop]); } $props['text'] = $this->getContent(); return $props; } /** * {@inheritDoc} * @see \Magdev\Dossier\Model\Base\BaseModel::loadArray() */ protected function loadArray(array $data): BaseModel { foreach ($data as $key => $value) { if ($key == 'certs') { foreach ($value as $cert) { $c = new Entry\Certificate(PROJECT_ROOT.'/certs/'.$cert['path'], $cert['type']); $this->certs->append($c); } } else if ($key == 'photo') { $this->setPhoto($value); } else { $prop = $this->convertCase($key); if (property_exists($this, $prop)) { $this->{$prop} = $value; } else { $this->addAdditionalData($prop, $value); } } } return $this; } }