/** * Constructor for displaying the weather */ public function __construct($location, $temp = "c") { try { switch ($temp) { case "c": case "f": parent::__construct($location); $this->temp_ = $temp; break; default: throw new Exception("Temperature must be in either C or F."); break; } } catch (Exception $e) { echo $e->getMessage(), "\n"; } }
/** * Return weather by City ID * @param $vCityID CityID * @param $vUnits Unit(metric/imperial) * @return */ public static function GetWeatherByCityID($vCityID, $vUnits) { $weather = OpenWeather::GetJsonWeatherDataByCityID($vCityID, $vUnits); return $weather; }