<?php
namespace App\Amadeus\StructureParser\Structures\GroundTransportation; class ServiceDetails extends \App\Amadeus\StructureParser\Parser\ServiceDetails { public function getDetails() { 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'){ $details = $this->getDetails_U_10(); if($details){ $this->CACHE[__METHOD__] = $details; return $details; } } return null; } protected function getDetails_U_10() { $parsedStructure = $this->transaction->getParsedStructure(); $item = new \App\Amadeus\StructureParser\Types\ServiceDetails(); $item = $this->extractCommonServiceDetails($parsedStructure, $item); return $item; } public function getRelations() { if($this->CACHE[__METHOD__]) return $this->CACHE[__METHOD__]; $parsedStructure = $this->transaction->getParsedStructure(); $index = $this->transaction->getIndex(); $relations = new \App\Amadeus\StructureParser\Types\Relations(); if($index->passenger!==null){ $I = $parsedStructure['I'][$index->passenger]; if($I['T']['TKTNBR']){ foreach($I['T']['TKTNBR_'] as $TKT){ $r = new \App\Amadeus\StructureParser\Types\Relation(); $r->docNumber = $TKT; $r->docDate = $parsedStructure['D']['AIRDTE']; $r->relationType = 'reference'; $relations->relations[] = $r; } }else{ $this->transaction->addLog(__METHOD__.": This file contains groundTransportation, but no ticketing to reference it"); } } $relations = $this->extractReferencesData($parsedStructure, $index, $relations); return $relations; } } 