|
@@ 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 |
|
|
|
@@ 500-502 (lines=3) @@
|
| 497 |
|
*/ |
| 498 |
|
public function getRawWeatherHistory($query, \DateTime $start, $endOrCount = 1, $type = 'hour', $units = 'imperial', $lang = 'en', $appid = '') |
| 499 |
|
{ |
| 500 |
|
if (!in_array($type, array('tick', 'hour', 'day'))) { |
| 501 |
|
throw new \InvalidArgumentException('$type must be either "tick", "hour" or "day"'); |
| 502 |
|
} |
| 503 |
|
|
| 504 |
|
$url = $this->buildUrl($query, $units, $lang, $appid, 'json', $this->weatherHistoryUrl); |
| 505 |
|
$url .= "&type=$type&start={$start->format('U')}"; |