private function processSpineElement(SimpleXMLElement $xml, Spine $spine, Manifest $manifest, Navigation $navigation) { $position = 1; foreach ($xml->itemref as $child) { $id = (string) $child['idref']; $manifestItem = $manifest->get($id); if (!($linear = $child['linear'])) { $linear = 'yes'; } $item = new SpineItem(); $item->id = $id; $item->type = $manifestItem->type; $item->href = $manifestItem->href; $item->order = $position; $item->linear = $linear; $this->addContentGetter($item); $spine->add($item); $position++; } $ncxId = $xml['toc'] ? (string) $xml['toc'] : 'ncx'; if ($manifest->has($ncxId)) { $navigation->src = $manifest->get($ncxId); } }