Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TraceableCommand.php

function TraceableCommand::__construct

Overrides Command::__construct

File

vendor/symfony/console/Command/TraceableCommand.php, line 49

Class

TraceableCommand
@internal

Namespace

Symfony\Component\Console\Command

Code

public function __construct(Command $command, Stopwatch $stopwatch) {
    if ($command instanceof LazyCommand) {
        $command = $command->getCommand();
    }
    $this->command = $command;
    // prevent call to self::getDefaultDescription()
    $this->setDescription($command->getDescription());
    parent::__construct($command->getName());
    // init below enables calling {@see parent::run()}
    [
        $code,
        $processTitle,
        $ignoreValidationErrors,
    ] = \Closure::bind(function () {
        return [
            $this->code,
            $this->processTitle,
            $this->ignoreValidationErrors,
        ];
    }, $command, Command::class)();
    if (\is_callable($code)) {
        $this->setCode($code);
    }
    if ($processTitle) {
        parent::setProcessTitle($processTitle);
    }
    if ($ignoreValidationErrors) {
        parent::ignoreValidationErrors();
    }
    $this->ignoreValidation = $ignoreValidationErrors;
}
RSS feed
Powered by Drupal