12345678910111213141516171819202122232425 |
- <?php
- namespace App\Yr\Forecast;
- final class Location {
- private $name;
- private $type;
- private $country;
- private $tz;
- private $loc = [];
- public function __construct(\SimpleXMLElement $xml) {
- $this->name = (string)$xml->name;
- $this->type = (string)$xml->type;
- $this->country = (string)$xml->country;
- $this->tz = (string)$xml->timezone['id'];
- $this->loc = [
- 'lat' => (float)$xml->location['latitude'],
- 'lng' => (float)$xml->location['longitude'],
- 'alt' => (float)$xml->location['altitude']
- ];
- }
- }
- ?>
|