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

Breadcrumb

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

function DebugCommand::dumpSerializerDataForClass

1 call to DebugCommand::dumpSerializerDataForClass()
DebugCommand::execute in vendor/symfony/serializer/Command/DebugCommand.php
Executes the current command.

File

vendor/symfony/serializer/Command/DebugCommand.php, line 62

Class

DebugCommand
A console command to debug Serializer information.

Namespace

Symfony\Component\Serializer\Command

Code

private function dumpSerializerDataForClass(InputInterface $input, OutputInterface $output, string $class) : void {
    $io = new SymfonyStyle($input, $output);
    $title = \sprintf('<info>%s</info>', $class);
    $rows = [];
    $dump = new Dumper($output);
    $classMetadata = $this->serializer
        ->getMetadataFor($class);
    foreach ($this->getAttributesData($classMetadata) as $propertyName => $data) {
        $rows[] = [
            $propertyName,
            $dump($data),
        ];
    }
    $io->section($title);
    if (!$rows) {
        $io->text('No Serializer data were found for this class.');
        return;
    }
    $table = new Table($output);
    $table->setHeaders([
        'Property',
        'Options',
    ]);
    $table->setRows($rows);
    $table->render();
}
RSS feed
Powered by Drupal