|
@@ 264-266 (lines=3) @@
|
| 261 |
|
*/ |
| 262 |
|
public function getWeatherHistory($query, \DateTime $start, $endOrCount = 1, $type = 'hour', $units = 'imperial', $lang = 'en', $appid = '') |
| 263 |
|
{ |
| 264 |
|
if (!in_array($type, array('tick', 'hour', 'day'))) { |
| 265 |
|
throw new \InvalidArgumentException('$type must be either "tick", "hour" or "day"'); |
| 266 |
|
} |
| 267 |
|
|
| 268 |
|
$xml = json_decode($this->getRawWeatherHistory($query, $start, $endOrCount, $type, $units, $lang, $appid), true); |
| 269 |
|
|
|
@@ 373-375 (lines=3) @@
|
| 370 |
|
*/ |
| 371 |
|
public function getRawWeatherHistory($query, \DateTime $start, $endOrCount = 1, $type = 'hour', $units = 'imperial', $lang = 'en', $appid = '') |
| 372 |
|
{ |
| 373 |
|
if (!in_array($type, array('tick', 'hour', 'day'))) { |
| 374 |
|
throw new \InvalidArgumentException('$type must be either "tick", "hour" or "day"'); |
| 375 |
|
} |
| 376 |
|
|
| 377 |
|
$url = $this->buildUrl($query, $units, $lang, $appid, 'json', $this->weatherHistoryUrl); |
| 378 |
|
$url .= "&type=$type&start={$start->format('U')}"; |