.
class BzBug {
private $id;
private $product;
private $shortDesc;
private $dateCreated;
private $assignedTo;
private $reportedBy;
private $status;
private $priority;
private $severity;
public function getId() {
return $this->id;
}
public function getProduct() {
return $this->product;
}
public function getShortDesc() {
return $this->shortDesc;
}
public function getDateCreated() {
return $this->dateCreated;
}
public function getAssignedTo() {
return $this->assignedTo;
}
public function getReportedBy() {
return $this->reportedBy;
}
public function getStatus() {
return $this->status;
}
public function getPriority() {
return $this->priority;
}
public function getSeverity() {
return $this->severity;
}
public function setId($id) {
return $this->id = $id;
}
public function setProduct($p) {
return $this->product = $p;
}
public function setShortDesc($d) {
return $this->shortDesc = $d;
}
public function setDateCreated($d) {
return $this->dateCreated = $d;
}
public function setAssignedTo($a) {
return $this->assignedTo = $a;
}
public function setReportedBy($r) {
return $this->reportedBy = $r;
}
public function setStatus($s) {
return $this->status = $s;
}
public function setPriority($p) {
return $this->priority = $p;
}
public function setSeverity($s) {
return $this->severity = $s;
}
public function unmarshall($xmlBugString) {
$bugArray = array();
try {
$xml = simplexml_load_string($xmlBugString);
$bugs = $xml->bug;
//echo "FETCHED ".sizeof($bugs). "BUGS!
";
foreach ($bugs as $bug) {
$b = new BzBug();
$b->setId((string)$bug->bug_id);
$b->setDateCreated((string)$bug->creation_ts);
$b->setAssignedTo((string)$bug->assigned_to);
$b->setReportedBy((string)$bug->reporter);
$b->setShortDesc((string)$bug->short_desc);
$b->setProduct((string)$bug->product);
$b->setStatus((string)$bug->bug_status);
$b->setSeverity((string)$bug->bug_severity);
$b->setPriority((string)$bug->priority);
$bugArray[] = $b;
}
} catch (Exception $e) {
//invalid xml string
die("ERROR unmarshalling xml from bugzilla:".$e->getMessage());
}
return $bugArray;
}
}
?>