CLI_Command::command_to_array()privateWP-CLI 1.0

Метод класса: CLI_Command{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// private - только в коде основоного (родительского) класса
$result = $this->command_to_array( $command );
$command (обязательный)
-

Код CLI_Command::command_to_array() WP-CLI 2.8.0-alpha

private function command_to_array( $command ) {
	$dump = [
		'name'        => $command->get_name(),
		'description' => $command->get_shortdesc(),
		'longdesc'    => $command->get_longdesc(),
	];

	foreach ( $command->get_subcommands() as $subcommand ) {
		$dump['subcommands'][] = $this->command_to_array( $subcommand );
	}

	if ( empty( $dump['subcommands'] ) ) {
		$dump['synopsis'] = (string) $command->get_synopsis();
	}

	return $dump;
}