WP_CLI

Runner::cmd_starts_withprivateWP-CLI 1.0

Checks if the arguments passed to the WP-CLI binary start with the specified prefix.

Method of the class: Runner{}

No Hooks.

Returns

true|false. true if the arguments passed to the WP-CLI binary start with the specified prefix, false otherwise.

Usage

// private - for code of main (parent) class only
$result = $this->cmd_starts_with( $prefix );
$prefix(array) (required)
An array of strings specifying the expected start of the arguments passed to the WP-CLI binary. For example, ['user', 'list'] checks if the arguments passed to the WP-CLI binary start with user list.

Runner::cmd_starts_with() code WP-CLI 2.13.0-alpha

private function cmd_starts_with( $prefix ) {
	return array_slice( $this->arguments, 0, count( $prefix ) ) === $prefix;
}