本文整理汇总了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'));
}
示例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'));
}
示例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);
}
}
}
}
示例4: setAliases
/**
* {@inheritdoc}
*/
public function setAliases($aliases)
{
$this->decoratedCommand->setAliases($aliases);
return $this;
}
示例5: setAliases
public function setAliases($aliases)
{
return $this->innerCommand->setAliases($aliases);
}
示例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.');
}
示例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.');
}
示例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)));
}
}