Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Dispatch Parse : add batchid
  • Loading branch information
gaetanV committed Nov 12, 2018
commit 531941e9c71d89c46a8bd9a765cd8e8611a246a5
13 changes: 12 additions & 1 deletion src/Esendex/Model/ResultItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand All @@ -64,4 +67,12 @@ public function uri()
{
return $this->uri;
}

/**
* @return string
*/
public function batchid()
{
return $this->batchid;
}
}
4 changes: 3 additions & 1 deletion src/Esendex/Parser/DispatchXmlParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ public function parse($xml)
throw new XmlException("Xml is missing <messageheaders /> 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;
Expand Down