Merge pull request #22 from runcommand/consolidate

Consolidate calls to the formatter
This commit is contained in:
Daniel Bachhuber 2016-08-26 07:08:21 -07:00 committed by GitHub
commit 18fedabd01

View file

@ -117,7 +117,7 @@ class Command {
} }
if ( $this->focus_scope ) { if ( $this->focus_scope ) {
$focus_fields = array( $fields = array(
'hook', 'hook',
'execution_time', 'execution_time',
'query_time', 'query_time',
@ -129,21 +129,21 @@ class Command {
$this->focus_log[ $hook ]['hook'] = ''; $this->focus_log[ $hook ]['hook'] = '';
} }
} }
$formatter = new Formatter( $assoc_args, $focus_fields ); $data = $this->focus_log;
$formatter->display_items( $this->focus_log );
} else if ( $this->focus_hook ) { } else if ( $this->focus_hook ) {
$hook_fields = array( $fields = array(
'callback', 'callback',
'execution_time', 'execution_time',
'query_time', 'query_time',
'query_count', 'query_count',
); );
$formatter = new Formatter( $assoc_args, $hook_fields ); $data = $this->hook_log;
$formatter->display_items( $this->hook_log );
} else { } else {
$formatter = new Formatter( $assoc_args, $scope_fields ); $fields = $scope_fields;
$formatter->display_items( $this->scope_log ); $data = $this->scope_log;
} }
$formatter = new Formatter( $assoc_args, $fields );
$formatter->display_items( $data );
} }
/** /**