getDomFromZip($this->docFile, $this->xmlFile); $docProps = $phpWord->getDocumentProperties(); $nodes = $xmlReader->getElements('*'); if ($nodes->length > 0) { foreach ($nodes as $node) { if (!array_key_exists($node->nodeName, $this->mapping)) { continue; } $method = $this->mapping[$node->nodeName]; $value = $node->nodeValue == '' ? null : $node->nodeValue; if (array_key_exists($node->nodeName, $this->callbacks)) { $value = $this->callbacks[$node->nodeName]($value); } if (method_exists($docProps, $method)) { $docProps->$method($value); } } } } }