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


PHP Command::setAliases方法代碼示例

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


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

示例1: testBundleCommandCanBeFoundByAlias

 public function testBundleCommandCanBeFoundByAlias()
 {
     $command = new Command('example');
     $command->setAliases(array('alias'));
     $bundle = $this->createBundleMock(array($command));
     $kernel = $this->getKernel(array($bundle));
     $application = new Application($kernel);
     $this->assertSame($command, $application->find('alias'));
 }
開發者ID:symfony,項目名稱:symfony,代碼行數:9,代碼來源:ApplicationTest.php

示例2: testBundleCommandCanBeFoundByAlias

 public function testBundleCommandCanBeFoundByAlias()
 {
     $bundle = $this->getMock('Symfony\\Component\\HttpKernel\\Bundle\\Bundle');
     $bundle->expects($this->once())->method('registerCommands');
     $kernel = $this->getKernel(array($bundle));
     $application = new Application($kernel);
     $command = new Command('example');
     $command->setAliases(array('alias'));
     $application->add($command);
     $this->assertSame($command, $application->find('alias'));
 }
開發者ID:Ener-Getick,項目名稱:symfony,代碼行數:11,代碼來源:ApplicationTest.php

示例3: registerConfigCommandAlias

 /**
  * @param \Symfony\Component\Console\Command\Command $command
  */
 protected function registerConfigCommandAlias(Command $command)
 {
     if ($this->hasConfigCommandAliases()) {
         foreach ($this->config['commands']['aliases'] as $alias) {
             if (!is_array($alias)) {
                 continue;
             }
             $aliasCommandName = key($alias);
             $commandString = $alias[$aliasCommandName];
             list($originalCommand) = explode(' ', $commandString);
             if ($command->getName() == $originalCommand) {
                 $currentCommandAliases = $command->getAliases();
                 $currentCommandAliases[] = $aliasCommandName;
                 $command->setAliases($currentCommandAliases);
             }
         }
     }
 }
開發者ID:jsiefer,項目名稱:n98-magerun2,代碼行數:21,代碼來源:Application.php

示例4: setAliases

 /**
  * {@inheritdoc}
  */
 public function setAliases($aliases)
 {
     $this->decoratedCommand->setAliases($aliases);
     return $this;
 }
開發者ID:frankdejonge,項目名稱:locked-console-command,代碼行數:8,代碼來源:LockedCommandDecorator.php

示例5: setAliases

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

示例6: configure

 /**
  * Configures a console command by setting name, description, arguments, etc.
  *
  * @param Command $command
  */
 public static function configure(Command $command)
 {
     $command->setName('config:status');
     $command->setAliases(['status']);
     $command->setDescription('Shows the current migration status.');
 }
開發者ID:baleen,項目名稱:cli,代碼行數:11,代碼來源:StatusMessage.php

示例7: configure

 /**
  * @inheritdoc
  */
 public static function configure(Command $command)
 {
     $command->setName('config:init');
     $command->setAliases(['init']);
     $command->setDescription('Initialises Baleen by creating a config file in the current directory.');
 }
開發者ID:baleen,項目名稱:cli,代碼行數:9,代碼來源:InitMessage.php

示例8: registerConfigCommandAlias

 /**
  * @param Command $command
  */
 public function registerConfigCommandAlias(Command $command)
 {
     foreach ($this->getArray(array('commands', 'aliases')) as $alias) {
         if (!is_array($alias)) {
             continue;
         }
         $aliasCommandName = key($alias);
         $commandString = $alias[$aliasCommandName];
         list($originalCommand) = explode(' ', $commandString, 2);
         if ($command->getName() !== $originalCommand) {
             continue;
         }
         $command->setAliases(array_merge($command->getAliases(), array($aliasCommandName)));
     }
 }
開發者ID:netz98,項目名稱:n98-magerun,代碼行數:18,代碼來源:Config.php


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