Skip to content

Commit

Permalink
Fix regions chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
jetwitaussi committed Jun 19, 2020
1 parent a151d98 commit 43a065a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
4 changes: 2 additions & 2 deletions PHT/Xml/World/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ public function getRegionsNumber()
* Return region object
*
* @param integer $index
* @return \PHT\Xml\World\Region
* @return \PHT\Xml\World\Region\Chunk
*/
public function getRegion($index)
{
Expand All @@ -374,7 +374,7 @@ public function getRegion($index)
/**
* Return iterator of regions objects
*
* @return \PHT\Xml\World\Region[]
* @return \PHT\Xml\World\Region\Chunk[]
*/
public function getRegions()
{
Expand Down
33 changes: 32 additions & 1 deletion PHT/Xml/World/Region/Chunk.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
namespace PHT\Xml\World\Region;

use PHT\Xml;
use PHT\Wrapper;

class Chunk extends Xml\World\Region
class Chunk extends Xml\Base
{
/**
* @param \DOMDocument $xml
Expand All @@ -25,4 +26,34 @@ public function __construct($xml)
$this->xmlText = $xml->saveXML();
$this->xml = $xml;
}

/**
* Return region id
*
* @return integer
*/
public function getId()
{
return $this->getXml()->getElementsByTagName('RegionID')->item(0)->nodeValue;
}

/**
* Return region id
*
* @return integer
*/
public function getName()
{
return $this->getXml()->getElementsByTagName('RegionName')->item(0)->nodeValue;
}

/**
* Get full region details
*
* @return Xml\World\Region
*/
public function getRegion()
{
return Wrapper\World::region($this->getId());
}
}

0 comments on commit 43a065a

Please sign in to comment.