-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathHtmlReporter.php
More file actions
executable file
·33 lines (29 loc) · 871 Bytes
/
HtmlReporter.php
File metadata and controls
executable file
·33 lines (29 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/php
<?php
class HtmlReporter {
public function run() {
$data = file_get_contents("php://stdin");
$data = json_decode($data, true);
echo $this->render("template.view.php", array(
'profiles' => $data['profiles'],
'meta' => $data['meta'],
'url' => 'https://github.com/makeusabrew/phpperf/',
));
}
protected function highlight($str) {
return str_replace("<?php ", "", highlight_string("<?php ".$str, true));
}
protected function microformat($value) {
return (($value * 1000000))." μs";
}
protected function render($tpl, $vars) {
foreach ($vars as $k => $v) {
$this->$k = $v;
}
ob_start();
include($tpl);
return ob_get_clean();
}
}
$reporter = new HtmlReporter();
$reporter->run();