WordPress at Your Fingertips
function is not described

WC_CLI_REST_Command::get_formatter() protected WC 1.0

Get Formatter object based on supplied parameters.

{} It's a method of the class: WC_CLI_REST_Command{}

No Hooks.

Return

\WP_CLI\Formatter.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_formatter( $assoc_args );
$assoc_args(array) (required) (passed by reference — &)
Parameters passed to command. Determines formatting.

Code of WC_CLI_REST_Command::get_formatter() WC 5.9.0

protected function get_formatter( &$assoc_args ) {
	if ( ! empty( $assoc_args['fields'] ) ) {
		if ( is_string( $assoc_args['fields'] ) ) {
			$fields = explode( ',', $assoc_args['fields'] );
		} else {
			$fields = $assoc_args['fields'];
		}
	} else {
		if ( ! empty( $assoc_args['context'] ) ) {
			$fields = $this->get_context_fields( $assoc_args['context'] );
		} else {
			$fields = $this->get_context_fields( 'view' );
		}
	}
	return new \WP_CLI\Formatter( $assoc_args, $fields );
}