예제 #1
0
 /**
  * @return string
  */
 public function generate()
 {
     $res = '';
     foreach ($this->titles as $title) {
         $res .= CLIHelper::EOL . CLIHelper::writeColoredLn($title, CLIHelper::COLOR_LIGHT_PURPLE) . CLIHelper::EOL;
     }
     if ($this->usages) {
         $this->addInfoBlock('USAGE', $this->usages);
     }
     if ($this->descriptions) {
         $this->addInfoBlock('DESCRIPTION', $this->descriptions);
     }
     if ($this->actions) {
         $this->addInfoBlock('ACTIONS', $this->buildActions());
     }
     if ($this->examples) {
         $this->addInfoBlock('EXAMPLES', $this->examples);
     }
     foreach ($this->infoBlocks as $infoBlockTitle => $infoBlockContents) {
         $res .= CLIHelper::writeColoredLn($infoBlockTitle, CLIHelper::COLOR_PURPLE);
         $res .= implode(CLIHelper::EOL, array_map(function ($v) {
             return CLIHelper::TAB . $v;
         }, $infoBlockContents));
         $res .= CLIHelper::EOL . CLIHelper::EOL;
     }
     return $res;
 }
예제 #2
0
 protected function applyException(Exception $e)
 {
     CLIHelper::outputLn(CLIHelper::writeColoredLn($e->getMessage(), $e::COLOR));
     if ($e::IS_FATAL) {
         exit(1);
     }
 }