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

Breadcrumb

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

function CliDescriptor::describe

Overrides DumpDescriptorInterface::describe

File

vendor/symfony/var-dumper/Command/Descriptor/CliDescriptor.php, line 36

Class

CliDescriptor
Describe collected data clones for cli output.

Namespace

Symfony\Component\VarDumper\Command\Descriptor

Code

public function describe(OutputInterface $output, Data $data, array $context, int $clientId) : void {
    $io = $output instanceof SymfonyStyle ? $output : new SymfonyStyle(new ArrayInput([]), $output);
    $this->dumper
        ->setColors($output->isDecorated());
    $rows = [
        [
            'date',
            date('r', (int) $context['timestamp']),
        ],
    ];
    $lastIdentifier = $this->lastIdentifier;
    $this->lastIdentifier = $clientId;
    $section = "Received from client #{$clientId}";
    if (isset($context['request'])) {
        $request = $context['request'];
        $this->lastIdentifier = $request['identifier'];
        $section = \sprintf('%s %s', $request['method'], $request['uri']);
        if ($controller = $request['controller']) {
            $rows[] = [
                'controller',
                rtrim($this->dumper
                    ->dump($controller, true), "\n"),
            ];
        }
    }
    elseif (isset($context['cli'])) {
        $this->lastIdentifier = $context['cli']['identifier'];
        $section = '$ ' . $context['cli']['command_line'];
    }
    if ($this->lastIdentifier !== $lastIdentifier) {
        $io->section($section);
    }
    if (isset($context['source'])) {
        $source = $context['source'];
        $sourceInfo = \sprintf('%s on line %d', $source['name'], $source['line']);
        if ($fileLink = $source['file_link'] ?? null) {
            $sourceInfo = \sprintf('<href=%s>%s</>', $fileLink, $sourceInfo);
        }
        $rows[] = [
            'source',
            $sourceInfo,
        ];
        $file = $source['file_relative'] ?? $source['file'];
        $rows[] = [
            'file',
            $file,
        ];
    }
    $io->table([], $rows);
    $this->dumper
        ->dump($data);
    $io->newLine();
}

API Navigation

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