<?php
namespace App\Amadeus\StructureParser\Structures\Car; 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']=='08'){ $details = $this->getDetails_U_08(); if($details){ $this->CACHE[__METHOD__] = $details; return $details; } } if($indexType=='U' && $U['_type']=='09'){ $details = $this->getDetails_U_09(); if($details){ $this->CACHE[__METHOD__] = $details; return $details; } } return null; } protected function getDetails_U_08() { $parsedStructure = $this->transaction->getParsedStructure(); $index = $this->transaction->getIndex(); $U = $parsedStructure['U'][$index->segment]; $item = new \App\Amadeus\StructureParser\Types\ServiceDetails(); $item->car_carCode = $U['CAR']; $item->car_carCode_text = trim($U['CARTRANS']); $item->car_numberOfCars = (int)($U['NBRCARS']); $item = $this->extractCommonServiceDetails($parsedStructure, $item); return $item; } protected function getDetails_U_09() { $item = $this->getDetails_U_08(); $parsedStructure = $this->transaction->getParsedStructure(); $index = $this->transaction->getIndex(); $I = $parsedStructure['I'][$index->passenger]; $U = $parsedStructure['U'][$index->segment]; $item->car_carMake_text = trim($U['VEHINFO']['VEHMAKE']); $item = $this->extractCommonServiceDetails($parsedStructure, $item); return $item; } } 