/** * Sets up test case * */ public function setUp() { $root = new RootDoc(); $root->addSourceLoader($this->getClass()->getClassLoader()); $this->holder = new Doc(); $this->holder->setRoot($root); }
/** * Runner method * */ public static function main(array $args) { // Show command usage if invoked without arguments if (!$args) { exit(self::usage(\lang\XPClass::forName(\xp::nameOf(__CLASS__)))); } $root = new RootDoc(); for ($i = 0, $s = sizeof($args); $i < $s; $i++) { if ('-sp' === $args[$i]) { $root->setSourcePath(explode(PATH_SEPARATOR, $args[++$i])); } else { if ('-cp' === $args[$i]) { foreach (explode(PATH_SEPARATOR, $args[++$i]) as $element) { \lang\ClassLoader::registerPath($element); } } else { try { $class = \lang\XPClass::forName($args[$i]); } catch (\lang\ClassNotFoundException $e) { \util\cmd\Console::$err->writeLine('*** ', $e->getMessage()); exit(2); } if (!$class->isSubclassOf('text.doclet.Doclet')) { \util\cmd\Console::$err->writeLine('*** ', $class, ' is not a doclet'); exit(2); } $doclet = $class->newInstance(); $params = new ParamString(array_slice($args, $i)); // Show doclet usage if the command line contains "-?" (at any point). if ($params->exists('help', '?')) { self::usage($class); if ($valid = $doclet->validOptions()) { \util\cmd\Console::$err->writeLine(); \util\cmd\Console::$err->writeLine('Options:'); foreach ($valid as $name => $value) { \util\cmd\Console::$err->writeLine(' * --', $name, OPTION_ONLY == $value ? '' : '=<value>'); } } exit(3); } $root->start($doclet, $params); exit(0); } } } \util\cmd\Console::$err->writeLine('*** No doclet classname given'); exit(1); }
/** * Sets up test case * */ public function setUp() { $root = new RootDoc(); $root->addSourceLoader($this->getClass()->getClassLoader()); $this->fixture = $root->classNamed($this->getClassName()); }