<?php
namespace App\Sabre\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] = parent::TINA_getServiceItinerary($entity, $parentEntity); } 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]; } } 