Created
March 15, 2013 09:28
-
-
Save datibbaw/5168597 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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