<?php
namespace App\Amadeus\StructureParser\Structures\GroundTransportation; class Document extends \App\Amadeus\StructureParser\Parser\Document { public function document() { if($this->CACHE[__METHOD__]) return $this->CACHE[__METHOD__]; $parsedStructure = $this->transaction->getParsedStructure(); $indexType = $this->transaction->getIndexType(); $index = $this->transaction->getIndex(); $U = $parsedStructure['U'][$index->segment]; if($indexType=='U' && $U['_type']=='10'){ $doc = $this->document_U_10(); if($doc){ $this->CACHE[__METHOD__] = $doc; return $doc; } } return null; } public function supplier() { if($this->CACHE[__METHOD__]) return $this->CACHE[__METHOD__]; $parsedStructure = $this->transaction->getParsedStructure(); $indexType = $this->transaction->getIndexType(); $index = $this->transaction->getIndex(); $U = $parsedStructure['U'][$index->segment]; if($indexType=='U' && $U['_type']=='10'){ $doc = $this->supplier_U_10(); if($doc){ $this->CACHE[__METHOD__] = $doc; return $doc; } } return null; } protected function document_U_10() { $parsedStructure = $this->transaction->getParsedStructure(); $index = $this->transaction->getIndex(); $item = new \App\Amadeus\StructureParser\Types\Document(); $item->createDate= $parsedStructure['D']['PNRDTE']; $item->issueDate= $parsedStructure['D']['AIRDTE']; $item->docDate = $parsedStructure['D']['AIRDTE']; $I = $parsedStructure['I'][$index->passenger]; $item->transactionCode = $this->createTransactionCodeFromAssoc($parsedStructure['AMD']['MUC']['RECLOC']['RECLOC'], $I['GCPSGR'], [$index->segment], $parsedStructure['U'], 'TTONBR'); return $item; } protected function supplier_U_10() { $parsedStructure = $this->transaction->getParsedStructure(); $index = $this->transaction->getIndex(); $U = $parsedStructure['U'][$index->segment]; $item = new \App\Amadeus\StructureParser\Types\Supplier(); $item->codeAirline =$U['AIRCDE']; $item->productCode = $U['GRNDCDE']; $item->productName = $U['GRNDCDE_']; return $item; } } 