CLI_Command::command_to_array()
Method of the class: CLI_Command{}
No Hooks.
Return
null
. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->command_to_array( $command );
- $command (required)
- -
CLI_Command::command_to_array() CLI Command::command to array code 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; }