<?php
 namespace App\ClientCollection\Corporate\Document; abstract class GeneralAbstract { protected $analyzer = null; protected $documentLanguageCode = 'en'; protected $attachmentFileName; protected $tempFileFullPath = ''; public function __construct(\App\ClientCollection\Corporate\Analyzer $analyzerObj) { $this->analyzer = $analyzerObj; } public function setDocumentLanguageCode($documentLanguageCode):void { $this->documentLanguageCode = $documentLanguageCode; } public function generateReportContent() { if (!$this->attachmentFileName) { throw new \Exception('Attachment file name (attachmentFileName attribute) not set for '.get_called_class()); } $CFG = \Engine\Loader_Cfg::getInstance()->getGlobal(); $this->tempFileFullPath = APP_REAL_PATH.$CFG['paths']['temporary']."CorporateCollection_".$this->analyzer->getIdCorporate().".temp"; $this->populateReport(); } abstract protected function populateReport() :void; public function getTempFileFullPath() { if (!$this->tempFileFullPath) { throw new \Exception('The temporary full file path is not set - have you called the generateReportContent() method?'); } return $this->tempFileFullPath; } public function getAttachmentFileName() { return $this->attachmentFileName; } } 