DoctorCommandRegistrar
in package
Registers the {@see DoctorCommand} with WP-CLI under a consumer-chosen root.
The command root is configurable and defaults to the neutral library marker
(wp middaglib doctor), which names no product; a consumer passes its own
root (for example acme for wp acme doctor). Outside WP-CLI,
register() does nothing and returns false, so it is safe to call from
a plugin file on every request.
Call it from the main plugin file, not from the kernel boot: the command has to exist precisely when the kernel failed to boot. Several plugins of one family may register the same root; WP-CLI keeps the last registration, which is harmless as long as they share the diagnostics filter name and therefore print the same report.
Table of Contents
Constants
- DEFAULT_ROOT : string = 'middaglib'
- SUBCOMMAND : string = 'doctor'
Properties
- $command : DoctorCommand
- $root : string
Methods
- __construct() : mixed
- commandName() : string
- Full command name as typed after `wp` (for example `acme doctor`).
- register() : bool
- Add the command to WP-CLI; returns false when not running under WP-CLI.
- isWpCli() : bool
Constants
DEFAULT_ROOT
public
string
DEFAULT_ROOT
= 'middaglib'
SUBCOMMAND
public
string
SUBCOMMAND
= 'doctor'
Properties
$command
private
DoctorCommand
$command
$root
private
string
$root
= self::DEFAULT_ROOT
Methods
__construct()
public
__construct(DoctorCommand $command[, string $root = self::DEFAULT_ROOT ]) : mixed
Parameters
- $command : DoctorCommand
- $root : string = self::DEFAULT_ROOT
Tags
commandName()
Full command name as typed after `wp` (for example `acme doctor`).
public
commandName() : string
Return values
stringregister()
Add the command to WP-CLI; returns false when not running under WP-CLI.
public
register() : bool
Return values
boolisWpCli()
private
isWpCli() : bool