<?php
namespace Modules\Orders\Worldspan\Collector\Model\Filters;

class StructureParser extends \ModulesAbstract\ImportedOrdersFileManager\Model\Filters\StructureParserCachedAbstract
{
	/**
	 * (non-PHPdoc)
	 * @see \ModulesAbstract\ImportedOrdersFileManager\Model\Filters\StructureParserCachedAbstract::getTransactions()
	 */
	protected function getTransactions($fileFullPath)
	{
		$fileParser = new \App\Worldspan\FileParser\TAIR();
		$fileParser->setMessagesCollector(new \App\MessagesCollector());
		$fileParser->setRawData(\Engine\File::getContents($fileFullPath));
		// exceptions might get thrown in the following few lines
		$fileParser->extract();

		// use the processor to process the raw data
		$processor = new \App\Worldspan\StructureParser\Processor($fileParser);
		$processor->initialize();
		$processor->setFile($fileFullPath);

		$sortedTransactions = $processor->getSortedTransactions();

		return $sortedTransactions;
	}
}