當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Command::asText方法代碼示例

本文整理匯總了PHP中Symfony\Component\Console\Command\Command::asText方法的典型用法代碼示例。如果您正苦於以下問題:PHP Command::asText方法的具體用法?PHP Command::asText怎麽用?PHP Command::asText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\Console\Command\Command的用法示例。


在下文中一共展示了Command::asText方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (is_null($this->command)) {
         $this->command = $this->getApplication()->get($input->getArgument('command_name'));
     }
     $output->writeln($this->command->asText());
 }
開發者ID:piece,項目名稱:stagehand-testrunner,代碼行數:7,代碼來源:HelpCommand.php

示例2: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($this->command !== NULL) {
         // Help for an individual command.
         $output->page($this->command->asText());
         $this->command = NULL;
     } elseif ($name = $input->getArgument('command_name')) {
         // Help for an individual command.
         $output->page($this->getApplication()->get($name)->asText());
     } else {
         $categories = [];
         // List available commands.
         $commands = $this->getApplication()->all();
         // Find the alignment width.
         $width = 0;
         foreach ($commands as $command) {
             $width = strlen($command->getName()) > $width ? strlen($command->getName()) : $width;
         }
         $width += 2;
         foreach ($commands as $name => $command) {
             if ($name !== $command->getName()) {
                 continue;
             }
             if ($command->getAliases()) {
                 $aliases = sprintf('  <comment>Aliases:</comment> %s', implode(', ', $command->getAliases()));
             } else {
                 $aliases = '';
             }
             if ($command instanceof DrushCommand) {
                 $category = (string) $command->getCategory();
             } else {
                 $category = static::PSYSH_CATEGORY;
             }
             if (!isset($categories[$category])) {
                 $categories[$category] = [];
             }
             $categories[$category][] = sprintf("    <info>%-{$width}s</info> %s%s", $name, $command->getDescription(), $aliases);
         }
         $messages = [];
         foreach ($categories as $name => $category) {
             $messages[] = '';
             $messages[] = sprintf('<comment>%s</comment>', OutputFormatter::escape($name));
             foreach ($category as $message) {
                 $messages[] = $message;
             }
         }
         $output->page($messages);
     }
 }
開發者ID:bjargud,項目名稱:drush,代碼行數:52,代碼來源:DrushHelpCommand.php

示例3: asText

 /**
  * Returns the text representation of the command.
  *
  * @return string The string that represents the command
  */
 public function asText()
 {
     $app = $this->getApplication()->getApp();
     $txt = $app['app.signature'] . "\n" . parent::asText();
     return $txt;
 }
開發者ID:jlaso,項目名稱:easybook,代碼行數:11,代碼來源:BaseCommand.php

示例4: asText

 public function asText()
 {
     return $this->innerCommand->asText();
 }
開發者ID:lolautruche,項目名稱:ezsh,代碼行數:4,代碼來源:WrappedCommand.php


注:本文中的Symfony\Component\Console\Command\Command::asText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。