WP_CLI
Runner::enumerate_commands
Recursive method to enumerate all known commands.
Метод класса: Runner{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->enumerate_commands( $command, $list, $parent );
- $command(CompositeCommand) (обязательный)
- Composite command to recurse over.
- $list(массив) (обязательный)
- Reference to list accumulating results.
- $parent(строка)
- Parent command to use as prefix.
По умолчанию:''
Код Runner::enumerate_commands() Runner::enumerate commands WP-CLI 2.13.0-alpha
private function enumerate_commands( CompositeCommand $command, array &$list, $parent = '' ) {
foreach ( $command->get_subcommands() as $subcommand ) {
/** @var CompositeCommand $subcommand */
$command_string = empty( $parent )
? $subcommand->get_name()
: "{$parent} {$subcommand->get_name()}";
$list[] = $command_string;
$this->enumerate_commands( $subcommand, $list, $command_string );
}
}