<?php
namespace App\Amadeus\CompatibilityWithImportedOrders; class TaxManipulationsCached extends TaxManipulations { private $CACHE = []; public function getParentEntity($entity) { $cacheKey = sprintf("%s:%s", __METHOD__, $entity->getId()); if (!array_key_exists($cacheKey, $this->CACHE)) { $this->CACHE[$cacheKey] = parent::getParentEntity($entity); } return $this->CACHE[$cacheKey]; } public function TINA_getServiceItinerary($entity, $parentEntity=null) { $cacheKey = sprintf("%s:%s,%s", __METHOD__, $entity->getId(), ($parentEntity?$parentEntity->getId():null)); if (!array_key_exists($cacheKey, $this->CACHE)) { $this->CACHE[$cacheKey] = $entity->transactionSegmentData->getSegments(); } return $this->CACHE[$cacheKey]; } public function TINA_getOfferLocation(array $segments) { $cacheKey = sprintf("%s:%s", __METHOD__, md5(serialize($segments))); if (!array_key_exists($cacheKey, $this->CACHE)) { $this->CACHE[$cacheKey] = parent::TINA_getOfferLocation($segments); } return $this->CACHE[$cacheKey]; } public function TINA_getVatDetails(array $segments, $transactionType) { $cacheKey = sprintf("%s:%s,%s", __METHOD__, md5(serialize($segments)), $transactionType); if (!array_key_exists($cacheKey, $this->CACHE)) { $this->CACHE[$cacheKey] = parent::TINA_getVatDetails($segments, $transactionType); } return $this->CACHE[$cacheKey]; } } 