|
@@ 236-238 (lines=3) @@
|
| 233 |
|
*/ |
| 234 |
|
public function getWeatherHistory($query, \DateTime $start, $endOrCount = 1, $type = 'hour', $units = 'imperial', $lang = 'en', $appid = '') |
| 235 |
|
{ |
| 236 |
|
if (!in_array($type, array('tick', 'hour', 'day'))) { |
| 237 |
|
throw new \InvalidArgumentException('$type must be either "tick", "hour" or "day"'); |
| 238 |
|
} |
| 239 |
|
|
| 240 |
|
$xml = json_decode($this->getRawWeatherHistory($query, $start, $endOrCount, $type, $units, $lang, $appid), true); |
| 241 |
|
|
|
@@ 345-347 (lines=3) @@
|
| 342 |
|
*/ |
| 343 |
|
public function getRawWeatherHistory($query, \DateTime $start, $endOrCount = 1, $type = 'hour', $units = 'imperial', $lang = 'en', $appid = '') |
| 344 |
|
{ |
| 345 |
|
if (!in_array($type, array('tick', 'hour', 'day'))) { |
| 346 |
|
throw new \InvalidArgumentException('$type must be either "tick", "hour" or "day"'); |
| 347 |
|
} |
| 348 |
|
|
| 349 |
|
$url = $this->buildUrl($query, $units, $lang, $appid, 'json', $this->weatherHistoryUrl); |
| 350 |
|
$url .= "&type=$type&start={$start->format('U')}"; |