You are here

public function Command::mergeApplicationDefinition 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::mergeApplicationDefinition()

Merges the application definition with the command definition.

This method is not part of public API and should not be used directly.

Parameters

bool $mergeArgs Whether to merge or not the Application definition arguments to Command definition arguments:

1 call to Command::mergeApplicationDefinition()
Command::run in vendor/symfony/console/Command/Command.php
Runs the command.

File

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

Class

Command
Base class for all commands.

Namespace

Symfony\Component\Console\Command

Code

public function mergeApplicationDefinition($mergeArgs = true) {
  if (null === $this->application || true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs)) {
    return;
  }
  if ($mergeArgs) {
    $currentArguments = $this->definition
      ->getArguments();
    $this->definition
      ->setArguments($this->application
      ->getDefinition()
      ->getArguments());
    $this->definition
      ->addArguments($currentArguments);
  }
  $this->definition
    ->addOptions($this->application
    ->getDefinition()
    ->getOptions());
  $this->applicationDefinitionMerged = true;
  if ($mergeArgs) {
    $this->applicationDefinitionMergedWithArgs = true;
  }
}