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

Breadcrumb

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

function Command::__construct

Parameters

string|null $name The name of the command; passing null means it must be set in configure():

Throws

LogicException When the command name is empty

28 calls to Command::__construct()
CompleteCommand::__construct in vendor/symfony/console/Command/CompleteCommand.php
CompleteCommand::__construct in vendor/symfony/console/Command/CompleteCommand.php
DebugCommand::__construct in vendor/symfony/serializer/Command/DebugCommand.php
DebugCommand::__construct in vendor/symfony/validator/Command/DebugCommand.php
DebugCommand::__construct in vendor/symfony/serializer/Command/DebugCommand.php

... See full list

15 methods override Command::__construct()
CompleteCommand::__construct in vendor/symfony/console/Command/CompleteCommand.php
DebugCommand::__construct in vendor/symfony/serializer/Command/DebugCommand.php
DebugCommand::__construct in vendor/symfony/validator/Command/DebugCommand.php
GenerateProxyClassCommand::__construct in core/lib/Drupal/Core/Command/GenerateProxyClassCommand.php
Constructs a new GenerateProxyClassCommand instance.
GenerateTheme::__construct in core/lib/Drupal/Core/Command/GenerateTheme.php
GenerateTheme constructor.

... See full list

File

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

Class

Command
Base class for all commands.

Namespace

Symfony\Component\Console\Command

Code

public function __construct(?string $name = null) {
    $this->definition = new InputDefinition();
    if (null === $name && null !== ($name = static::getDefaultName())) {
        $aliases = explode('|', $name);
        if ('' === ($name = array_shift($aliases))) {
            $this->setHidden(true);
            $name = array_shift($aliases);
        }
        $this->setAliases($aliases);
    }
    if (null !== $name) {
        $this->setName($name);
    }
    if ('' === $this->description) {
        $this->setDescription(static::getDefaultDescription() ?? '');
    }
    $this->configure();
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal