|
@@ 299-301 (lines=3) @@
|
| 296 |
|
*/ |
| 297 |
|
public function getWeatherHistory($query, \DateTime $start, $endOrCount = 1, $type = 'hour', $units = 'imperial', $lang = 'en', $appid = '') |
| 298 |
|
{ |
| 299 |
|
if (!in_array($type, array('tick', 'hour', 'day'))) { |
| 300 |
|
throw new \InvalidArgumentException('$type must be either "tick", "hour" or "day"'); |
| 301 |
|
} |
| 302 |
|
|
| 303 |
|
$xml = json_decode($this->getRawWeatherHistory($query, $start, $endOrCount, $type, $units, $lang, $appid), true); |
| 304 |
|
|
|
@@ 474-476 (lines=3) @@
|
| 471 |
|
*/ |
| 472 |
|
public function getRawWeatherHistory($query, \DateTime $start, $endOrCount = 1, $type = 'hour', $units = 'imperial', $lang = 'en', $appid = '') |
| 473 |
|
{ |
| 474 |
|
if (!in_array($type, array('tick', 'hour', 'day'))) { |
| 475 |
|
throw new \InvalidArgumentException('$type must be either "tick", "hour" or "day"'); |
| 476 |
|
} |
| 477 |
|
|
| 478 |
|
$url = $this->buildUrl($query, $units, $lang, $appid, 'json', $this->weatherHistoryUrl); |
| 479 |
|
$url .= "&type=$type&start={$start->format('U')}"; |