예제 #1
0
파일: parse.php 프로젝트: namesco/Docblox
  if (count($opts->getFiles()) < 1)
  {
    throw new Zend_Console_Getopt_Exception('No parsable files were found, did you specify any using the -f or -d parameter?');
  }

} catch (Zend_Console_Getopt_Exception $e)
{
  // if the message actually contains anything, show it.
  if ($e->getMessage())
  {
    echo $e->getMessage() . PHP_EOL . PHP_EOL;
  }

  // show help message and exit the application
  echo $opts->getUsageMessage();
  exit;
}

// initialize the parser and pass the options as provided by the user or defaults
$docblox = new DocBlox_Parser();
$docblox->setLogLevel($opts->getOption('verbose') ? Zend_Log::DEBUG : $docblox->getLogLevel());
$docblox->setExistingXml(is_readable($path.'/structure.xml') ? file_get_contents($path.'/structure.xml') : null);
$docblox->setIgnorePatterns($opts->getIgnorePatterns());
$docblox->setForced($opts->getOption('force'));
$docblox->setMarkers($opts->getMarkers());
$docblox->setValidate($opts->getOption('validate'));

// save the generate file to the path given as the 'target' option
file_put_contents($path.'/structure.xml', $docblox->parseFiles($opts->getFiles()));