WP_CLI\Context

Auto::deduce_best_context()privateWP-CLI 1.0

Deduce the best context to run the current command in.

Method of the class: Auto{}

No Hooks.

Return

String. Context to use.

Usage

// private - for code of main (parent) class only
$result = $this->deduce_best_context();

Auto::deduce_best_context() code WP-CLI 2.8.0-alpha

private function deduce_best_context() {
	if ( $this->is_command_to_run_as_admin() ) {
		return Context::ADMIN;
	}

	return Context::CLI;
}