Automattic\WooCommerce\Internal\ProductAttributesLookup

CLIRunner::invoke()privateWC 1.0

Invoke a method from the class, and if an exception is thrown, show it using WP_CLI::error.

Method of the class: CLIRunner{}

No Hooks.

Return

Mixed. Result from the method, or 1 if an exception is thrown.

Usage

// private - for code of main (parent) class only
$result = $this->invoke( $method_name, $args, $assoc_args );
$method_name(string) (required)
Name of the method to invoke.
$args(array) (required)
Positional arguments to pass to the method.
$assoc_args(array) (required)
Associative arguments to pass to the method.

CLIRunner::invoke() code WC 9.3.3

private function invoke( string $method_name, array $args, array $assoc_args ) {
	try {
		return call_user_func( array( $this, $method_name ), $args, $assoc_args );
	} catch ( \Exception $e ) {
		WP_CLI::error( $e->getMessage() );
		return 1;
	}
}