diff --git a/src/Esendex/Model/ResultItem.php b/src/Esendex/Model/ResultItem.php index 0c521c8..b7d007a 100644 --- a/src/Esendex/Model/ResultItem.php +++ b/src/Esendex/Model/ResultItem.php @@ -38,15 +38,18 @@ class ResultItem { private $id; private $uri; + private $batchid; /** * @param $id * @param $uri + * @param $batchid */ - public function __construct($id, $uri) + public function __construct($id, $uri, $batchid = '') { $this->id = (string)$id; $this->uri = (string)$uri; + $this->batchid = (string)$batchid; } /** @@ -64,4 +67,12 @@ public function uri() { return $this->uri; } + + /** + * @return string + */ + public function batchid() + { + return $this->batchid; + } } diff --git a/src/Esendex/Parser/DispatchXmlParser.php b/src/Esendex/Parser/DispatchXmlParser.php index 1c2c014..76975cf 100644 --- a/src/Esendex/Parser/DispatchXmlParser.php +++ b/src/Esendex/Parser/DispatchXmlParser.php @@ -121,9 +121,11 @@ public function parse($xml) throw new XmlException("Xml is missing root element"); $results = array(); + $batchid = $headers['batchid']; + foreach ($headers->messageheader as $header) { - $results[] = new ResultItem($header["id"], $header["uri"]); + $results[] = new ResultItem($header["id"], $header["uri"], $batchid); } return $results;