/**
  * Main entry point into the application.
  *
  * @return void
  */
 public function main()
 {
     $runner = new DocBlox_Task_Runner($_SERVER['argc'] == 1 ? false : $_SERVER['argv'][1], 'project:run');
     $task = $runner->getTask();
     $threshold = DocBlox_Core_Log::WARN;
     if (!$task->getQuiet()) {
         DocBlox_Core_Application::renderVersion();
     } else {
         $threshold = DocBlox_Core_Log::QUIET;
     }
     if ($task->getVerbose()) {
         $threshold = DocBlox_Core_Log::DEBUG;
     }
     $dispatcher = new sfEventDispatcher();
     $logger = new DocBlox_Core_Log(DocBlox_Core_Log::FILE_STDOUT);
     $logger->setThreshold($threshold);
     $dispatcher->connect('system.log', array($logger, 'log'));
     DocBlox_Parser_Abstract::$event_dispatcher = $dispatcher;
     DocBlox_Transformer_Abstract::$event_dispatcher = $dispatcher;
     DocBlox_Reflection_Abstract::$event_dispatcher = $dispatcher;
     try {
         $task->execute();
     } catch (Exception $e) {
         if (!$task->getQuiet()) {
             echo 'ERROR: ' . $e->getMessage() . PHP_EOL . PHP_EOL;
             echo $task->getUsageMessage();
         }
         die(1);
     }
 }
Example #2
0
 /**
  * Main entry point into the application
  *
  * @return void
  */
 public function main()
 {
     require_once 'Image/GraphViz.php';
     require_once 'markdown.php';
     $runner = new DocBlox_Task_Runner($_SERVER['argc'] == 1 ? 'project:run' : $_SERVER['argv'][1]);
     $task = $runner->getTask();
     if (!$task->getQuiet()) {
         DocBlox_Core_Application::renderVersion();
     }
     try {
         $task->execute();
     } catch (Exception $e) {
         echo 'ERROR: ' . $e->getMessage() . PHP_EOL . PHP_EOL;
         echo $task->getUsageMessage();
     }
 }
Example #3
0
 /**
  * Main entry point into the application.
  *
  * @return void
  */
 public function main()
 {
     require_once 'markdown.php';
     $runner = new DocBlox_Task_Runner($_SERVER['argc'] == 1 ? false : $_SERVER['argv'][1], 'project:run');
     $task = $runner->getTask();
     if (!$task->getQuiet()) {
         DocBlox_Core_Application::renderVersion();
     }
     try {
         $task->execute();
     } catch (Exception $e) {
         echo 'ERROR: ' . $e->getMessage() . PHP_EOL . PHP_EOL;
         echo $task->getUsageMessage();
         // exit with the exception's code or 1 if null/0
         $exit = $e->getCode();
         if (!$exit) {
             $exit = 1;
         }
         exit($exit);
     }
 }