You are here

public function Command::setAliases in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Command/Command.php \Symfony\Component\Console\Command\Command::setAliases()

Sets the aliases for the command.

Parameters

string[] $aliases An array of aliases for the command:

Return value

Command The current instance

Throws

\InvalidArgumentException When an alias is invalid

File

vendor/symfony/console/Command/Command.php, line 525

Class

Command
Base class for all commands.

Namespace

Symfony\Component\Console\Command

Code

public function setAliases($aliases) {
  if (!is_array($aliases) && !$aliases instanceof \Traversable) {
    throw new \InvalidArgumentException('$aliases must be an array or an instance of \\Traversable');
  }
  foreach ($aliases as $alias) {
    $this
      ->validateName($alias);
  }
  $this->aliases = $aliases;
  return $this;
}