Return to Snippet

Revision: 28100
at June 30, 2010 22:23 by orenus

Initial Code
class WeatherService{

	public function WeatherService(){
		//some initialization...
	public function getWeatherInfo($city, $method=""){
		$res = shell_exec("./ {$city}");
		if ($methos=="CL")
			return convertFrToC($res);
		return $res;
	public static function convertFrToC($val){
		return (($val+40)*5/9)-40;


//now it can also be used independently of the rest of the WeatherService 
//functions and main purpose...

$c = WeatherService::convertFrToC(22);

Initial URL

Initial Description

Initial Title
Get Weather - Step 4 - Enhancing encapsulation

Initial Tags

Initial Language