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

Breadcrumb

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

function CommandDataCollector::getCommand

Return value

array{ class?: class-string, executor?: string, file: string, line: int, }

File

vendor/symfony/console/DataCollector/CommandDataCollector.php, line 96

Class

CommandDataCollector
@internal

Namespace

Symfony\Component\Console\DataCollector

Code

public function getCommand() : array {
    $class = $this->data['command']
        ->getType();
    $r = new \ReflectionMethod($class, 'execute');
    if (Command::class !== $r->getDeclaringClass()) {
        return [
            'executor' => $class . '::' . $r->name,
            'file' => $r->getFileName(),
            'line' => $r->getStartLine(),
        ];
    }
    $r = new \ReflectionClass($class);
    return [
        'class' => $class,
        'file' => $r->getFileName(),
        'line' => $r->getStartLine(),
    ];
}
RSS feed
Powered by Drupal