/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//back to our "black roots"... class WeatherService{ private $cache; public function WeatherService(){ //some initialization... $cache = new DBCache(); //******** THE ONLY THING CHANGED !!!!!!!!!!!!!!!!! } public function getWeatherInfo($city, $method){ if ($cache->get($city)) return $cache->get($city); if ($methos=="CL") return convertFrToC($res); return $res; } private function convertFrToC($val){ return (($val+40)*5/9)-40; } }