Return to Snippet

Revision: 28107
at June 30, 2010 22:37 by orenus


Initial Code
//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);
			
		$res = shell_exec("./getWdr.sh {$city}");
		
		if ($methos=="CL")
			return convertFrToC($res);
			
		return $res;
	}
	
	private function convertFrToC($val){
		return (($val+40)*5/9)-40;
	}

}

Initial URL

                                

Initial Description

                                

Initial Title
Get Weather - Step 10 - The bottom line...

Initial Tags
php

Initial Language
PHP