Command::get_formatter( array $assoc_args )
Get Formatter object based on supplied parameters.
Contents
Parameters Parameters
- $assoc_args
-
(array) (Required) Parameters passed to command. Determines formatting.
Return Return
(WP_CLIFormatter)
Source Source
File: libraries/lifterlms-cli/src/Commands/Restful/Command.php
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 ); }
Expand full source code Collapse full source code View on GitHub