From d67e718ec77c4ae8148a7f2e1717e4092b3978eb Mon Sep 17 00:00:00 2001 From: jetwitaussi Date: Sat, 7 Sep 2024 13:31:41 +0200 Subject: [PATCH] Fix structure getLevels function --- PHT/Xml/World/LeagueStructure.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/PHT/Xml/World/LeagueStructure.php b/PHT/Xml/World/LeagueStructure.php index 770a338..ba38ad4 100644 --- a/PHT/Xml/World/LeagueStructure.php +++ b/PHT/Xml/World/LeagueStructure.php @@ -86,9 +86,14 @@ public function getLevel($number) public function getLevels() { $xpath = new \DOMXPath($this->getXml()); - $nodeList = $xpath->query('//Staff'); + $nodeList = $xpath->query('//LeagueLevel'); + $levels = new \DOMDocument('1.0', 'UTF-8'); + for ($i = 0; $i < $nodeList->length; $i++) { + $levels->appendChild($levels->importNode($nodeList->item($i)->parentNode, true)); + } + $nodes = $levels->getElementsByTagName('LeagueLevelItem'); /** @var \PHT\Xml\World\League\Level[] $data */ - $data = new Utils\XmlIterator($nodeList, '\PHT\Xml\World\League\Level'); + $data = new Utils\XmlIterator($nodes, '\PHT\Xml\World\League\Level'); return $data; } } \ No newline at end of file