/** * Gets the forecast as response * * @param mixed (integer|string) $city * @param int $days * @return stdClass */ public function getForecast($city, $days = 3) { // Cheking if cache is enabled if ($this->container->getParameter('pianosolo.weather.options.cache') === TRUE) { $cacheID = $city . $days . 'fc'; if (!($weathers = $this->getCache($cacheID))) { $weathers = $this->weatherService->getForecast($city, $days); $this->saveCache($cacheID, $weathers); } } else { $weathers = $this->weatherService->getForecast($city, $days); } return $weathers; }
/** * Gets the forecast as response * * @param mixed (integer|string) $city * @param int $days * @return /stdClass */ public function getForecast($city, $days = 3) { // Checking if cache is enabled if ($this->cacheIsEnabled) { $cacheID = $city . $days . 'fc'; if (!($weathers = $this->getCache($cacheID))) { $weathers = $this->weatherService->getForecast($city, $days); $this->saveCache($cacheID, $weathers); } } else { $weathers = $this->weatherService->getForecast($city, $days); } return $weathers; }