Completed
Push — master ( f9b271...616eb6 )
by Jacob
02:11
created
index.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@
 block discarded – undo
48 48
 			Console::logMemory($this, 'PQP Example Class : Line '.__LINE__);
49 49
 			Console::log('Ending log below with a sample error.');
50 50
 			throw new Exception('Unable to write to log!');
51
-		}
52
-		catch(Exception $e) {
51
+		} catch(Exception $e) {
53 52
 			Console::logError($e, 'Sample error logging.');
54 53
 		}
55 54
 	}
Please login to merge, or discard this patch.
src/Display.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     public function __invoke($output)
31 31
     {
32 32
 	
33
-$css = file_get_contents(__DIR__ . '/../css/pQp.css');
33
+$css = file_get_contents(__DIR__.'/../css/pQp.css');
34 34
 		
35 35
 echo <<<JAVASCRIPT
36 36
 <!-- JavaScript -->
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
 echo '<div id="pqp-console" class="pqp-box">';
163 163
 
164
-if($logCount ==  0) {
164
+if ($logCount == 0) {
165 165
 	echo '<h3>This panel has no log items.</h3>';
166 166
 }
167 167
 else {
@@ -178,29 +178,29 @@  discard block
 block discarded – undo
178 178
 		<table class="main" cellspacing="0">';
179 179
 		
180 180
 		$class = '';
181
-		foreach($this->console_data['messages'] as $log) {
181
+		foreach ($this->console_data['messages'] as $log) {
182 182
 			echo '<tr class="log-'.$log['type'].'">
183 183
 				<td class="type">'.$log['type'].'</td>
184 184
 				<td class="'.$class.'">';
185
-			if($log['type'] == 'log') {
185
+			if ($log['type'] == 'log') {
186 186
 				echo '<div><pre>'.$log['data'].'</pre></div>';
187 187
 			}
188
-			elseif($log['type'] == 'memory') {
188
+			elseif ($log['type'] == 'memory') {
189 189
 				echo '<div><pre>'.$log['data'].'</pre>';
190 190
           if (!empty($log['data_type'])) {
191 191
             echo '<em>'.$log['data_type'].'</em>: ';
192 192
           }
193 193
         echo $log['name'].' </div>';
194 194
 			}
195
-			elseif($log['type'] == 'speed') {
195
+			elseif ($log['type'] == 'speed') {
196 196
 				echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['name'].'</em></div>';
197 197
 			}
198
-			elseif($log['type'] == 'error') {
198
+			elseif ($log['type'] == 'error') {
199 199
 				echo '<div><em>Line '.$log['line'].'</em> : '.$log['data'].' <pre>'.$log['file'].'</pre></div>';
200 200
 			}
201 201
 		
202 202
 			echo '</td></tr>';
203
-			if($class == '') $class = 'alt';
203
+			if ($class == '') $class = 'alt';
204 204
 			else $class = '';
205 205
 		}
206 206
 			
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 
212 212
 echo '<div id="pqp-speed" class="pqp-box">';
213 213
 
214
-if($this->console_data['count']['speed'] ==  0) {
214
+if ($this->console_data['count']['speed'] == 0) {
215 215
 	echo '<h3>This panel has no log items.</h3>';
216 216
 }
217 217
 else {
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
 		<table class="main" cellspacing="0">';
223 223
 		
224 224
 		$class = '';
225
-		foreach($this->console_data['messages'] as $log) {
226
-			if($log['type'] == 'speed') {
225
+		foreach ($this->console_data['messages'] as $log) {
226
+			if ($log['type'] == 'speed') {
227 227
 				echo '<tr class="log-'.$log['type'].'">
228 228
 				<td class="'.$class.'">';
229 229
 				echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['name'].'</em></div>';
230 230
 				echo '</td></tr>';
231
-				if($class == '') $class = 'alt';
231
+				if ($class == '') $class = 'alt';
232 232
 				else $class = '';
233 233
 			}
234 234
 		}
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
 echo '<div id="pqp-queries" class="pqp-box">';
242 242
 
243
-if($output['queryTotals']['count'] ==  0) {
243
+if ($output['queryTotals']['count'] == 0) {
244 244
 	echo '<h3>This panel has no log items.</h3>';
245 245
 }
246 246
 else {
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
 		<table class="main" cellspacing="0">';
253 253
 		
254 254
 		$class = '';
255
-		foreach($output['queries'] as $query) {
255
+		foreach ($output['queries'] as $query) {
256 256
 			echo '<tr>
257 257
 				<td class="'.$class.'">'.$query['sql'];
258
-			if($query['explain']) {
258
+			if ($query['explain']) {
259 259
 					echo '<em>
260 260
 						Possible keys: <b>'.$query['explain']['possible_keys'].'</b> &middot; 
261 261
 						Key Used: <b>'.$query['explain']['key'].'</b> &middot; 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 					</em>';
266 266
 			}
267 267
 			echo '</td></tr>';
268
-			if($class == '') $class = 'alt';
268
+			if ($class == '') $class = 'alt';
269 269
 			else $class = '';
270 270
 		}
271 271
 			
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 
277 277
 echo '<div id="pqp-memory" class="pqp-box">';
278 278
 
279
-if($this->console_data['count']['memory'] ==  0) {
279
+if ($this->console_data['count']['memory'] == 0) {
280 280
 	echo '<h3>This panel has no log items.</h3>';
281 281
 }
282 282
 else {
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
 		<table class="main" cellspacing="0">';
288 288
 		
289 289
 		$class = '';
290
-		foreach($this->console_data['messages'] as $log) {
291
-			if($log['type'] == 'memory') {
290
+		foreach ($this->console_data['messages'] as $log) {
291
+			if ($log['type'] == 'memory') {
292 292
 				echo '<tr class="log-'.$log['type'].'">';
293 293
 				echo '<td class="'.$class.'"><b>'.$log['data'].'</b>';
294 294
           if ($log['data_type']) {
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
           }
297 297
         echo $log['name'].'</td>';
298 298
 				echo '</tr>';
299
-				if($class == '') $class = 'alt';
299
+				if ($class == '') $class = 'alt';
300 300
 				else $class = '';
301 301
 			}
302 302
 		}
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 
309 309
 echo '<div id="pqp-files" class="pqp-box">';
310 310
 
311
-if($output['fileTotals']['count'] ==  0) {
311
+if ($output['fileTotals']['count'] == 0) {
312 312
 	echo '<h3>This panel has no log items.</h3>';
313 313
 }
314 314
 else {
@@ -319,10 +319,10 @@  discard block
 block discarded – undo
319 319
 		 </table>
320 320
 		<table class="main" cellspacing="0">';
321 321
 		
322
-		$class ='';
323
-		foreach($output['files'] as $file) {
322
+		$class = '';
323
+		foreach ($output['files'] as $file) {
324 324
 			echo '<tr><td class="'.$class.'"><b>'.$file['size'].'</b> '.$file['name'].'</td></tr>';
325
-			if($class == '') $class = 'alt';
325
+			if ($class == '') $class = 'alt';
326 326
 			else $class = '';
327 327
 		}
328 328
 			
Please login to merge, or discard this patch.
Braces   +33 added lines, -26 removed lines patch added patch discarded remove patch
@@ -167,8 +167,7 @@  discard block
 block discarded – undo
167 167
 
168 168
 if($logCount ==  0) {
169 169
 	echo '<h3>This panel has no log items.</h3>';
170
-}
171
-else {
170
+} else {
172 171
 	echo '<table class="side" cellspacing="0">
173 172
 		<tr>
174 173
 			<td class="alt1"><var>'.$output['logs']['logCount'].'</var><h4>Logs</h4></td>
@@ -188,20 +187,20 @@  discard block
 block discarded – undo
188 187
 				<td class="'.$class.'">';
189 188
 			if($log['type'] == 'log') {
190 189
 				echo '<div><pre>'.$log['data'].'</pre></div>';
191
-			}
192
-			elseif($log['type'] == 'memory') {
190
+			} elseif($log['type'] == 'memory') {
193 191
 				echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['dataType'].'</em>: '.$log['name'].' </div>';
194
-			}
195
-			elseif($log['type'] == 'speed') {
192
+			} elseif($log['type'] == 'speed') {
196 193
 				echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['name'].'</em></div>';
197
-			}
198
-			elseif($log['type'] == 'error') {
194
+			} elseif($log['type'] == 'error') {
199 195
 				echo '<div><em>Line '.$log['line'].'</em> : '.$log['data'].' <pre>'.$log['file'].'</pre></div>';
200 196
 			}
201 197
 		
202 198
 			echo '</td></tr>';
203
-			if($class == '') $class = 'alt';
204
-			else $class = '';
199
+			if($class == '') {
200
+				$class = 'alt';
201
+			} else {
202
+				$class = '';
203
+			}
205 204
 		}
206 205
 			
207 206
 		echo '</table>';
@@ -213,8 +212,7 @@  discard block
 block discarded – undo
213 212
 
214 213
 if($output['logs']['speedCount'] ==  0) {
215 214
 	echo '<h3>This panel has no log items.</h3>';
216
-}
217
-else {
215
+} else {
218 216
 	echo '<table class="side" cellspacing="0">
219 217
 		  <tr><td><var>'.$output['speedTotals']['total'].'</var><h4>Load Time</h4></td></tr>
220 218
 		  <tr><td class="alt"><var>'.$output['speedTotals']['allowed'].'</var> <h4>Max Execution Time</h4></td></tr>
@@ -228,8 +226,11 @@  discard block
 block discarded – undo
228 226
 				<td class="'.$class.'">';
229 227
 				echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['name'].'</em></div>';
230 228
 				echo '</td></tr>';
231
-				if($class == '') $class = 'alt';
232
-				else $class = '';
229
+				if($class == '') {
230
+					$class = 'alt';
231
+				} else {
232
+					$class = '';
233
+				}
233 234
 			}
234 235
 		}
235 236
 			
@@ -242,8 +243,7 @@  discard block
 block discarded – undo
242 243
 
243 244
 if($output['queryTotals']['count'] ==  0) {
244 245
 	echo '<h3>This panel has no log items.</h3>';
245
-}
246
-else {
246
+} else {
247 247
 	echo '<table class="side" cellspacing="0">
248 248
 		  <tr><td><var>'.$output['queryTotals']['count'].'</var><h4>Total Queries</h4></td></tr>
249 249
 		  <tr><td class="alt"><var>'.$output['queryTotals']['time'].'</var> <h4>Total Time</h4></td></tr>
@@ -265,8 +265,11 @@  discard block
 block discarded – undo
265 265
 					</em>';
266 266
 			}
267 267
 			echo '</td></tr>';
268
-			if($class == '') $class = 'alt';
269
-			else $class = '';
268
+			if($class == '') {
269
+				$class = 'alt';
270
+			} else {
271
+				$class = '';
272
+			}
270 273
 		}
271 274
 			
272 275
 		echo '</table>';
@@ -278,8 +281,7 @@  discard block
 block discarded – undo
278 281
 
279 282
 if($output['logs']['memoryCount'] ==  0) {
280 283
 	echo '<h3>This panel has no log items.</h3>';
281
-}
282
-else {
284
+} else {
283 285
 	echo '<table class="side" cellspacing="0">
284 286
 		  <tr><td><var>'.$output['memoryTotals']['used'].'</var><h4>Used Memory</h4></td></tr>
285 287
 		  <tr><td class="alt"><var>'.$output['memoryTotals']['total'].'</var> <h4>Total Available</h4></td></tr>
@@ -292,8 +294,11 @@  discard block
 block discarded – undo
292 294
 				echo '<tr class="log-'.$log['type'].'">';
293 295
 				echo '<td class="'.$class.'"><b>'.$log['data'].'</b> <em>'.$log['dataType'].'</em>: '.$log['name'].'</td>';
294 296
 				echo '</tr>';
295
-				if($class == '') $class = 'alt';
296
-				else $class = '';
297
+				if($class == '') {
298
+					$class = 'alt';
299
+				} else {
300
+					$class = '';
301
+				}
297 302
 			}
298 303
 		}
299 304
 			
@@ -306,8 +311,7 @@  discard block
 block discarded – undo
306 311
 
307 312
 if($output['fileTotals']['count'] ==  0) {
308 313
 	echo '<h3>This panel has no log items.</h3>';
309
-}
310
-else {
314
+} else {
311 315
 	echo '<table class="side" cellspacing="0">
312 316
 		  	<tr><td><var>'.$output['fileTotals']['count'].'</var><h4>Total Files</h4></td></tr>
313 317
 			<tr><td class="alt"><var>'.$output['fileTotals']['size'].'</var> <h4>Total Size</h4></td></tr>
@@ -318,8 +322,11 @@  discard block
 block discarded – undo
318 322
 		$class ='';
319 323
 		foreach($output['files'] as $file) {
320 324
 			echo '<tr><td class="'.$class.'"><b>'.$file['size'].'</b> '.$file['name'].'</td></tr>';
321
-			if($class == '') $class = 'alt';
322
-			else $class = '';
325
+			if($class == '') {
326
+				$class = 'alt';
327
+			} else {
328
+				$class = '';
329
+			}
323 330
 		}
324 331
 			
325 332
 		echo '</table>';
Please login to merge, or discard this patch.
src/PhpQuickProfiler.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         );
54 54
 
55 55
         foreach ($this->console->getLogs() as $log) {
56
-            switch($log['type']) {
56
+            switch ($log['type']) {
57 57
                 case 'log':
58 58
                     $message = array(
59 59
                         'data' => print_r($log['data'], true),
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
       "largest" => 0,
117 117
     );
118 118
 
119
-    foreach($files as $file) {
119
+    foreach ($files as $file) {
120 120
       $size = filesize($file);
121 121
       $fileList[] = array(
122 122
           'name' => $file,
123 123
           'size' => $this->getReadableFileSize($size)
124 124
         );
125 125
       $fileTotals['size'] += $size;
126
-      if($size > $fileTotals['largest']) $fileTotals['largest'] = $size;
126
+      if ($size > $fileTotals['largest']) $fileTotals['largest'] = $size;
127 127
     }
128 128
     
129 129
     $fileTotals['size'] = $this->getReadableFileSize($fileTotals['size']);
@@ -153,9 +153,9 @@  discard block
 block discarded – undo
153 153
     $queryTotals['time'] = 0;
154 154
     $queries = array();
155 155
     
156
-    if($this->db != '') {
156
+    if ($this->db != '') {
157 157
       $queryTotals['count'] += $this->db->queryCount;
158
-      foreach($this->db->queries as $query) {
158
+      foreach ($this->db->queries as $query) {
159 159
         $query = $this->attemptToExplainQuery($query);
160 160
         $queryTotals['time'] += $query['time'];
161 161
         $query['time'] = $this->getReadableTime($query['time']);
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
       $sql = 'EXPLAIN '.$query['sql'];
178 178
       $rs = $this->db->query($sql);
179 179
     }
180
-    catch(Exception $e) {}
181
-    if($rs) {
180
+    catch (Exception $e) {}
181
+    if ($rs) {
182 182
       $row = mysql_fetch_array($rs, MYSQL_ASSOC);
183 183
       $query['explain'] = $row;
184 184
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -123,7 +123,9 @@  discard block
 block discarded – undo
123 123
           'size' => $this->getReadableFileSize($size)
124 124
         );
125 125
       $fileTotals['size'] += $size;
126
-      if($size > $fileTotals['largest']) $fileTotals['largest'] = $size;
126
+      if($size > $fileTotals['largest']) {
127
+      	$fileTotals['largest'] = $size;
128
+      }
127 129
     }
128 130
     
129 131
     $fileTotals['size'] = $this->getReadableFileSize($fileTotals['size']);
@@ -176,8 +178,7 @@  discard block
 block discarded – undo
176 178
     try {
177 179
       $sql = 'EXPLAIN '.$query['sql'];
178 180
       $rs = $this->db->query($sql);
179
-    }
180
-    catch(Exception $e) {}
181
+    } catch(Exception $e) {}
181 182
     if($rs) {
182 183
       $row = mysql_fetch_array($rs, MYSQL_ASSOC);
183 184
       $query['explain'] = $row;
Please login to merge, or discard this patch.