Ejemplo n.º 1
0
 /**
  * gerenates the value names in the usage line
  * 
  * @param array $named_args_spec value names specifications
  *
  * @return mixed Value.
  */
 protected function generateValueNamesHelp($named_args_spec)
 {
     $first = true;
     $out = '';
     foreach ($named_args_spec as $named_arg_spec) {
         $out .= $first ? '' : ' ';
         if ($named_arg_spec['required']) {
             $out .= ConsoleFormat::applyformatToText('bold', 'yellow', '<' . $named_arg_spec['name'] . '>');
         } else {
             $out .= '[<' . $named_arg_spec['name'] . '>]';
         }
         $first = false;
     }
     return $out;
 }
Ejemplo n.º 2
0
 /**
  * @return string
  */
 public function getStyleCode()
 {
     $styleCodes = [];
     if (!$this->isAllowingInheritance()) {
         $styleCodes[] = 0;
     }
     $colorCode = ConsoleColor::getColorCode($this->getColor());
     if ($colorCode !== null) {
         $styleCodes[] = $colorCode;
     }
     $backgroundCode = ConsoleBackground::getBackgroundCode($this->getBackground());
     if ($backgroundCode !== null) {
         $styleCodes[] = $backgroundCode;
     }
     foreach ($this->getFormat() as $format) {
         $formatCode = ConsoleFormat::getFormatCode($format);
         if ($formatCode !== null) {
             $styleCodes[] = $formatCode;
         }
     }
     return implode(';', $styleCodes);
 }