public function run()
{
$stats = new Stats($this->gremlin);
if ($this->config->filename) {
$stats->setFileFilter($this->config->filename);
}
$stats->collect();
$stats = $stats->toArray();
if ($this->config->json) {
$output = json_encode($stats);
} elseif ($this->config->table) {
$output = $this->table_encode($stats);
} else {
$output = $this->text_encode($stats);
}
if ($this->config->output) {
$outputFile = fopen($this->config->filename, 'w+');
fwrite($outputFile, $output);
fclose($outputFile);
} else {
echo $output;
}
}