1 | <?php |
||
23 | class Weather |
||
24 | { |
||
25 | /** |
||
26 | * @var int The weather id. |
||
27 | */ |
||
28 | public $id; |
||
29 | |||
30 | /** |
||
31 | * @var string The weather description. |
||
32 | */ |
||
33 | public $description; |
||
34 | |||
35 | /** |
||
36 | * @var string the icon name. |
||
37 | */ |
||
38 | public $icon; |
||
39 | |||
40 | /** |
||
41 | * @var string The url for icons. |
||
42 | * |
||
43 | * @see self::getIconUrl() to see how it is used. |
||
44 | */ |
||
45 | private $iconUrl = "http://openweathermap.org/img/w/%s.png"; |
||
46 | |||
47 | /** |
||
48 | * Create a new weather object. |
||
49 | * |
||
50 | * @param int $id The icon id. |
||
51 | * @param string $description The weather description. |
||
52 | * @param string $icon The icon name. |
||
53 | * |
||
54 | * @internal |
||
55 | */ |
||
56 | public function __construct($id, $description, $icon) |
||
57 | { |
||
58 | $this->id = (int)$id; |
||
59 | $this->description = (string)$description; |
||
60 | $this->icon = (string)$icon; |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Get the weather description. |
||
65 | * |
||
66 | * @return string |
||
67 | */ |
||
68 | public function __toString() |
||
72 | |||
73 | /** |
||
74 | * Get the icon url. |
||
75 | * |
||
76 | * @return string The icon url. |
||
77 | */ |
||
78 | public function getIconUrl() |
||
82 | } |
||
83 |