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


PHP Command::getName方法代码示例

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


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

示例1: assert

 /**
  * @param $condition
  * @param $message
  */
 private function assert($condition, $message)
 {
     if ($condition) {
         return;
     }
     throw new RuntimeException(sprintf('Command %s is not available because %s.', $this->command->getName(), $message));
 }
开发者ID:netz98,项目名称:n98-magerun,代码行数:11,代码来源:Enabler.php

示例2: getDependencies

 /**
  * @param Command $command
  * @return array
  */
 public function getDependencies(Command $command)
 {
     if (!array_key_exists($command->getName(), $this->commands)) {
         return [];
     }
     return array_keys($this->commands[$command->getName()]);
 }
开发者ID:sergeyz,项目名称:cc,代码行数:11,代码来源:ChainCommandRegistry.php

示例3: testExecute

 /**
  * Test executing "mark_migration"
  *
  * @return void
  */
 public function testExecute()
 {
     $commandTester = new CommandTester($this->command);
     $commandTester->execute(['command' => $this->command->getName(), 'version' => '20150416223600', '--connection' => 'test']);
     $this->assertContains('Migration successfully marked migrated !', $commandTester->getDisplay());
     $result = $this->Connection->newQuery()->select(['*'])->from('phinxlog')->execute()->fetch('assoc');
     $this->assertEquals('20150416223600', $result['version']);
 }
开发者ID:ansidev,项目名称:cakephp_blog,代码行数:13,代码来源:MarkMigratedTest.php

示例4: getCommandName

 /**
  * {@inheritdoc}
  */
 protected function getCommandName(InputInterface $input)
 {
     $stream = $this->getStdinStream();
     $hasStdin = $stream->getSize() > 0;
     $this->pluginCommand->setStream($stream);
     return $hasStdin ? $this->pluginCommand->getName() : $this->generateCommand->getName();
 }
开发者ID:protobuf-php,项目名称:protobuf-plugin,代码行数:10,代码来源:Application.php

示例5: describeCommand

 /**
  * @inheritdoc
  */
 protected function describeCommand(Command $command, array $options = [])
 {
     $command->getSynopsis();
     $command->mergeApplicationDefinition(false);
     $this->write($command->getName() . "\n" . str_repeat('-', strlen($command->getName())) . "\n");
     if ($description = $command->getDescription()) {
         $this->write("{$description}\n\n");
     }
     $aliases = $command instanceof CommandBase ? $command->getVisibleAliases() : $command->getAliases();
     if ($aliases) {
         $this->write('Aliases: ' . '`' . implode('`, `', $aliases) . '`' . "\n\n");
     }
     $executableName = 'platform';
     $this->write("## Usage:\n\n```\n{$executableName} " . $command->getSynopsis() . "\n```\n\n");
     if ($help = $command->getProcessedHelp()) {
         $this->write($help);
         $this->write("\n\n");
     }
     if ($command->getNativeDefinition()) {
         $this->describeInputDefinition($command->getNativeDefinition());
         $this->write("\n\n");
     }
     if ($command instanceof CommandBase && ($examples = $command->getExamples())) {
         $this->write('## Examples');
         $this->write("\n");
         $name = $command->getName();
         foreach ($examples as $arguments => $description) {
             $this->write("\n* {$description}:  \n  ```\n  platform {$name} {$arguments}\n  ```\n");
         }
         $this->write("\n");
     }
 }
开发者ID:drewmelck,项目名称:platformsh-cli,代码行数:35,代码来源:CustomMarkdownDescriptor.php

示例6: execute

 private function execute(array $fileStructure, array $options = []) : CommandTester
 {
     $fs = vfsStream::create($fileStructure, vfsStream::setup(getcwd()));
     $commandTester = new CommandTester($this->command);
     $commandTester->execute(array_merge(['command' => $this->command->getName(), 'path' => $fs->url()], $options));
     return $commandTester;
 }
开发者ID:phpassert,项目名称:phpassert,代码行数:7,代码来源:TestTestCommand.php

示例7: testDumpCommandExecute

 public function testDumpCommandExecute()
 {
     /** @var OrganizeCommand $command */
     $noTagDir = __DIR__ . '/NO_TAG';
     $this->commandTester->execute(['command' => $this->command->getName(), 'output-dir' => __DIR__, '--file-dir' => realpath(__DIR__ . '/../'), '--dump-command' => ' ', '--move-untagged-to' => $noTagDir]);
     $output = $this->commandTester->getDisplay();
     $outputArray = array_map('trim', explode(PHP_EOL, $output));
     $this->assertEquals('mv \'' . realpath(__DIR__ . '/../') . '/toddle.mp3\' \'' . __DIR__ . '/2003/Celtic/toddle.mp3\'', $outputArray[0]);
     $this->assertEquals('mv \'' . realpath(__DIR__ . '/../') . '/wrong_file.mp3\' \'' . __DIR__ . '/NO_TAG/wrong_file.mp3\'', $outputArray[1]);
 }
开发者ID:Pyrex-FWI,项目名称:sapar-mfo,代码行数:10,代码来源:OrganizeFileCommandTest.php

示例8: __construct

 /**
  * Unique file name pid file name.
  *
  * @param Command $command
  * @param null|string $tmpDirectory
  */
 public function __construct(Command $command, $tmpDirectory = null)
 {
     $tmpDirectory = $tmpDirectory ? $tmpDirectory : sys_get_temp_dir();
     if (!is_dir($tmpDirectory) or !is_writable($tmpDirectory)) {
         throw new \RuntimeException(sprintf('The directory "%s" is not writable.', $tmpDirectory), 0, null, $tmpDirectory);
     }
     $partName = preg_replace('/[^a-z0-9\\._-]+/i', '-', $command->getName());
     $partName = substr($partName, 0, 40);
     $this->pidFile = sprintf('%s/atl.%s.%s.pid', $tmpDirectory, $partName, hash('sha256', $command->getName()));
 }
开发者ID:funivan,项目名称:console,代码行数:16,代码来源:CommandState.php

示例9: 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

示例10: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null|void
  *
  * @throws \Exception
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $ssh = $this->getApplication()->find($this->vagrant_ssh);
     $arguments = $this->basicGetArgumentsWithoutSelf($input);
     $options = $input->getOptions();
     $parameters = array('command' => $this->vagrant_ssh, '--ssh_command' => $this->command->getName(), '--ssh_command_arguments' => $this->basicProceedArray($arguments), '--ssh_command_options' => $this->basicProceedArray($options));
     $output->writeln($this->helper->formatSection('Info', json_encode($parameters)));
     $greetInput = new ArrayInput($parameters);
     $returnCode = $ssh->run($greetInput, $output);
     $output->writeln($this->helper->formatSection('Finishing', $returnCode));
 }
开发者ID:performerSpa,项目名称:PerformerVagrantBundle,代码行数:18,代码来源:VagrantSshCommand.php

示例11: testExecuteWithoutShopId

 /**
  * Check if table without shop id was created as expected.
  */
 public function testExecuteWithoutShopId()
 {
     $defaultStorage = 'ongr_sync_storage_0';
     $commandTester = new CommandTester($this->executeCommand);
     $commandTester->execute(['command' => $this->executeCommand->getName(), 'storage' => SyncStorage::STORAGE_MYSQL]);
     $this->assertEquals('Storage successfully created for ' . SyncStorage::STORAGE_MYSQL . '.' . PHP_EOL, $commandTester->getDisplay());
     $actual = $this->getConnection()->getSchemaManager()->listTableDetails($defaultStorage);
     $this->getConnection()->getSchemaManager()->dropTable($defaultStorage);
     $this->importData('SyncStorage/storageWithoutShop.sql');
     $expected = $this->getConnection()->getSchemaManager()->listTableDetails($defaultStorage);
     $this->compareTable($expected, $actual);
 }
开发者ID:asev,项目名称:ConnectionsBundle,代码行数:15,代码来源:SyncStorageCreateCommandTest.php

示例12: describeCommand

 /**
  * {@inheritdoc}
  */
 protected function describeCommand(Command $command, array $options = array())
 {
     $command->getSynopsis();
     $command->mergeApplicationDefinition(false);
     $markdown = $command->getName() . "\n" . str_repeat('-', strlen($command->getName())) . "\n\n" . '* Description: ' . ($command->getDescription() ?: '<none>') . "\n" . '* Usage: `' . $command->getSynopsis() . '`' . "\n" . '* Aliases: ' . (count($command->getAliases()) ? '`' . implode('`, `', $command->getAliases()) . '`' : '<none>');
     if ($help = $command->getProcessedHelp()) {
         $markdown .= "\n\n" . $help;
     }
     if ($definitionMarkdown = $this->describeInputDefinition($command->getNativeDefinition())) {
         $markdown .= "\n\n" . $definitionMarkdown;
     }
     return $markdown;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:16,代码来源:MarkdownDescriptor.php

示例13: cmdNameToResourceName

 protected function cmdNameToResourceName(Command $command, Page $parentPage)
 {
     $conf = $parentPage->getConfig();
     $strategy = self::CHILDNAME_STRATEGY_PREFIX;
     if (array_key_exists(self::CONF_CHILDNAME_STRATEGY, $conf)) {
         $strategy = $conf[self::CONF_CHILDNAME_STRATEGY];
     }
     if ($strategy === self::CHILDNAME_STRATEGY_PREFIX) {
         return sprintf('%s__%s.html', $parentPage->getName(), str_replace(':', '__', $command->getName()));
     } else {
         return sprintf('%s.html', str_replace(':', '__', $command->getName()));
     }
 }
开发者ID:linkorb,项目名称:blazon,代码行数:13,代码来源:CommandsHandler.php

示例14: __construct

 public function __construct(Command $singleCommand)
 {
     global $argv;
     $this->singleCommand = $singleCommand;
     // Use the command's name as the whole app's name
     $this->setName($singleCommand->getName());
     // Then set the command's name to be the name of the script file
     //  executed (as executed, regardless of symlinks, etc) - i.e.
     //  whatever's set as $argv[0] - because this name ends up displayed in
     //  the "Usage" line of the `--help` output. Though we use the executed
     //  script's base name (i.e. none of the directories leading to it)
     //  because including any parts of the directory path results in a
     //  `--help` output that's very different to all native/standard
     //  commands.
     // This will result in the "Usage" section displaying as:
     //     my-command.php [options] [--] <arguments>
     //  instead of showing the name of the command in place of
     //  'my-command.php', which is especially useful for single-command
     //  apps, as the command name is never even referenced anywhere else!
     $commandName = isset($argv[0]) ? basename($argv[0]) : 'command.php';
     $singleCommand->setName($commandName);
     parent::__construct();
     $this->add($singleCommand);
     $this->setDefaultCommand($singleCommand->getName());
     // If the command class has an 'APP_VERSION' constant defined, we use
     //  that as the entire app's version, as this seems like a much more
     //  sensible place to indicate the version than in the Application
     //  constructor which is tucked away in a non-obvious place!
     $commandClass = get_class($singleCommand);
     if (defined($commandClass . '::APP_VERSION')) {
         $this->setVersion(constant($commandClass . '::APP_VERSION'));
     }
 }
开发者ID:aziraphale,项目名称:symfony-single-command-application,代码行数:33,代码来源:SingleCommandApplication.php

示例15: doRunCommand

 /**
  * @inheritdoc
  */
 protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
 {
     if ($command->getName() != 'version') {
         $output->writeln($this->getLongVersion());
     }
     return parent::doRunCommand($command, $input, $output);
 }
开发者ID:sclable,项目名称:xml-lint,代码行数:10,代码来源:Application.php


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