original_string: public function help($subcommand = null, $format = 'text', $width = 72)
      {
          if ($subcommand === null) {
              $formatter = new HelpFormatter($this);
              $formatter->setAlias($this->rootName);
  
              if ($format === 'text') {
                  return $formatter->text($width);
              }
              if ($format === 'xml') {
                  return (string)$formatter->xml();
              }
          }
  
          if (isset($this->_subcommands[$subcommand])) {
              $command = $this->_subcommands[$subcommand];
              $subparser = $command->parser();
  
              // Generate a parser as the subcommand didn't define one.
              if (!($subparser instanceof self)) {
                  // $subparser = clone $this;
                  $subparser = new self($subcommand);
                  $subparser
                      ->setDescription($command->getRawHelp())
                      ->addOptions($this->options())
                      ->addArguments($this->arguments());
              }
              if (strlen($subparser->getDescription()) === 0) {
                  $subparser->setDescription($command->getRawHelp());
              }
              $subparser->setCommand($this->getCommand() . ' ' . $subcommand);
              $subparser->setRootName($this->rootName);
  
              return $subparser->help(null, $format, $width);
          }
  
          return $this->getCommandError($subcommand);
      }
code: public function help($subcommand = null, $format = 'text', $width = 72)
      {
          if ($subcommand === null) {
              $formatter = new HelpFormatter($this);
              $formatter->setAlias($this->rootName);
  
              if ($format === 'text') {
                  return $formatter->text($width);
              }
              if ($format === 'xml') {
                  return (string)$formatter->xml();
              }
          }
  
          if (isset($this->_subcommands[$subcommand])) {
              $command = $this->_subcommands[$subcommand];
              $subparser = $command->parser();
  
              // Generate a parser as the subcommand didn't define one.
              if (!($subparser instanceof self)) {
                  // $subparser = clone $this;
                  $subparser = new self($subcommand);
                  $subparser
                      ->setDescription($command->getRawHelp())
                      ->addOptions($this->options())
                      ->addArguments($this->arguments());
              }
              if (strlen($subparser->getDescription()) === 0) {
                  $subparser->setDescription($command->getRawHelp());
              }
              $subparser->setCommand($this->getCommand() . ' ' . $subcommand);
              $subparser->setRootName($this->rootName);
  
              return $subparser->help(null, $format, $width);
          }
  
          return $this->getCommandError($subcommand);
      }
code_tokens: public function help ( $ subcommand = null , $ format = 'text' , $ width = 72 ) { if ( $ subcommand === null ) { $ formatter = new HelpFormatter ( $ this ) ; $ formatter -> setAlias ( $ this -> rootName ) ; if ( $ format === 'text' ) { return $ formatter -> text ( $ width ) ; } if ( $ format === 'xml' ) { return ( string ) $ formatter -> xml ( ) ; } } if ( isset ( $ this -> _subcommands [ $ subcommand ] ) ) { $ command = $ this -> _subcommands [ $ subcommand ] ; $ subparser = $ command -> parser ( ) ; // Generate a parser as the subcommand didn't define one. if ( ! ( $ subparser instanceof self ) ) { // $subparser = clone $this; $ subparser = new self ( $ subcommand ) ; $ subparser -> setDescription ( $ command -> getRawHelp ( ) ) -> addOptions ( $ this -> options ( ) ) -> addArguments ( $ this -> arguments ( ) ) ; } if ( strlen ( $ subparser -> getDescription ( ) ) === 0 ) { $ subparser -> setDescription ( $ command -> getRawHelp ( ) ) ; } $ subparser -> setCommand ( $ this -> getCommand ( ) . ' ' . $ subcommand ) ; $ subparser -> setRootName ( $ this -> rootName ) ; return $ subparser -> help ( null , $ format , $ width ) ; } return $ this -> getCommandError ( $ subcommand ) ; }
docstring: Gets formatted help for this parser object.
  
  Generates help text based on the description, options, arguments, subcommands and epilog
  in the parser.
  
  @param string|null $subcommand If present and a valid subcommand that has a linked parser.
  That subcommands help will be shown instead.
  @param string $format Define the output format, can be text or xml
  @param int $width The width to format user content to. Defaults to 72
  @return string Generated help.
docstring_tokens: Gets formatted help for this parser object .