Skip to content

Commit

Permalink
Fix world regions
Browse files Browse the repository at this point in the history
  • Loading branch information
jetwitaussi committed Jun 17, 2020
1 parent a336b60 commit 69af693
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
6 changes: 3 additions & 3 deletions PHT/Xml/World/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ public function getRegion($index)
$nodeList = $this->getXml()->getElementsByTagName('Region');
$region = new \DOMDocument('1.0', 'UTF-8');
$region->appendChild($region->importNode($nodeList->item($index), true));
return new Xml\World\Region($region);
return new Xml\World\Region\Chunk($region);
}
return null;
}
Expand All @@ -379,8 +379,8 @@ public function getRegion($index)
public function getRegions()
{
$nodeList = $this->getXml()->getElementsByTagName('Region');
/** @var \PHT\Xml\World\Region[] $data */
$data = new Utils\XmlIterator($nodeList, '\PHT\Xml\World\Region');
/** @var \PHT\Xml\World\Region\Chunk[] $data */
$data = new Utils\XmlIterator($nodeList, '\PHT\Xml\World\Region\Chunk');
return $data;
}

Expand Down
28 changes: 28 additions & 0 deletions PHT/Xml/World/Region/Chunk.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* PHT
*
* @author Telesphore
* @link https://github.com/jetwitaussi/PHT
* @version 3.0
* @license "THE BEER-WARE LICENSE" (Revision 42):
* Telesphore wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return.
*/

namespace PHT\Xml\World\Region;

use PHT\Xml;

class Chunk extends Xml\World\Region
{
/**
* @param \DOMDocument $xml
*/
public function __construct($xml)
{
$this->xmlText = $xml->saveXML();
$this->xml = $xml;
}
}

0 comments on commit 69af693

Please sign in to comment.