Skip to content

Instantly share code, notes, and snippets.

@datibbaw
Created March 15, 2013 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save datibbaw/5168597 to your computer and use it in GitHub Desktop.
Save datibbaw/5168597 to your computer and use it in GitHub Desktop.
class WhampoaJobStatus
{
const STATUS_COMPLETED = 'completed';
const STATUS_FAILED = 'failed';
private $doc;
public function loadFromXML($source)
{
$this->doc = new DOMDocument();
$this->doc->loadXML($source);
}
public function getStatus()
{
$xp = new DOMXPath($this->doc);
if (($status = $xp->query('/jobStatus/status')->item(0)) === null) {
throw new Exception("Could not determine status");
}
return trim($status->textContent);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment