Skip to content

Commit 531941e

Browse files
committed
Dispatch Parse : add batchid
1 parent 922d455 commit 531941e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/Esendex/Model/ResultItem.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,18 @@ class ResultItem
3838
{
3939
private $id;
4040
private $uri;
41+
private $batchid;
4142

4243
/**
4344
* @param $id
4445
* @param $uri
46+
* @param $batchid
4547
*/
46-
public function __construct($id, $uri)
48+
public function __construct($id, $uri, $batchid = '')
4749
{
4850
$this->id = (string)$id;
4951
$this->uri = (string)$uri;
52+
$this->batchid = (string)$batchid;
5053
}
5154

5255
/**
@@ -64,4 +67,12 @@ public function uri()
6467
{
6568
return $this->uri;
6669
}
70+
71+
/**
72+
* @return string
73+
*/
74+
public function batchid()
75+
{
76+
return $this->batchid;
77+
}
6778
}

src/Esendex/Parser/DispatchXmlParser.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,11 @@ public function parse($xml)
9696
throw new XmlException("Xml is missing <messageheaders /> root element");
9797

9898
$results = array();
99+
$batchid = $headers['batchid'];
100+
99101
foreach ($headers->messageheader as $header)
100102
{
101-
$results[] = new ResultItem($header["id"], $header["uri"]);
103+
$results[] = new ResultItem($header["id"], $header["uri"], $batchid);
102104
}
103105

104106
return $results;

0 commit comments

Comments
 (0)