/** * Execute the parsing process. * * @throws Zend_Console_Getopt_Exception * * @return void */ public function execute() { $files = new DocBlox_Parser_Files(); $files->setAllowedExtensions($this->getExtensions()); $files->setIgnorePatterns($this->getIgnore()); $paths = array_unique($this->getFilename() ? explode(',', $this->getFilename()) : DocBlox_Core_Abstract::config()->getArrayFromPath('files/file')); $files->addFiles($paths); $paths = array_unique($this->getDirectory() || !empty($paths) ? explode(',', $this->getDirectory()) : DocBlox_Core_Abstract::config()->getArrayFromPath('files/directory')); $files->addDirectories($paths); $parser = new DocBlox_Parser(); $parser->setTitle(htmlentities($this->getTitle())); $parser->setExistingXml($this->getTarget() . '/structure.xml'); $parser->setForced($this->getForce()); $parser->setMarkers($this->getMarkers()); $parser->setValidate($this->getValidate()); $parser->setVisibility($this->getVisibility()); $parser->setDefaultPackageName($this->getDefaultpackagename()); $parser->setPath($files->getProjectRoot()); try { // save the generate file to the path given as the 'target' option file_put_contents($this->getTarget() . '/structure.xml', $parser->parseFiles($files)); } catch (Exception $e) { if ($e->getCode() === DocBlox_Parser_Exception::NO_FILES_FOUND) { throw new Zend_Console_Getopt_Exception('No parsable files were found, did you specify any using the -f or -d parameter?'); } throw new Zend_Console_Getopt_Exception($e->getMessage()); } }