/** * Loads the specification from a XML file * * @param string $file Path to the file to load */ public function load($file) { if (!file_exists($file)) { throw new \RuntimeException(sprintf('The file "%s" does not exists', $file)); } $content = file_get_contents($file); // HACK: DOMNode seems to bug when a node is named "param" $content = str_replace('<param', '<parameter', $content); $content = str_replace('</param', '</parameter', $content); $crawler = new Crawler(); $crawler->addContent($content, 'xml'); foreach ($crawler->filterXPath('//function') as $node) { $method = $this->getMethod($node); $this->specification->addMethod($method); } }