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

Breadcrumb

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

function JsonDescriptor::describeApplication

Overrides Descriptor::describeApplication

File

vendor/symfony/console/Descriptor/JsonDescriptor.php, line 52

Class

JsonDescriptor
JSON descriptor.

Namespace

Symfony\Component\Console\Descriptor

Code

protected function describeApplication(Application $application, array $options = []) : void {
    $describedNamespace = $options['namespace'] ?? null;
    $description = new ApplicationDescription($application, $describedNamespace, true);
    $commands = [];
    foreach ($description->getCommands() as $command) {
        $commands[] = $this->getCommandData($command, $options['short'] ?? false);
    }
    $data = [];
    if ('UNKNOWN' !== $application->getName()) {
        $data['application']['name'] = $application->getName();
        if ('UNKNOWN' !== $application->getVersion()) {
            $data['application']['version'] = $application->getVersion();
        }
    }
    $data['commands'] = $commands;
    if ($describedNamespace) {
        $data['namespace'] = $describedNamespace;
    }
    else {
        $data['namespaces'] = array_values($description->getNamespaces());
    }
    $this->writeData($data, $options);
}

API Navigation

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