@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | foreach ($files as $key => $file) { |
112 | 112 | |
113 | 113 | if (strpos($file, 'autoload.php') !== false) { |
114 | - unset($files[ $key ]); |
|
114 | + unset($files[$key]); |
|
115 | 115 | continue; |
116 | 116 | } |
117 | 117 | |
118 | - $files[ $key ] = str_replace(PATH_ROOT, DIRECTORY_SEPARATOR, $file); |
|
118 | + $files[$key] = str_replace(PATH_ROOT, DIRECTORY_SEPARATOR, $file); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $database = []; |
130 | 130 | |
131 | 131 | if (class_exists('O2System\Framework', false)) { |
132 | - if(services()->has('database')) { |
|
132 | + if (services()->has('database')) { |
|
133 | 133 | $connections = database()->getIterator(); |
134 | 134 | |
135 | 135 | foreach ($connections as $offset => $connection) { |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | $vars->headers = []; |
185 | 185 | foreach ($_SERVER as $name => $value) { |
186 | 186 | if (substr($name, 0, 5) == 'HTTP_') { |
187 | - $vars->headers[ str_replace(' ', '-', |
|
188 | - ucwords(strtolower(str_replace('_', ' ', substr($name, 5))))) ] = $value; |
|
187 | + $vars->headers[str_replace(' ', '-', |
|
188 | + ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | } |
@@ -1,54 +1,54 @@ discard block |
||
1 | 1 | <style type="text/css"> |
2 | - <?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__.'/assets/css/toolbar.min.css')) ?> |
|
2 | + <?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__ . '/assets/css/toolbar.min.css')) ?> |
|
3 | 3 | </style> |
4 | 4 | |
5 | 5 | <script type="text/javascript"> |
6 | - <?= file_get_contents( __DIR__ . '/assets/js/toolbar.min.js' ) ?> |
|
6 | + <?= file_get_contents(__DIR__ . '/assets/js/toolbar.min.js') ?> |
|
7 | 7 | </script> |
8 | 8 | |
9 | 9 | <?php |
10 | 10 | function toolbar_table($array) { |
11 | - $output = ''; |
|
12 | - if(is_array($array)) { |
|
13 | - $output.= '<table>'; |
|
14 | - foreach($array as $key => $value) { |
|
15 | - $output.= '<tr>'; |
|
16 | - if(is_string($key)) { |
|
17 | - $output.= '<th valign="top">'.$key.'</th>'; |
|
11 | + $output = ''; |
|
12 | + if (is_array($array)) { |
|
13 | + $output .= '<table>'; |
|
14 | + foreach ($array as $key => $value) { |
|
15 | + $output .= '<tr>'; |
|
16 | + if (is_string($key)) { |
|
17 | + $output .= '<th valign="top">' . $key . '</th>'; |
|
18 | 18 | } |
19 | - if(is_array($value)) { |
|
20 | - $output.= '<td>'.toolbar_table($value).'</td>'; |
|
21 | - } elseif($value instanceof \ArrayObject) { |
|
22 | - $output.= '<td>'.toolbar_table($value).'</td>'; |
|
23 | - } elseif(is_object($value) && method_exists($value, '__toString')) { |
|
24 | - $output.= '<td>'.$value->__toString().'</td>'; |
|
25 | - } elseif(is_object($value)) { |
|
19 | + if (is_array($value)) { |
|
20 | + $output .= '<td>' . toolbar_table($value) . '</td>'; |
|
21 | + } elseif ($value instanceof \ArrayObject) { |
|
22 | + $output .= '<td>' . toolbar_table($value) . '</td>'; |
|
23 | + } elseif (is_object($value) && method_exists($value, '__toString')) { |
|
24 | + $output .= '<td>' . $value->__toString() . '</td>'; |
|
25 | + } elseif (is_object($value)) { |
|
26 | 26 | $object = new \ReflectionClass($value); |
27 | - $output.= '<td>(object) '.$object->getName().'</td>'; |
|
28 | - } elseif(is_bool($value)) { |
|
29 | - $output.= '<td>'.($value === true ? 'true' : 'false').'</td>'; |
|
30 | - } elseif($value === '' || is_null($value)) { |
|
31 | - $output.= '<td><strong style="color: #ccc;">no value</strong></td>'; |
|
27 | + $output .= '<td>(object) ' . $object->getName() . '</td>'; |
|
28 | + } elseif (is_bool($value)) { |
|
29 | + $output .= '<td>' . ($value === true ? 'true' : 'false') . '</td>'; |
|
30 | + } elseif ($value === '' || is_null($value)) { |
|
31 | + $output .= '<td><strong style="color: #ccc;">no value</strong></td>'; |
|
32 | 32 | } else { |
33 | - $output.= '<td>'.$value.'</td>'; |
|
33 | + $output .= '<td>' . $value . '</td>'; |
|
34 | 34 | } |
35 | 35 | |
36 | - $output.= '</tr>'; |
|
36 | + $output .= '</tr>'; |
|
37 | 37 | } |
38 | - $output.= '</table>'; |
|
39 | - } elseif($array instanceof \ArrayObject) { |
|
40 | - $output.= toolbar_table($array->getArrayCopy()); |
|
41 | - } elseif(is_object($array) && method_exists($array, '__toString')) { |
|
42 | - $output.= $array->__toString(); |
|
43 | - } elseif(is_object($array)) { |
|
38 | + $output .= '</table>'; |
|
39 | + } elseif ($array instanceof \ArrayObject) { |
|
40 | + $output .= toolbar_table($array->getArrayCopy()); |
|
41 | + } elseif (is_object($array) && method_exists($array, '__toString')) { |
|
42 | + $output .= $array->__toString(); |
|
43 | + } elseif (is_object($array)) { |
|
44 | 44 | $object = new \ReflectionClass($array); |
45 | - $output.= '(object) ' . $object->getName(); |
|
46 | - } elseif(is_bool($array)) { |
|
47 | - $output.= ($array === true ? 'true' : 'false'); |
|
48 | - } elseif($array === '' || is_null($array)) { |
|
49 | - $output.= '<strong style="color: #ccc;">no value</strong>'; |
|
45 | + $output .= '(object) ' . $object->getName(); |
|
46 | + } elseif (is_bool($array)) { |
|
47 | + $output .= ($array === true ? 'true' : 'false'); |
|
48 | + } elseif ($array === '' || is_null($array)) { |
|
49 | + $output .= '<strong style="color: #ccc;">no value</strong>'; |
|
50 | 50 | } else { |
51 | - $output.= $array; |
|
51 | + $output .= $array; |
|
52 | 52 | } |
53 | 53 | return $output; |
54 | 54 | } |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | <span class="gear-toolbar-label"><a id="tab-button-metrics" class="tab-button" href="javascript:void(0)" onclick="gearToolbar.showTab('metrics');">Metrics</a></span> |
68 | 68 | <span class="gear-toolbar-label"><a id="tab-button-files" class="tab-button" href="javascript:void(0)" onclick="gearToolbar.showTab('files');">Files</a></span> |
69 | 69 | <span class="gear-toolbar-label"><a id="tab-button-vars" class="tab-button" href="javascript:void(0)" onclick="gearToolbar.showTab('vars');">Vars</a></span> |
70 | - <?php if( ! empty( $database ) ): ?> |
|
70 | + <?php if ( ! empty($database)): ?> |
|
71 | 71 | <span class="gear-toolbar-label"><a id="tab-button-database" class="tab-button" href="javascript:void(0)" onclick="gearToolbar.showTab('database');">Database</a></span> |
72 | 72 | <?php endif; ?> |
73 | - <?php if( ! empty( $logs ) ): ?> |
|
73 | + <?php if ( ! empty($logs)): ?> |
|
74 | 74 | <span class="gear-toolbar-label"><a id="tab-button-logs" class="tab-button" href="javascript:void(0)" onclick="gearToolbar.showTab('logs');">Logs</a></span> |
75 | 75 | <?php endif; ?> |
76 | 76 | </div> |
@@ -84,20 +84,20 @@ discard block |
||
84 | 84 | <th style="width: 30%">EVENT</th> |
85 | 85 | <th style="width: 5%;">MEMORY</th> |
86 | 86 | <th style="width: 5%;">DURATION</th> |
87 | - <?php for ( $i = 0; $i < $segmentCount; $i++ ) : ?> |
|
87 | + <?php for ($i = 0; $i < $segmentCount; $i++) : ?> |
|
88 | 88 | <th><?= $i * $segmentDuration ?> ms</th> |
89 | 89 | <?php endfor; ?> |
90 | 90 | </tr> |
91 | 91 | </thead> |
92 | 92 | <tbody> |
93 | - <?php foreach ( $metrics as $index => $metric ): ?> |
|
93 | + <?php foreach ($metrics as $index => $metric): ?> |
|
94 | 94 | <tr> |
95 | 95 | <td><?= $metric->marker; ?></td> |
96 | 96 | <td style="text-align: left"><?= $metric->getMemoryUsage(); ?></td> |
97 | 97 | <td style="text-align: left"><?= $metric->getDuration(2); ?></td> |
98 | 98 | <td colspan="<?=$segmentCount; ?>" style="overflow: hidden"> |
99 | 99 | <span class="timer" style="left: <?= $metric->offset; ?>%; width: <?= $metric->length; ?>%;" |
100 | - title="<?= number_format( $metric->length, 2 ); ?>%"></span> |
|
100 | + title="<?= number_format($metric->length, 2); ?>%"></span> |
|
101 | 101 | </td> |
102 | 102 | </tr> |
103 | 103 | <?php endforeach; ?> |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | <!-- Files --> |
109 | 109 | <div id="gear-toolbar-tab-files" class="tab"> |
110 | - <h2>Files <small><?= count( $files ); ?> loaded files</small></h2> |
|
110 | + <h2>Files <small><?= count($files); ?> loaded files</small></h2> |
|
111 | 111 | |
112 | 112 | <table> |
113 | 113 | <thead> |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | </tr> |
118 | 118 | </thead> |
119 | 119 | <tbody> |
120 | - <?php foreach ( $files as $file ): ?> |
|
120 | + <?php foreach ($files as $file): ?> |
|
121 | 121 | <tr> |
122 | - <td style="width: 20em;"><?= pathinfo( $file, PATHINFO_BASENAME ); ?></td> |
|
122 | + <td style="width: 20em;"><?= pathinfo($file, PATHINFO_BASENAME); ?></td> |
|
123 | 123 | <td><?= $file; ?></td> |
124 | 124 | </tr> |
125 | 125 | <?php endforeach; ?> |
@@ -130,15 +130,15 @@ discard block |
||
130 | 130 | |
131 | 131 | <!-- Vars --> |
132 | 132 | <div id="gear-toolbar-tab-vars" class="tab"> |
133 | - <?php foreach ( $vars as $varKey => $varValue ): ?> |
|
134 | - <?php if ( count( $varValue ) ): ?> |
|
133 | + <?php foreach ($vars as $varKey => $varValue): ?> |
|
134 | + <?php if (count($varValue)): ?> |
|
135 | 135 | <a href="#" |
136 | 136 | onclick="gearToolbar.toggleDataTable('gears-toolbar-table-vars-<?= $varKey; ?>'); return false;"> |
137 | - <h2><?= strtoupper( $varKey ); ?></h2> |
|
137 | + <h2><?= strtoupper($varKey); ?></h2> |
|
138 | 138 | </a> |
139 | 139 | <table id="gears-toolbar-table-vars-<?= $varKey; ?>"> |
140 | 140 | <tbody> |
141 | - <?php foreach ( $varValue as $key => $value ): ?> |
|
141 | + <?php foreach ($varValue as $key => $value): ?> |
|
142 | 142 | <tr> |
143 | 143 | <th valign="top"><?= $key; ?></th> |
144 | 144 | <td><?= toolbar_table($value); ?></td> |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | <?php endforeach; ?> |
151 | 151 | </div> |
152 | 152 | |
153 | - <?php if( ! empty( $database ) ): ?> |
|
153 | + <?php if ( ! empty($database)): ?> |
|
154 | 154 | <!-- Database --> |
155 | 155 | <div id="gear-toolbar-tab-database" class="tab"> |
156 | 156 | <h2>Executed Queries</h2> |
@@ -168,12 +168,12 @@ discard block |
||
168 | 168 | <?php $totalAffected = 0; ?> |
169 | 169 | <?php $totalHits = 0; ?> |
170 | 170 | <?php $totalTime = 0; ?> |
171 | - <?php foreach( $database as $connection => $queries ): ?> |
|
171 | + <?php foreach ($database as $connection => $queries): ?> |
|
172 | 172 | <tr style="border-bottom: 1px solid #ebebeb;"> |
173 | 173 | <th colspan="4" style="padding: 5px; color: #ccc;"><?= strtoupper($connection); ?></th> |
174 | 174 | </tr> |
175 | - <?php if(!empty($queries)): ?> |
|
176 | - <?php foreach($queries as $query): ?> |
|
175 | + <?php if ( ! empty($queries)): ?> |
|
176 | + <?php foreach ($queries as $query): ?> |
|
177 | 177 | <tr> |
178 | 178 | <?php $totalAffected = $totalAffected + $query->getAffectedRows(); ?> |
179 | 179 | <?php $totalHits = $totalHits + $query->getHits(); ?> |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | </div> |
206 | 206 | <?php endif; ?> |
207 | 207 | |
208 | - <?php if( ! empty( $logs ) ): ?> |
|
208 | + <?php if ( ! empty($logs)): ?> |
|
209 | 209 | <!-- Logs --> |
210 | 210 | <div id="gear-toolbar-tab-logs" class="tab"> |
211 | 211 | <h2>Logs <span>(20)</span></h2> |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | </tr> |
220 | 220 | </tbody> |
221 | 221 | <tbody> |
222 | - <?php foreach( $logs as $log ): ?> |
|
222 | + <?php foreach ($logs as $log): ?> |
|
223 | 223 | <tr> |
224 | 224 | <td><?php echo $log->level; ?></td> |
225 | 225 | <td><?php echo $log->time; ?></td> |
@@ -186,11 +186,14 @@ |
||
186 | 186 | <td style="padding: 5px;"><?= $query->getExecutionDuration(); ?></td> |
187 | 187 | </tr> |
188 | 188 | <?php endforeach; ?> |
189 | - <?php else: ?> |
|
189 | + <?php else { |
|
190 | + : ?> |
|
190 | 191 | <tr style="border-bottom: 1px solid #ebebeb;"> |
191 | 192 | <th colspan="4" style="padding: 5px; color: #ccc;">No queries are executed!</th> |
192 | 193 | </tr> |
193 | - <?php endif; ?> |
|
194 | + <?php endif; |
|
195 | +} |
|
196 | +?> |
|
194 | 197 | <?php endforeach; ?> |
195 | 198 | </tbody> |
196 | 199 | <tfoot> |
@@ -5,7 +5,7 @@ |
||
5 | 5 | </title> |
6 | 6 | |
7 | 7 | <style type="text/css"> |
8 | - <?php echo preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__.'/assets/css/print-out.min.css')); ?> |
|
8 | + <?php echo preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__ . '/assets/css/print-out.min.css')); ?> |
|
9 | 9 | </style> |
10 | 10 | </head> |
11 | 11 | <body> |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <style type="text/css"> |
2 | - <?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__.'/assets/css/unit-testing.min.css')) ?> |
|
2 | + <?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__ . '/assets/css/unit-testing.min.css')) ?> |
|
3 | 3 | </style> |
4 | 4 | <div id="gear-toolbar"> |
5 | 5 | <img |
@@ -29,8 +29,11 @@ discard block |
||
29 | 29 | <pre> |
30 | 30 | <?php echo print_r($report->result, true); ?> |
31 | 31 | </pre> |
32 | - <?php else: ?> |
|
33 | - <?php echo $report->result; ?> |
|
32 | + <?php else { |
|
33 | + : ?> |
|
34 | + <?php echo $report->result; |
|
35 | +} |
|
36 | +?> |
|
34 | 37 | <?php endif; ?> |
35 | 38 | </td> |
36 | 39 | <td width="5"> |
@@ -41,8 +44,11 @@ discard block |
||
41 | 44 | <pre> |
42 | 45 | <?php echo print_r($report->expected, true); ?> |
43 | 46 | </pre> |
44 | - <?php else: ?> |
|
45 | - <?php echo $report->expected; ?> |
|
47 | + <?php else { |
|
48 | + : ?> |
|
49 | + <?php echo $report->expected; |
|
50 | +} |
|
51 | +?> |
|
46 | 52 | <?php endif; ?> |
47 | 53 | </td> |
48 | 54 | <td width="5"> |
@@ -51,9 +57,12 @@ discard block |
||
51 | 57 | <td width="5"> |
52 | 58 | <?php if ($report->status === 'passed'): ?> |
53 | 59 | <span class="label label-success">Passed</span> |
54 | - <?php else: ?> |
|
60 | + <?php else { |
|
61 | + : ?> |
|
55 | 62 | <span class="label label-danger">Failed</span> |
56 | - <?php endif; ?> |
|
63 | + <?php endif; |
|
64 | +} |
|
65 | +?> |
|
57 | 66 | </td> |
58 | 67 | <td width="10"> |
59 | 68 | <i class="text-muted"><?php echo $report->trace->file; ?>:<?php echo $report->trace->line; ?></i> |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <style type="text/css"> |
2 | - <?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__.'/assets/css/debugger.min.css')) ?> |
|
2 | + <?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__ . '/assets/css/debugger.min.css')) ?> |
|
3 | 3 | </style> |
4 | 4 | <div id="gear-toolbar"> |
5 | 5 | <img |
@@ -53,7 +53,7 @@ |
||
53 | 53 | ) . ' Line: ' . $chronology->file . ':' . $chronology->line . PHP_EOL . PHP_EOL; |
54 | 54 | $i++; |
55 | 55 | |
56 | - if($chronology->call === 'print_cli()') { |
|
56 | + if ($chronology->call === 'print_cli()') { |
|
57 | 57 | break; |
58 | 58 | } |
59 | 59 | } |
@@ -76,18 +76,18 @@ |
||
76 | 76 | foreach ($this->backtrace as $trace) { |
77 | 77 | $line = new Trace\Datastructures\Chronology($trace); |
78 | 78 | |
79 | - if (isset($trace[ 'class' ]) AND isset($trace[ 'type' ])) { |
|
80 | - $line->call = $trace[ 'class' ] . $trace[ 'type' ] . $trace[ 'function' ] . '()'; |
|
81 | - $line->type = $trace[ 'type' ] === '->' ? 'non-static' : 'static'; |
|
79 | + if (isset($trace['class']) AND isset($trace['type'])) { |
|
80 | + $line->call = $trace['class'] . $trace['type'] . $trace['function'] . '()'; |
|
81 | + $line->type = $trace['type'] === '->' ? 'non-static' : 'static'; |
|
82 | 82 | } else { |
83 | - $line->call = $trace[ 'function' ] . '()'; |
|
83 | + $line->call = $trace['function'] . '()'; |
|
84 | 84 | $line->type = 'non-static'; |
85 | 85 | } |
86 | 86 | |
87 | - if ( ! isset($trace[ 'file' ])) { |
|
87 | + if ( ! isset($trace['file'])) { |
|
88 | 88 | $currentTrace = current($this->backtrace); |
89 | - $line->file = isset($currentTrace[ 'file' ]) ? $currentTrace[ 'file' ] : null; |
|
90 | - $line->line = isset($currentTrace[ 'line' ]) ? $currentTrace[ 'line' ] : null; |
|
89 | + $line->file = isset($currentTrace['file']) ? $currentTrace['file'] : null; |
|
90 | + $line->line = isset($currentTrace['line']) ? $currentTrace['line'] : null; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | if (defined('PATH_ROOT')) { |
@@ -67,8 +67,8 @@ |
||
67 | 67 | print_cli($expression, $exit); |
68 | 68 | |
69 | 69 | return; |
70 | - } elseif ( ! empty($_SERVER[ 'HTTP_X_REQUESTED_WITH' ]) && strtolower( |
|
71 | - $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] |
|
70 | + } elseif ( ! empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower( |
|
71 | + $_SERVER['HTTP_X_REQUESTED_WITH'] |
|
72 | 72 | ) === 'xmlhttprequest') { |
73 | 73 | if (is_array($expression)) { |
74 | 74 | echo json_encode($expression, JSON_PRETTY_PRINT); |
@@ -27,17 +27,17 @@ discard block |
||
27 | 27 | |
28 | 28 | // ------------------------------------------------------------------------ |
29 | 29 | |
30 | - public function push( $metric ) |
|
30 | + public function push($metric) |
|
31 | 31 | { |
32 | 32 | $metric->stop(); |
33 | 33 | |
34 | - if ( ! $this->isEmpty() ) { |
|
34 | + if ( ! $this->isEmpty()) { |
|
35 | 35 | $metric->start($this->top()->endTime, $this->top()->endMemory); |
36 | - } elseif(defined('STARTUP_MEMORY')) { |
|
36 | + } elseif (defined('STARTUP_MEMORY')) { |
|
37 | 37 | $metric->start(STARTUP_TIME, STARTUP_MEMORY); |
38 | 38 | } |
39 | 39 | |
40 | - parent::push( $metric ); |
|
40 | + parent::push($metric); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | // ------------------------------------------------------------------------ |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function current() |
51 | 51 | { |
52 | - if ( null === ( $current = parent::current() ) ) { |
|
52 | + if (null === ($current = parent::current())) { |
|
53 | 53 | $this->rewind(); |
54 | 54 | } |
55 | 55 |