<?php
namespace ModulesAbstract\PluginReports\Report\Model\Gatherer\ExportData; class AbstractExportDataFile extends \Engine\SimpleXmlElement { protected $path = null; public function getDate() { return \Engine\DateTime::createFromFormat('Y-m-d\TH:i:s', (String)$this['exportTime'])->formatDateIso(); } public function setPath($path) { $this->path = $path; return $this; } public function getPath() { return (string)$this->path; } public function isConfirmed() { return (bool)preg_match("/\/confirmed\/([0-9]{6})\/([^\/].+)\.xml$/i", $this->getPath()); } public function moveFileToConfirmedFolder() { if (!$this->isConfirmed()) { $xml = @simplexml_load_file($this->getPath()); $outputObj = new \App\ExportData\Output\ExportDataLogger(\Engine\File::getName($this->getPath())); $queueManager = \App\ExportData\QueueManager::getInstance(); if (!plugins_confirmFile($this->getPath())) { $outputObj->getMessagesCollector()->addError('File could not be confirmed from plugin reports.'); $queueManager->addLog('pluginReportsConfirmFailed', 'failed', $xml, $outputObj); throw new \Exception\IO\Base(sprintf('The file `%s` cannot be confirmed', $this->getPath())); } else { $outputObj->getMessagesCollector()->addSuccess('File successfully confirmed from plugin reports.'); $queueManager->addLog('pluginReportsConfirmSuccess', 'confirmed', $xml, $outputObj); } } } public function getExportDate() { return \Engine\DateTime::create((String)$this['exportTime'])->formatDateIso(); } public function isVoid() { return false; } public function getVoidDate() { return null; } public function isIssue() { return false; } public function getIssueDate() { return null; } public function isCoreDocument() { return null; } public function isCashbookDocument() { return null; } public function isImportedDocument() { return null; } } 