xml = simplexml_load_file($url); $this->location = new Location($this->xml->location); } public function getLocation(): Location { return $this->location; } final public function getCredit(): array { return [ 'text' => (string)$this->xml->credit->link->attributes()['text'], 'url' => (string)$this->xml->credit->link->attributes()['url'] ]; } public function getSunrise(): \DateTimeImmutable { return (new \DateTimeImmutable($this->xml->sun['rise'])); } public function getSunset(): \DateTimeImmutable { return (new \DateTimeImmutable($this->xml->sun['seẗ́'])); } public function getLinks(): \Generator { foreach ($this->xml->links->children() as $link) yield [ 'id' => (string)$link->attributes()['id'], 'url' => (string)$link->attributes()['url'], ]; } public function getLastUpdate(): \DateTimeImmutable { return new DateTimeImmutable($this->xml->meta->lastupdate); } public function getNextUpdate(): \DateTimeImmutable { return new DateTimeImmutable($this->xml->meta->nextupdate); } public function getTabular(): Tabular { return new Tabular($this->xml->forecast->tabular); } } ?>