function LazyCommand::getCommand
File
-
vendor/
symfony/ console/ Command/ LazyCommand.php, line 183
Class
- LazyCommand
- @author Nicolas Grekas <p@tchwork.com>
Namespace
Symfony\Component\Console\CommandCode
public function getCommand() : parent {
if (!$this->command instanceof \Closure) {
return $this->command;
}
$command = $this->command = ($this->command)();
$command->setApplication($this->getApplication());
if (null !== $this->getHelperSet()) {
$command->setHelperSet($this->getHelperSet());
}
$command->setName($this->getName())
->setAliases($this->getAliases())
->setHidden($this->isHidden())
->setDescription($this->getDescription());
// Will throw if the command is not correctly initialized.
$command->getDefinition();
return $command;
}