3 * OpenWeatherMap-PHP-API — A php api to parse weather data from http://www.OpenWeatherMap.org .
7 * Please see the LICENSE file distributed with this source code for further
8 * information regarding copyright and licensing.
10 * Please visit the following links to read about the usage policies and the license of
11 * OpenWeatherMap before using this class:
13 * @see http://www.OpenWeatherMap.org
14 * @see http://www.OpenWeatherMap.org/terms
15 * @see http://openweathermap.org/appid
18 namespace Cmfcmf\OpenWeatherMap\Util;
21 * The weather class representing a weather object.
26 * @var int The weather id.
31 * @var string The weather description.
36 * @var string the icon name.
41 * @var string The url for icons.
43 * @see self::getIconUrl() to see how it is used.
45 private $iconUrl = "http://openweathermap.org/img/w/%s.png";
48 * Create a new weather object.
50 * @param int $id The icon id.
51 * @param string $description The weather description.
52 * @param string $icon The icon name.
56 public function __construct($id, $description, $icon)
59 $this->description = (string)$description;
60 $this->icon = (string)$icon;
64 * Get the weather description.
68 public function __toString()
70 return $this->description;
76 * @return string The icon url.
78 public function getIconUrl()
80 return str_replace("%s", $this->icon, $this->iconUrl);