private function describeJoomlaApplication(Application $app, array $options)
	{
		$describedNamespace = $options['namespace'] ?? '';
		$description        = new ApplicationDescription($app, $describedNamespace);

		$version = $app->getLongVersion();

		if ($version !== '')
		{
			$this->writeText("$version\n\n", $options);
		}

		$this->writeText("<comment>Usage:</comment>\n");
		$this->writeText("  command [options] [arguments]\n\n");

		$this->describeInputDefinition(new InputDefinition($app->getDefinition()->getOptions()), $options);

		$this->writeText("\n");
		$this->writeText("\n");

		$commands   = $description->getCommands();
		$namespaces = $description->getNamespaces();

		if ($describedNamespace && $namespaces)
		{
			// Ensure all aliased commands are included when describing a specific namespace
			$describedNamespaceInfo = reset($namespaces);

			foreach ($describedNamespaceInfo['commands'] as $name)
			{
				$commands[$name] = $description->getCommand($name);
			}
		}

		$width = $this->getColumnWidth(
			\call_user_func_array(
				'array_merge',
				array_map(
					function ($namespace) use ($commands)
					{
						return array_intersect($namespace['commands'], array_keys($commands));
					},
					$namespaces
				)
			)
		);

		if ($describedNamespace)
		{
			$this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
		}
		else
		{
			$this->writeText('<comment>Available commands:</comment>', $options);
		}

		foreach ($namespaces as $namespace)
		{
			$namespace['commands'] = array_filter(
				$namespace['commands'],
				function ($name) use ($commands)
				{
					return isset($commands[$name]);
				}
			);

			if (!$namespace['commands'])
			{
				continue;
			}

			if (!$describedNamespace && $namespace['id'] !== ApplicationDescription::GLOBAL_NAMESPACE)
			{
				$this->writeText("\n");
				$this->writeText(' <comment>' . $namespace['id'] . '</comment>', $options);
			}

			foreach ($namespace['commands'] as $name)
			{
				$this->writeText("\n");
				$spacingWidth   = $width - StringHelper::strlen($name);
				$command        = $commands[$name];
				$commandAliases = $name === $command->getName() ? $this->getCommandAliasesText($command) : '';

				$this->writeText(
					sprintf(
						'  <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $commandAliases . $command->getDescription()
					),
					$options
				);
			}
		}

		$this->writeText("\n");
	}
private function describeJoomlaApplication(Application $app, array $options)
	{
		$describedNamespace = $options['namespace'] ?? '';
		$description        = new ApplicationDescription($app, $describedNamespace);

		$version = $app->getLongVersion();

		if ($version !== '')
		{
			$this->writeText("$version\n\n", $options);
		}

		$this->writeText("<comment>Usage:</comment>\n");
		$this->writeText("  command [options] [arguments]\n\n");

		$this->describeInputDefinition(new InputDefinition($app->getDefinition()->getOptions()), $options);

		$this->writeText("\n");
		$this->writeText("\n");

		$commands   = $description->getCommands();
		$namespaces = $description->getNamespaces();

		if ($describedNamespace && $namespaces)
		{
			// Ensure all aliased commands are included when describing a specific namespace
			$describedNamespaceInfo = reset($namespaces);

			foreach ($describedNamespaceInfo['commands'] as $name)
			{
				$commands[$name] = $description->getCommand($name);
			}
		}

		$width = $this->getColumnWidth(
			\call_user_func_array(
				'array_merge',
				array_map(
					function ($namespace) use ($commands)
					{
						return array_intersect($namespace['commands'], array_keys($commands));
					},
					$namespaces
				)
			)
		);

		if ($describedNamespace)
		{
			$this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
		}
		else
		{
			$this->writeText('<comment>Available commands:</comment>', $options);
		}

		foreach ($namespaces as $namespace)
		{
			$namespace['commands'] = array_filter(
				$namespace['commands'],
				function ($name) use ($commands)
				{
					return isset($commands[$name]);
				}
			);

			if (!$namespace['commands'])
			{
				continue;
			}

			if (!$describedNamespace && $namespace['id'] !== ApplicationDescription::GLOBAL_NAMESPACE)
			{
				$this->writeText("\n");
				$this->writeText(' <comment>' . $namespace['id'] . '</comment>', $options);
			}

			foreach ($namespace['commands'] as $name)
			{
				$this->writeText("\n");
				$spacingWidth   = $width - StringHelper::strlen($name);
				$command        = $commands[$name];
				$commandAliases = $name === $command->getName() ? $this->getCommandAliasesText($command) : '';

				$this->writeText(
					sprintf(
						'  <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $commandAliases . $command->getDescription()
					),
					$options
				);
			}
		}

		$this->writeText("\n");
	}
private function describeJoomlaApplication ( Application $ app , array $ options ) { $ describedNamespace = $ options [ 'namespace' ] ?? '' ; $ description = new ApplicationDescription ( $ app , $ describedNamespace ) ; $ version = $ app -> getLongVersion ( ) ; if ( $ version !== '' ) { $ this -> writeText ( "$version\n\n" , $ options ) ; } $ this -> writeText ( "<comment>Usage:</comment>\n" ) ; $ this -> writeText ( "  command [options] [arguments]\n\n" ) ; $ this -> describeInputDefinition ( new InputDefinition ( $ app -> getDefinition ( ) -> getOptions ( ) ) , $ options ) ; $ this -> writeText ( "\n" ) ; $ this -> writeText ( "\n" ) ; $ commands = $ description -> getCommands ( ) ; $ namespaces = $ description -> getNamespaces ( ) ; if ( $ describedNamespace && $ namespaces ) { // Ensure all aliased commands are included when describing a specific namespace $ describedNamespaceInfo = reset ( $ namespaces ) ; foreach ( $ describedNamespaceInfo [ 'commands' ] as $ name ) { $ commands [ $ name ] = $ description -> getCommand ( $ name ) ; } } $ width = $ this -> getColumnWidth ( \ call_user_func_array ( 'array_merge' , array_map ( function ( $ namespace ) use ( $ commands ) { return array_intersect ( $ namespace [ 'commands' ] , array_keys ( $ commands ) ) ; } , $ namespaces ) ) ) ; if ( $ describedNamespace ) { $ this -> writeText ( sprintf ( '<comment>Available commands for the "%s" namespace:</comment>' , $ describedNamespace ) , $ options ) ; } else { $ this -> writeText ( '<comment>Available commands:</comment>' , $ options ) ; } foreach ( $ namespaces as $ namespace ) { $ namespace [ 'commands' ] = array_filter ( $ namespace [ 'commands' ] , function ( $ name ) use ( $ commands ) { return isset ( $ commands [ $ name ] ) ; } ) ; if ( ! $ namespace [ 'commands' ] ) { continue ; } if ( ! $ describedNamespace && $ namespace [ 'id' ] !== ApplicationDescription :: GLOBAL_NAMESPACE ) { $ this -> writeText ( "\n" ) ; $ this -> writeText ( ' <comment>' . $ namespace [ 'id' ] . '</comment>' , $ options ) ; } foreach ( $ namespace [ 'commands' ] as $ name ) { $ this -> writeText ( "\n" ) ; $ spacingWidth = $ width - StringHelper :: strlen ( $ name ) ; $ command = $ commands [ $ name ] ; $ commandAliases = $ name === $ command -> getName ( ) ? $ this -> getCommandAliasesText ( $ command ) : '' ; $ this -> writeText ( sprintf ( '  <info>%s</info>%s%s' , $ name , str_repeat ( ' ' , $ spacingWidth ) , $ commandAliases . $ command -> getDescription ( ) ) , $ options ) ; } } $ this -> writeText ( "\n" ) ; }
Describes an application.

@param   Application  $app      The application being described.
@param   array        $options  Descriptor options.

@return  void

@since   __DEPLOY_VERSION__
Describes an application .