/** * Get the pagination, in the future it would be nice to have some additional * pagination methods * @param TraversableObject $object * @return string */ private function getPaginationXML(Transformable $object) { $xml = ""; if (ctype_digit("{$object->getResultsPerPage()}")) { $xml .= "<pagination>"; for ($i = 0; $i < $object->getMaxNumResults(); $i += $object->getResultsPerPage()) { $selected = $i == $object->getCurrentResultNumber() ? " selected='true'" : ""; $end = $i + $object->getResultsPerPage() < $object->getMaxNumResults() ? $i + $object->getResultsPerPage() : $object->getMaxNumResults(); $xml .= "\n <page{$selected}>\n <start>{$i}</start>\n <end>{$end}</end>\n </page>"; } $xml .= "</pagination>"; } return $xml; }