public static function getRevenueModel($revenueReportFile) { $revenueReport = new RevenueCSV($revenueReportFile); $csvRecords = $revenueReport->getCsvRecords()->setOffset(1)->fetchAll(); $revenueReportModel = RevenueCSV2Model::transform($csvRecords); return $revenueReportModel; }
function setUp($argv, $argc) { $logger = QCLogger::getInstance(); $logger->info("BEGIN " . __METHOD__); $revenueReportFile = RevenueReportUtils::getReportFileName($argv); if (!$argv) { $revenueReportFile = "/tmp/ck-daily-sales.csv"; } Registry::getInstance()->add('revenueReportFile', $revenueReportFile); if (!file_exists($revenueReportFile)) { $exception = new Exception("Revenue Report file " . $revenueReportFile . " is not found"); $this->handleSetupError($exception); throw $exception; } $revenueReport = new RevenueCSV($revenueReportFile); $csvRecords = $revenueReport->getCsvRecords()->setOffset(1)->fetchAll(); Registry::getInstance()->add('csvRecords', $csvRecords); $revenueReportModel = RevenueCSV2Model::transform($csvRecords); if ($revenueReportModel) { $revenueReportModel->setRevenueReportFile($revenueReportFile); } Registry::getInstance()->add('revReportModel', $revenueReportModel); $logger->info("END " . __METHOD__); }