function GoogleMini::resultFactory in Google Search Appliance 5
Same name and namespace in other branches
- 6.2 GoogleMini.php \GoogleMini::resultFactory()
2 calls to GoogleMini::resultFactory()
File
- ./
GoogleMini.php, line 313
Class
Code
function resultFactory($resultXML, $className = 'GoogleMiniResultIterator') {
$results = array();
$payload = simplexml_load_string($resultXML);
$totalResults = $payload->RES->M;
if ($totalResults == 0) {
if (!$payload->GM) {
throw new GoogleMiniResultException("No Results found", '1');
}
}
else {
foreach ($payload
->xpath('//R') as $res) {
$results[] = $res;
}
}
$iterator = new $className($results);
$iterator->payload = $payload;
$iterator->time = $payload->TM;
$iterator->totalResults = $totalResults;
return $iterator;
}