public static function getPrices(SocolissimoDeliveryMode $deliveryMode) { self::$prices = null; $fileName = sprintf('%s%s', __DIR__, "/Config/prices_" . $deliveryMode->getCode() . ".json"); // If delivery mode file doesn't exist take global price if (!file_exists($fileName)) { $fileName = sprintf('%s%s', __DIR__, self::JSON_PRICE_RESOURCE); // If global price doesn't exist throw exception if (!file_exists($fileName)) { throw new Exception("Prices configuration not found."); } } if (null === self::$prices) { self::$prices = json_decode(file_get_contents($fileName), true); } return self::$prices; }