当前位置: 首页>>代码示例>>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;未经允许,请勿转载。