<?php
namespace App\Galileo\StructureParser\Structures\LCCTicketing; trait LCCTrait { protected function getA14Segment($parsedStructure, $transactionIndexes) { return $parsedStructure['A14_LCC']['Services'][$transactionIndexes['ks']]; } protected function getA14FlightDetailsForSegment($parsedStructure, $transactionIndexes) { $A14Segment = $this->getA14Segment($parsedStructure, $transactionIndexes); $fareNumber = $A14Segment['PassengerFare'][$transactionIndexes['ks']]['fareNumber']; return array_filter($parsedStructure['A14_LCC']['FlightDetailsForSegment'], function($FD) use ($fareNumber) { return $FD['FlightDetailsForSegment']['fareNumber'] == $fareNumber; }); } protected function getA14PassengerFare($A14Service, $parsedStructure, $transactionIndexes) { if ($A14Service['PassengerFare']) { return array_filter($A14Service['PassengerFare'], function($PF) use ($transactionIndexes) { return $transactionIndexes['passengerIdentifier'] == $PF['passengerIdentifier']; }); } return []; } protected function getA14AncillariesLCC($A14Service, $parsedStructure, $transactionIndexes) { if ($parsedStructure['A14_LCC']['AncillariesLCC']) { return array_filter($parsedStructure['A14_LCC']['AncillariesLCC'], function($A) use ($transactionIndexes) { return $transactionIndexes['passengerIdentifier'] == $A['Ancillaries']['passengerIdentifier']; }); } return []; } protected function getA14SSR($A14Service, $parsedStructure, $transactionIndexes) { if ($parsedStructure['A14_LCC']['SSR']) { return array_filter($parsedStructure['A14_LCC']['SSR'], function($SSR) use ($transactionIndexes) { return in_array($transactionIndexes['passengerIdentifier'], $SSR['SSR']['passengerIdentifier']) && $SSR['SSR']['type_']!='02'; }); } return []; } } 