|
@@ 293-295 (lines=3) @@
|
| 290 |
|
*/ |
| 291 |
|
public function getWeatherHistory($query, \DateTime $start, $endOrCount = 1, $type = 'hour', $units = 'imperial', $lang = 'en', $appid = '') |
| 292 |
|
{ |
| 293 |
|
if (!in_array($type, array('tick', 'hour', 'day'))) { |
| 294 |
|
throw new \InvalidArgumentException('$type must be either "tick", "hour" or "day"'); |
| 295 |
|
} |
| 296 |
|
|
| 297 |
|
$xml = json_decode($this->getRawWeatherHistory($query, $start, $endOrCount, $type, $units, $lang, $appid), true); |
| 298 |
|
|
|
@@ 424-426 (lines=3) @@
|
| 421 |
|
*/ |
| 422 |
|
public function getRawWeatherHistory($query, \DateTime $start, $endOrCount = 1, $type = 'hour', $units = 'imperial', $lang = 'en', $appid = '') |
| 423 |
|
{ |
| 424 |
|
if (!in_array($type, array('tick', 'hour', 'day'))) { |
| 425 |
|
throw new \InvalidArgumentException('$type must be either "tick", "hour" or "day"'); |
| 426 |
|
} |
| 427 |
|
|
| 428 |
|
$url = $this->buildUrl($query, $units, $lang, $appid, 'json', $this->weatherHistoryUrl); |
| 429 |
|
$url .= "&type=$type&start={$start->format('U')}"; |