<?php
namespace App\Amadeus\StructureParser\Structures\MCO; class Passengers extends \App\Amadeus\StructureParser\Parser\Passengers { public function getAll() { return [$this->getOwner()]; } public function getOwner() { if($this->CACHE[__METHOD__]) return $this->CACHE[__METHOD__]; $indexType = $this->transaction->getIndexType(); if($indexType=='MCO'){ $pax = $this->getOwner_MCO(); if($pax){ $this->CACHE[__METHOD__] = $pax; return $pax; } } return null; } protected function getOwner_MCO() { $parsedStructure = $this->transaction->getParsedStructure(); $index = $this->transaction->getIndex(); $MCO = $parsedStructure['MCO'][$index->MCO]; $I = \App\Amadeus\StructureParser\Helpers::internal_MCO_MCO_to_I($parsedStructure, $MCO, $this->transaction); if($I){ $item = new \App\Amadeus\StructureParser\Types\Passenger(); $item->title = implode(" ", array_filter([$I['PSGRNME_honorifics_'], $I['PSGRNME_title_']])); $item->type = ($I['PSGRID_']['type']?$I['PSGRID_']['type']:'adult'); $item->firstName = $I['PSGRNME_firstName']; $item->lastName = $I['PSGRNME_lastName']; $item = \App\Amadeus\StructureParser\Helpers::internal_passenger_extractType($item, $I, $parsedStructure, $index, $this->transaction); $item = \App\Amadeus\StructureParser\Helpers::internal_passenger_extractAmadeusId($item, $I, $this->transaction, $parsedStructure); $item = \App\Amadeus\StructureParser\Helpers::internal_passenger_extractAddress($item, $I, $this->transaction); $item = \App\Amadeus\StructureParser\Helpers::internal_passenger_extractPassport($item, $I, $this->transaction); $item = \App\Amadeus\StructureParser\Helpers::internal_passenger_extractDateOfBirth($item, $I, $parsedStructure, $index, $this->transaction); } return $item; } } 