/** * Store timer results. * * @return void */ public function flush() { $string = ''; $prefix = '[' . $this->datetime->get_datetime() . ']: '; foreach ($this->timers as $key => &$timer) { if ($timer['stopped'] === FALSE) { continue; } $time = $timer['stop'] - $timer['start']; $tags = implode(',', $timer['tags']); $string .= $prefix . $this->request . "Timer '{$key}': {$time} µs; Tags: {$tags}\n"; unset($this->timers[$key]); } unset($timer); if ($string !== '') { $this->file->fwrite($string); } }
/** * Generate a string to output. * * @param String $msg Message to print * * @return String $return Generated String */ private function build_cli_output($msg) { return $this->datetime->get_datetime() . ': ' . $msg; }