/** * Parse the readMore result from readReport to determine the number of remaining records to retrieve. * * @param simpleXmlElement $reportResult * @return int */ private static function getRecordsLeftAttribute(simpleXmlElement $reportResult) { $recordsLeft = 0; foreach ($reportResult->attributes() as $key => $value) { if ($key == 'numremaining') { $recordsLeft = (int) $value; } } return $recordsLeft; }