API / Minn\Cli / Commands

Commands final class

Minn\Cli\Commands · public/minn/src/Minn/Cli/Commands.php · 134 lines

The verbs the engine answers to. Every one is registered for the before_wp_load phase, which WP-CLI runs before it looks for WordPress, and each replaces the bundled subcommand of the same name (a deferred addition lands after the bundle and overrides its leaf).

Public

staticregister(): void#

Registers every engine verb with WP-CLI in the phase it runs in.

Internals 3

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privateleaf(string $name, callable|array $callable, array $args, array $bundled = array ( )): void#

Registers a leaf and re-adds it after the parent lands. WP-CLI registers `plugin` as a namespace first; its later class command would otherwise overwrite our list. With a bundled class and method, the re-added leaf takes that method's docs: WP-CLI loads its bundled commands' classes only after the engine registers, by the time the parent lands.

$callablecallable|array{0: class-string, 1: string}
$argsarray<string, string>
$bundledarray{0?: string, 1?: string}
privaterunner(callable|array $callable, array $bundled): callable|array#

What a leaf runs: the engine's method, or, for a verb named with WP-CLI's own command, that command whenever WP-CLI can load the site.

$callablecallable|array{0: class-string, 1: string}
$bundledarray{0?: string, 1?: string}
@return callable|array{0: class-string, 1: string}
privatereplace(string $name, callable|array|string $callable, array $args): void#

A root command the bundle also registers. Re-add after the bundle without recursing into our own after_add_command hook.

$callablecallable|array{0: class-string, 1: string}|class-string
$argsarray<string, string>