1
|
|
|
<?php |
|
|
|
|
2
|
|
|
|
3
|
|
|
if( empty($report) ) |
4
|
|
|
return; |
5
|
|
|
|
6
|
|
|
if( !function_exists('yolk_profiler_dump') ) { |
7
|
|
|
|
8
|
|
|
function yolk_profiler_dump( array $data ) { |
|
|
|
|
9
|
|
|
|
10
|
|
|
$out = "<ul>\n"; |
11
|
|
|
|
12
|
|
|
foreach( $data as $k => $v ) { |
13
|
|
|
$out .= "<li>\n\t<var>{$k}</var>"; |
14
|
|
|
|
15
|
|
|
if( is_array($v) ) { |
16
|
|
|
$out .= yolk_profiler_dump($v); |
17
|
|
|
} |
18
|
|
|
else { |
19
|
|
|
if( is_bool($v) ) |
20
|
|
|
$v = $v ? 'true' : 'false'; |
21
|
|
|
$out .= "<span class=\"value\">{$v}</span>"; |
22
|
|
|
} |
23
|
|
|
$out .= "\n</li>\n"; |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
$out .= "</ul>\n"; |
27
|
|
|
|
28
|
|
|
return $out; |
29
|
|
|
|
30
|
|
|
} |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
?> |
34
|
|
|
|
35
|
|
|
<div id="yolk-debug"> |
36
|
|
|
|
37
|
|
|
<div id="yolk-debug-resize"></div> |
38
|
|
|
|
39
|
|
|
<header> |
40
|
|
|
<ul> |
41
|
|
|
<li title="Yolk Debug Bar" class="yolk-btn"> |
42
|
|
|
<i class="fa fa-circle"></i> |
43
|
|
|
</li> |
44
|
|
|
<li title="Execution Time" class="yolk-tab" data-tab="yolk-timeline"> |
45
|
|
|
<i class="fa fa-clock-o"></i> |
46
|
|
|
<var><?=number_format($report['duration'] * 1000)?> ms</var> |
47
|
|
|
</li> |
48
|
|
|
<li title="Peak Memory"> |
49
|
|
|
<i class="fa fa-signal"></i> |
50
|
|
|
<var><?=number_format($report['memory'] / 1024 / 1024, 3)?> MB</var> |
51
|
|
|
</li> |
52
|
|
|
<li title="Database Queries" class="yolk-tab" data-tab="yolk-queries"> |
53
|
|
|
<i class="fa fa-database"></i> |
54
|
|
|
<var><?=count($report['queries'])?></var> |
55
|
|
|
</li> |
56
|
|
|
<li title="Request Parameters" class="yolk-tab" data-tab="yolk-request"> |
57
|
|
|
<i class="fa fa-download"></i> |
58
|
|
|
</li> |
59
|
|
|
<li title="Twig Info" class="yolk-tab" data-tab="yolk-twig"> |
60
|
|
|
<i class="fa fa-file-code-o"></i> |
61
|
|
|
</li> |
62
|
|
|
<li title="Configuration" class="yolk-tab" data-tab="yolk-config"> |
63
|
|
|
<i class="fa fa-cog"></i> |
64
|
|
|
</li> |
65
|
|
|
<li title="Hide" class="yolk-btn"> |
66
|
|
|
<i class="fa fa-close"></i> |
67
|
|
|
</li> |
68
|
|
|
</ul> |
69
|
|
|
</header> |
70
|
|
|
|
71
|
|
|
<div id="yolk-debug-body"> |
72
|
|
|
<?php include __DIR__. '/timeline.php'; ?> |
73
|
|
|
<?php include __DIR__. '/queries.php'; ?> |
74
|
|
|
<?php include __DIR__. '/config.php'; ?> |
75
|
|
|
</div> |
76
|
|
|
|
77
|
|
|
<style> |
78
|
|
|
<?php include __DIR__. '/yolk-profiler.css'; ?> |
79
|
|
|
/**/ |
80
|
|
|
</style> |
81
|
|
|
|
82
|
|
|
<script> |
83
|
|
|
<?php include __DIR__. '/yolk-profiler.js'; ?> |
84
|
|
|
</script> |
85
|
|
|
|
86
|
|
|
</div> |
87
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.