Esempio n. 1
0
 /**
  * Execute the parsing process.
  *
  * @throws Zend_Console_Getopt_Exception
  *
  * @return void
  */
 public function execute()
 {
     $files = $this->parseFiles();
     if (count($files) < 1) {
         throw new Zend_Console_Getopt_Exception('No parsable files were found, did you specify any using the -f or -d parameter?');
     }
     $parser = new DocBlox_Parser();
     $parser->setTitle(htmlentities($this->getTitle()));
     if ($this->getVerbose()) {
         $parser->setLogLevel(DocBlox_Core_Log::DEBUG);
     }
     if ($this->getQuiet()) {
         $parser->setLogLevel(DocBlox_Core_Log::QUIET);
     }
     $parser->setExistingXml($this->getTarget() . '/structure.xml');
     $parser->setIgnorePatterns($this->getIgnore());
     $parser->setExtensions($this->getExtensions());
     $parser->setForced($this->getForce());
     $parser->setMarkers($this->getMarkers());
     $parser->setValidate($this->getValidate());
     $parser->setVisibility($this->getVisibility());
     $parser->setPath($parser->getCommonPath($files));
     // save the generate file to the path given as the 'target' option
     file_put_contents($this->getTarget() . '/structure.xml', $parser->parseFiles($files));
 }
Esempio n. 2
0
 /**
  * Make sure the setter can transform string to array and set correct attribute
  *
  * @covers DocBlox_Parser::setVisibility
  *
  * @return void
  */
 public function testSetVisibilityCorrectlySetsAttribute()
 {
     $this->fixture->setVisibility('public,protected,private');
     $this->assertAttributeEquals(array('public', 'protected', 'private'), 'visibility', $this->fixture);
 }
Esempio n. 3
0
 /**
  * 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());
     }
 }