@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | Console::log('Ending log below with a sample error.'); |
50 | 50 | throw new Exception('Unable to write to log!'); |
51 | 51 | } |
52 | - catch(Exception $e) { |
|
52 | + catch (Exception $e) { |
|
53 | 53 | Console::logError($e, 'Sample error logging.'); |
54 | 54 | } |
55 | 55 | } |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | $ret = ''; |
85 | 85 | $longString = 'This is a really long string that when appended with the . symbol |
86 | 86 | will cause memory to be duplicated in order to create the new string.'; |
87 | - for($i = 0; $i < 10; $i++) { |
|
88 | - $ret = $ret . $longString; |
|
87 | + for ($i = 0; $i < 10; $i++) { |
|
88 | + $ret = $ret.$longString; |
|
89 | 89 | Console::logMemory($ret, 'Watch memory leak -- iteration '.$i); |
90 | 90 | } |
91 | 91 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public function __invoke($output) |
24 | 24 | { |
25 | 25 | |
26 | -$css = file_get_contents(__DIR__ . '/../css/pQp.css'); |
|
26 | +$css = file_get_contents(__DIR__.'/../css/pQp.css'); |
|
27 | 27 | |
28 | 28 | echo <<<JAVASCRIPT |
29 | 29 | <!-- JavaScript --> |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | echo '<div id="pqp-console" class="pqp-box">'; |
169 | 169 | |
170 | -if($logCount == 0) { |
|
170 | +if ($logCount == 0) { |
|
171 | 171 | echo '<h3>This panel has no log items.</h3>'; |
172 | 172 | } |
173 | 173 | else { |
@@ -185,25 +185,25 @@ discard block |
||
185 | 185 | <table class="main" cellspacing="0">'; |
186 | 186 | |
187 | 187 | $class = ''; |
188 | - foreach($output['logs']['console']['messages'] as $log) { |
|
188 | + foreach ($output['logs']['console']['messages'] as $log) { |
|
189 | 189 | echo '<tr class="log-'.$log['type'].'"> |
190 | 190 | <td class="type">'.$log['type'].'</td> |
191 | 191 | <td class="'.$class.'">'; |
192 | - if($log['type'] == 'log') { |
|
192 | + if ($log['type'] == 'log') { |
|
193 | 193 | echo '<div><pre>'.$log['data'].'</pre></div>'; |
194 | 194 | } |
195 | - elseif($log['type'] == 'memory') { |
|
195 | + elseif ($log['type'] == 'memory') { |
|
196 | 196 | echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['data_type'].'</em>: '.$log['name'].' </div>'; |
197 | 197 | } |
198 | - elseif($log['type'] == 'speed') { |
|
198 | + elseif ($log['type'] == 'speed') { |
|
199 | 199 | echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['name'].'</em></div>'; |
200 | 200 | } |
201 | - elseif($log['type'] == 'error') { |
|
201 | + elseif ($log['type'] == 'error') { |
|
202 | 202 | echo '<div><em>Line '.$log['line'].'</em> : '.$log['data'].' <pre>'.$log['file'].'</pre></div>'; |
203 | 203 | } |
204 | 204 | |
205 | 205 | echo '</td></tr>'; |
206 | - if($class == '') $class = 'alt'; |
|
206 | + if ($class == '') $class = 'alt'; |
|
207 | 207 | else $class = ''; |
208 | 208 | } |
209 | 209 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | echo '<div id="pqp-speed" class="pqp-box">'; |
216 | 216 | |
217 | -if($output['logs']['speedCount'] == 0) { |
|
217 | +if ($output['logs']['speedCount'] == 0) { |
|
218 | 218 | echo '<h3>This panel has no log items.</h3>'; |
219 | 219 | } |
220 | 220 | else { |
@@ -225,13 +225,13 @@ discard block |
||
225 | 225 | <table class="main" cellspacing="0">'; |
226 | 226 | |
227 | 227 | $class = ''; |
228 | - foreach($output['logs']['console'] as $log) { |
|
229 | - if($log['type'] == 'speed') { |
|
228 | + foreach ($output['logs']['console'] as $log) { |
|
229 | + if ($log['type'] == 'speed') { |
|
230 | 230 | echo '<tr class="log-'.$log['type'].'"> |
231 | 231 | <td class="'.$class.'">'; |
232 | 232 | echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['name'].'</em></div>'; |
233 | 233 | echo '</td></tr>'; |
234 | - if($class == '') $class = 'alt'; |
|
234 | + if ($class == '') $class = 'alt'; |
|
235 | 235 | else $class = ''; |
236 | 236 | } |
237 | 237 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | echo '<div id="pqp-queries" class="pqp-box">'; |
245 | 245 | |
246 | -if($output['queryTotals']['count'] == 0) { |
|
246 | +if ($output['queryTotals']['count'] == 0) { |
|
247 | 247 | echo '<h3>This panel has no log items.</h3>'; |
248 | 248 | } |
249 | 249 | else { |
@@ -255,10 +255,10 @@ discard block |
||
255 | 255 | <table class="main" cellspacing="0">'; |
256 | 256 | |
257 | 257 | $class = ''; |
258 | - foreach($output['queries'] as $query) { |
|
258 | + foreach ($output['queries'] as $query) { |
|
259 | 259 | echo '<tr> |
260 | 260 | <td class="'.$class.'">'.$query['sql']; |
261 | - if($query['explain']) { |
|
261 | + if ($query['explain']) { |
|
262 | 262 | echo '<em> |
263 | 263 | Possible keys: <b>'.$query['explain']['possible_keys'].'</b> · |
264 | 264 | Key Used: <b>'.$query['explain']['key'].'</b> · |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | </em>'; |
269 | 269 | } |
270 | 270 | echo '</td></tr>'; |
271 | - if($class == '') $class = 'alt'; |
|
271 | + if ($class == '') $class = 'alt'; |
|
272 | 272 | else $class = ''; |
273 | 273 | } |
274 | 274 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | echo '<div id="pqp-memory" class="pqp-box">'; |
281 | 281 | |
282 | -if($output['logs']['memoryCount'] == 0) { |
|
282 | +if ($output['logs']['memoryCount'] == 0) { |
|
283 | 283 | echo '<h3>This panel has no log items.</h3>'; |
284 | 284 | } |
285 | 285 | else { |
@@ -290,12 +290,12 @@ discard block |
||
290 | 290 | <table class="main" cellspacing="0">'; |
291 | 291 | |
292 | 292 | $class = ''; |
293 | - foreach($output['logs']['console'] as $log) { |
|
294 | - if($log['type'] == 'memory') { |
|
293 | + foreach ($output['logs']['console'] as $log) { |
|
294 | + if ($log['type'] == 'memory') { |
|
295 | 295 | echo '<tr class="log-'.$log['type'].'">'; |
296 | 296 | echo '<td class="'.$class.'"><b>'.$log['data'].'</b> <em>'.$log['dataType'].'</em>: '.$log['name'].'</td>'; |
297 | 297 | echo '</tr>'; |
298 | - if($class == '') $class = 'alt'; |
|
298 | + if ($class == '') $class = 'alt'; |
|
299 | 299 | else $class = ''; |
300 | 300 | } |
301 | 301 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | |
308 | 308 | echo '<div id="pqp-files" class="pqp-box">'; |
309 | 309 | |
310 | -if($output['fileTotals']['count'] == 0) { |
|
310 | +if ($output['fileTotals']['count'] == 0) { |
|
311 | 311 | echo '<h3>This panel has no log items.</h3>'; |
312 | 312 | } |
313 | 313 | else { |
@@ -318,10 +318,10 @@ discard block |
||
318 | 318 | </table> |
319 | 319 | <table class="main" cellspacing="0">'; |
320 | 320 | |
321 | - $class =''; |
|
322 | - foreach($output['files'] as $file) { |
|
321 | + $class = ''; |
|
322 | + foreach ($output['files'] as $file) { |
|
323 | 323 | echo '<tr><td class="'.$class.'"><b>'.$file['size'].'</b> '.$file['name'].'</td></tr>'; |
324 | - if($class == '') $class = 'alt'; |
|
324 | + if ($class == '') $class = 'alt'; |
|
325 | 325 | else $class = ''; |
326 | 326 | } |
327 | 327 |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | 'speed' => 0 |
52 | 52 | )); |
53 | 53 | $logs = $this->console->getLogs(); |
54 | - foreach($logs as $log) { |
|
55 | - if($log['type'] == 'log') { |
|
54 | + foreach ($logs as $log) { |
|
55 | + if ($log['type'] == 'log') { |
|
56 | 56 | $message = array( |
57 | 57 | 'data' => print_r($log['data'], true), |
58 | 58 | 'type' => 'log' |
59 | 59 | ); |
60 | 60 | $console['totals']['log']++; |
61 | 61 | } |
62 | - elseif($log['type'] == 'memory') { |
|
62 | + elseif ($log['type'] == 'memory') { |
|
63 | 63 | $message = array( |
64 | 64 | 'name' => $log['name'], |
65 | 65 | 'data_type' => $log['data_type'], |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | ); |
69 | 69 | $console['totals']['memory']++; |
70 | 70 | } |
71 | - elseif($log['type'] == 'speed') { |
|
71 | + elseif ($log['type'] == 'speed') { |
|
72 | 72 | $message = array( |
73 | 73 | 'name' => $log['name'], |
74 | 74 | 'data' => $this->getReadableTime(($log['data'] - $this->startTime) * 1000), |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | "largest" => 0, |
103 | 103 | ); |
104 | 104 | |
105 | - foreach($files as $file) { |
|
105 | + foreach ($files as $file) { |
|
106 | 106 | $size = filesize($file); |
107 | 107 | $fileList[] = array( |
108 | 108 | 'name' => $file, |
109 | 109 | 'size' => $this->getReadableFileSize($size) |
110 | 110 | ); |
111 | 111 | $fileTotals['size'] += $size; |
112 | - if($size > $fileTotals['largest']) $fileTotals['largest'] = $size; |
|
112 | + if ($size > $fileTotals['largest']) $fileTotals['largest'] = $size; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | $fileTotals['size'] = $this->getReadableFileSize($fileTotals['size']); |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | $queryTotals['time'] = 0; |
140 | 140 | $queries = array(); |
141 | 141 | |
142 | - if($this->db != '') { |
|
142 | + if ($this->db != '') { |
|
143 | 143 | $queryTotals['count'] += $this->db->queryCount; |
144 | - foreach($this->db->queries as $query) { |
|
144 | + foreach ($this->db->queries as $query) { |
|
145 | 145 | $query = $this->attemptToExplainQuery($query); |
146 | 146 | $queryTotals['time'] += $query['time']; |
147 | 147 | $query['time'] = $this->getReadableTime($query['time']); |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | $sql = 'EXPLAIN '.$query['sql']; |
164 | 164 | $rs = $this->db->query($sql); |
165 | 165 | } |
166 | - catch(Exception $e) {} |
|
167 | - if($rs) { |
|
166 | + catch (Exception $e) {} |
|
167 | + if ($rs) { |
|
168 | 168 | $row = mysql_fetch_array($rs, MYSQL_ASSOC); |
169 | 169 | $query['explain'] = $row; |
170 | 170 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | public function gatherSpeedData() { |
179 | 179 | $speedTotals = array(); |
180 | - $speedTotals['total'] = $this->getReadableTime((microtime(true) - $this->startTime)*1000); |
|
180 | + $speedTotals['total'] = $this->getReadableTime((microtime(true) - $this->startTime) * 1000); |
|
181 | 181 | $speedTotals['allowed'] = ini_get("max_execution_time"); |
182 | 182 | $this->output['speedTotals'] = $speedTotals; |
183 | 183 | } |
@@ -206,15 +206,15 @@ discard block |
||
206 | 206 | $ret = $time; |
207 | 207 | $formatter = 0; |
208 | 208 | $formats = array('ms', 's', 'm'); |
209 | - if($time >= 1000 && $time < 60000) { |
|
209 | + if ($time >= 1000 && $time < 60000) { |
|
210 | 210 | $formatter = 1; |
211 | 211 | $ret = ($time / 1000); |
212 | 212 | } |
213 | - if($time >= 60000) { |
|
213 | + if ($time >= 60000) { |
|
214 | 214 | $formatter = 2; |
215 | 215 | $ret = ($time / 1000) / 60; |
216 | 216 | } |
217 | - $ret = number_format($ret,3,'.','') . ' ' . $formats[$formatter]; |
|
217 | + $ret = number_format($ret, 3, '.', '').' '.$formats[$formatter]; |
|
218 | 218 | return $ret; |
219 | 219 | } |
220 | 220 |