You are here

protected function JsonDescriptor::describeApplication in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Descriptor/JsonDescriptor.php \Symfony\Component\Console\Descriptor\JsonDescriptor::describeApplication()

Describes an Application instance.

Parameters

Application $application:

array $options:

Return value

string|mixed

Overrides Descriptor::describeApplication

File

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

Class

JsonDescriptor
JSON descriptor.

Namespace

Symfony\Component\Console\Descriptor

Code

protected function describeApplication(Application $application, array $options = array()) {
  $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  $description = new ApplicationDescription($application, $describedNamespace);
  $commands = array();
  foreach ($description
    ->getCommands() as $command) {
    $commands[] = $this
      ->getCommandData($command);
  }
  $data = $describedNamespace ? array(
    'commands' => $commands,
    'namespace' => $describedNamespace,
  ) : array(
    'commands' => $commands,
    'namespaces' => array_values($description
      ->getNamespaces()),
  );
  $this
    ->writeData($data, $options);
}