collection}"; $collection = $phpWord->$getMethod()->getItems(); $xmlReader = new XMLReader(); $xmlReader->getDomFromZip($this->docFile, $this->xmlFile); $nodes = $xmlReader->getElements('*'); if ($nodes->length > 0) { foreach ($nodes as $node) { $id = $xmlReader->getAttribute('w:id', $node); $type = $xmlReader->getAttribute('w:type', $node); // Avoid w:type "separator" and "continuationSeparator" // Only look for or without w:type attribute if (is_null($type) && array_key_exists($id, $collection)) { $element = $collection[$id]; $pNodes = $xmlReader->getElements('w:p/*', $node); foreach ($pNodes as $pNode) { $this->readRun($xmlReader, $pNode, $element, $this->collection); } $addMethod = "add{$this->element}"; $phpWord->$addMethod($element); } } } } }