public function findUnitNodesBySrcFile($path) { $src = mb_substr($path, mb_strlen($this->srcDir) + 1); return $this->getRootElement()->query(sprintf('//*[@src="%s"]', $src)); }
/** * @param string $path */ private function removeFileReferences($path) { foreach($this->index->findUnitNodesBySrcFile($path) as $node) { /** @var $node \DOMElement */ $fname = $this->xmlDir . '/' . $node->getAttribute('xml'); if (file_exists($fname)) { unlink($fname); } $node->parentNode->removeChild($node); } }