当前位置: 首页>>代码示例>>PHP>>正文


PHP Command::getHelper方法代码示例

本文整理汇总了PHP中Symfony\Component\Console\Command\Command::getHelper方法的典型用法代码示例。如果您正苦于以下问题:PHP Command::getHelper方法的具体用法?PHP Command::getHelper怎么用?PHP Command::getHelper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Console\Command\Command的用法示例。


在下文中一共展示了Command::getHelper方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: it_opens_a_dialog_to_select_the_entity_and_count_if_no_entity_given

 /** @test */
 public function it_opens_a_dialog_to_select_the_entity_and_count_if_no_entity_given()
 {
     /** @var SymfonyQuestionHelper $question */
     $question = $this->command->getHelper('question');
     $question->setInputStream($this->getInputStream("1\n5\n"));
     $this->commandTester->execute(['command' => $this->command->getName()]);
     $count = $this->getDatabaseCount(App::class, []);
     $this->assertEquals(5, $count);
     $this->assertContains(sprintf('%s seeded.', App::class), $this->commandTester->getDisplay());
 }
开发者ID:bitecodes,项目名称:factrine-bundle,代码行数:11,代码来源:FactrineSeedEntityCommandTest.php

示例2: createPlayerDialog

 public function createPlayerDialog(Command $command, OutputInterface $output)
 {
     /** @var $dialog DialogHelper */
     $dialog = $command->getHelperSet()->get("dialog");
     /** @var $translations TranslationsHelperInterface */
     $translations = $command->getHelper("translations");
     $player = new PlayerDataHelper();
     $player->name = $dialog->ask($output, $translations->getLine("player_name") . ": ");
     $player->sex = $dialog->ask($output, $translations->getLine("player_sex_cmd") . ": ");
     $player->class = $dialog->ask($output, $translations->getLine("player_class_cmd") . ": ");
     $player->race = $dialog->ask($output, $translations->getLine("player_race_cmd") . ": ");
     return $player;
 }
开发者ID:mbabenko21,项目名称:likedimion-server,代码行数:13,代码来源:LikedimionCommandHelper.php

示例3: render

 public function render($results, Command $command)
 {
     $phpVersion = $this->getOption('phpVersion');
     $checksCount = $this->getOption('checksCount');
     $failCount = $this->getOption('failCount');
     $output = $this->getOutput();
     $output->writeLn('Executing against version: ' . $phpVersion);
     $table = $command->getHelper('table');
     $table->setHeaders(array('Status', 'CVE ID', 'Risk', 'Summary'));
     $columnSize = 100;
     for ($i = 0, $length = count($results); $i < $length; $i++) {
         $results[$i]['status'] = 'fail' ? '<fg=red>FAIL</fg=red>' : '<fg=green>PASS</fg=green>';
         $results[$i]['summary'] = !$output->isVerbose() && strlen($results[$i]['summary']) > $columnSize ? substr($results[$i]['summary'], 0, $columnSize - 3) . '...' : $results[$i]['summary'];
     }
     $table->setRows($results);
     $table->render($output);
     $output->writeLn(sprintf("\nScan complete\n%s\nTotal checks: %s\n<fg=red>Failures: %s</fg=red>\n", str_repeat('-', 20), $checksCount, $failCount));
 }
开发者ID:paulofreitas,项目名称:versionscan,代码行数:18,代码来源:Console.php

示例4: getHelper

 /**
  * {@inheritdoc}
  */
 public function getHelper($name)
 {
     return $this->decoratedCommand->getHelper($name);
 }
开发者ID:frankdejonge,项目名称:locked-console-command,代码行数:7,代码来源:LockedCommandDecorator.php

示例5: testCommandWithWrongInputsNumber

 /**
  * @expectedException \RuntimeException
  * @expectedMessage   Aborted
  */
 public function testCommandWithWrongInputsNumber()
 {
     $questions = array('What\'s your name?', 'How are you?', 'Where do you come from?');
     $command = new Command('foo');
     $command->setHelperSet(new HelperSet(array(new QuestionHelper())));
     $command->setCode(function ($input, $output) use($questions, $command) {
         $helper = $command->getHelper('question');
         $helper->ask($input, $output, new Question($questions[0]));
         $helper->ask($input, $output, new Question($questions[1]));
         $helper->ask($input, $output, new Question($questions[2]));
     });
     $tester = new CommandTester($command);
     $tester->setInputs(array('Bobby', 'Fine'));
     $tester->execute(array());
 }
开发者ID:Gladhon,项目名称:symfony,代码行数:19,代码来源:CommandTesterTest.php

示例6: getDestinationHelper

 /**
  * @return DestinationHelper
  */
 private function getDestinationHelper() : DestinationHelper
 {
     return parent::getHelper('link.destination');
 }
开发者ID:LartTyler,项目名称:Link,代码行数:7,代码来源:GenerateEntityCommand.php

示例7: getHelper

 public function getHelper($name)
 {
     return $this->innerCommand->getHelper($name);
 }
开发者ID:lolautruche,项目名称:ezsh,代码行数:4,代码来源:WrappedCommand.php

示例8: getHelper

 public function getHelper($name)
 {
     return parent::getHelper($name);
 }
开发者ID:notbrain,项目名称:symfony,代码行数:4,代码来源:TestCommand.php

示例9: setExpectedCommandInput

 /**
  * @param Command      $command
  * @param array|string $input
  */
 protected function setExpectedCommandInput(Command $command, $input)
 {
     if (is_array($input)) {
         $input = implode("\n", $input);
     }
     $helper = $command->getHelper('gush_question');
     $helper->setInputStream($this->getInputStream($input));
 }
开发者ID:gushphp,项目名称:gush,代码行数:12,代码来源:CommandTestCase.php

示例10: getHelper

 /**
  * {@inheritdoc}
  */
 public function getHelper($name)
 {
     $helper = parent::getHelper($name);
     if ($this->input !== null && $helper instanceof InputAwareInterface) {
         $helper->setInput($this->input);
     }
     if ($this->output !== null && $helper instanceof OutputAwareInterface) {
         $helper->setOutput($this->output);
     }
     return $helper;
 }
开发者ID:commerceguys,项目名称:platform-cli,代码行数:14,代码来源:CommandBase.php


注:本文中的Symfony\Component\Console\Command\Command::getHelper方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。