Completed
Push — master ( 01f91a...75db82 )
by Jacob
04:15
created
index.php 1 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.
display.php 1 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/MySqlDatabase.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,9 @@  discard block
 block discarded – undo
53 53
 	
54 54
 	function lazyLoadConnection() {
55 55
 		$this->connect(true);
56
-		if($this->database) $this->changeDatabase($this->database);
56
+		if($this->database) {
57
+			$this->changeDatabase($this->database);
58
+		}
57 59
 	}
58 60
 	
59 61
 	/*-----------------------------------
@@ -61,7 +63,9 @@  discard block
 block discarded – undo
61 63
 	------------------------------------*/
62 64
 	
63 65
 	function query($sql) {
64
-		if(!$this->conn) $this->lazyLoadConnection();
66
+		if(!$this->conn) {
67
+			$this->lazyLoadConnection();
68
+		}
65 69
 		$start = $this->getTime();
66 70
 		$rs = mysql_query($sql, $this->conn);
67 71
 		$this->queryCount += 1;
Please login to merge, or discard this patch.
src/PhpQuickProfiler.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -153,19 +153,19 @@
 block discarded – undo
153 153
 	}
154 154
 	
155 155
 	public function getReadableFileSize($size, $retstring = null) {
156
-        	// adapted from code at http://aidanlister.com/repos/v/function.size_readable.php
157
-	       $sizes = array('bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
156
+			// adapted from code at http://aidanlister.com/repos/v/function.size_readable.php
157
+		   $sizes = array('bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
158 158
 
159
-	       if ($retstring === null) { $retstring = '%01.2f %s'; }
159
+		   if ($retstring === null) { $retstring = '%01.2f %s'; }
160 160
 
161 161
 		$lastsizestring = end($sizes);
162 162
 
163 163
 		foreach ($sizes as $sizestring) {
164
-	       	if ($size < 1024) { break; }
165
-	           if ($sizestring != $lastsizestring) { $size /= 1024; }
166
-	       }
167
-	       if ($sizestring == $sizes[0]) { $retstring = '%01d %s'; } // Bytes aren't normally fractional
168
-	       return sprintf($retstring, $size, $sizestring);
164
+		   	if ($size < 1024) { break; }
165
+			   if ($sizestring != $lastsizestring) { $size /= 1024; }
166
+		   }
167
+		   if ($sizestring == $sizes[0]) { $retstring = '%01d %s'; } // Bytes aren't normally fractional
168
+		   return sprintf($retstring, $size, $sizestring);
169 169
 	}
170 170
 	
171 171
 	public function getReadableTime($time) {
Please login to merge, or discard this patch.
Braces   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -37,11 +37,9 @@  discard block
 block discarded – undo
37 37
 			foreach($logs['console'] as $key => $log) {
38 38
 				if($log['type'] == 'log') {
39 39
 					$logs['console'][$key]['data'] = print_r($log['data'], true);
40
-				}
41
-				elseif($log['type'] == 'memory') {
40
+				} elseif($log['type'] == 'memory') {
42 41
 					$logs['console'][$key]['data'] = $this->getReadableFileSize($log['data']);
43
-				}
44
-				elseif($log['type'] == 'speed') {
42
+				} elseif($log['type'] == 'speed') {
45 43
 					$logs['console'][$key]['data'] = $this->getReadableTime(($log['data'] - $this->startTime)*1000);
46 44
 				}
47 45
 			}
@@ -69,7 +67,9 @@  discard block
 block discarded – undo
69 67
 					'size' => $this->getReadableFileSize($size)
70 68
 				);
71 69
 			$fileTotals['size'] += $size;
72
-			if($size > $fileTotals['largest']) $fileTotals['largest'] = $size;
70
+			if($size > $fileTotals['largest']) {
71
+				$fileTotals['largest'] = $size;
72
+			}
73 73
 		}
74 74
 		
75 75
 		$fileTotals['size'] = $this->getReadableFileSize($fileTotals['size']);
@@ -122,8 +122,7 @@  discard block
 block discarded – undo
122 122
 		try {
123 123
 			$sql = 'EXPLAIN '.$query['sql'];
124 124
 			$rs = $this->db->query($sql);
125
-		}
126
-		catch(Exception $e) {}
125
+		} catch(Exception $e) {}
127 126
 		if($rs) {
128 127
 			$row = mysql_fetch_array($rs, MYSQL_ASSOC);
129 128
 			$query['explain'] = $row;
Please login to merge, or discard this patch.
src/Console.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -15,93 +15,93 @@
 block discarded – undo
15 15
 class Console
16 16
 {
17 17
 
18
-    /** @var  array */
19
-    protected $log = array();
18
+	/** @var  array */
19
+	protected $log = array();
20 20
 
21
-    /** @var  array */
22
-    protected $memory = array();
21
+	/** @var  array */
22
+	protected $memory = array();
23 23
 
24
-    /** @var  array */
25
-    protected $error = array();
24
+	/** @var  array */
25
+	protected $error = array();
26 26
 
27
-    /** @var  array */
28
-    protected $speed = array();
27
+	/** @var  array */
28
+	protected $speed = array();
29 29
 
30
-    /**
31
-     * Logs data to the console
32
-     * Accepts any data type
33
-     *
34
-     * @param mixed $data
35
-     */
36
-    public function log($data)
37
-    {
38
-        array_push($this->logs, $data);
39
-    }
30
+	/**
31
+	 * Logs data to the console
32
+	 * Accepts any data type
33
+	 *
34
+	 * @param mixed $data
35
+	 */
36
+	public function log($data)
37
+	{
38
+		array_push($this->logs, $data);
39
+	}
40 40
 
41
-    /**
42
-     * Logs memory usage of a variable
43
-     * If no parameter is passed in, logs current memory usage
44
-     *
45
-     * @param mixed $object
46
-     * @param string $name
47
-     */
48
-    public function logMemory($object = null, $name = '')
49
-    {
50
-        $memory = memory_get_usage();
51
-        if (!is_null($object)) {
52
-            $memory = strlen(serialize($object));
53
-        }
41
+	/**
42
+	 * Logs memory usage of a variable
43
+	 * If no parameter is passed in, logs current memory usage
44
+	 *
45
+	 * @param mixed $object
46
+	 * @param string $name
47
+	 */
48
+	public function logMemory($object = null, $name = '')
49
+	{
50
+		$memory = memory_get_usage();
51
+		if (!is_null($object)) {
52
+			$memory = strlen(serialize($object));
53
+		}
54 54
 
55
-        array_push($this->memory, array(
56
-            'usage' => $memory,
57
-            'name'  => $name,
58
-            'type'  => gettype($object)
59
-        ));
60
-    }
55
+		array_push($this->memory, array(
56
+			'usage' => $memory,
57
+			'name'  => $name,
58
+			'type'  => gettype($object)
59
+		));
60
+	}
61 61
 
62
-    /**
63
-     * Logs exception with optional message override
64
-     *
65
-     * @param Exception $exception
66
-     * @param string    $message
67
-     */
68
-    public function logError(Exception $exception, $message = '')
69
-    {
70
-        if (empty($message)) {
71
-            $message = $exception->getMessage();
72
-        }
62
+	/**
63
+	 * Logs exception with optional message override
64
+	 *
65
+	 * @param Exception $exception
66
+	 * @param string    $message
67
+	 */
68
+	public function logError(Exception $exception, $message = '')
69
+	{
70
+		if (empty($message)) {
71
+			$message = $exception->getMessage();
72
+		}
73 73
 
74
-        array_push($this->error, array(
75
-            'exception' => $exception,
76
-            'message'   => $message
77
-        ));
78
-    }
74
+		array_push($this->error, array(
75
+			'exception' => $exception,
76
+			'message'   => $message
77
+		));
78
+	}
79 79
 
80
-    /**
81
-     * Logs current time with optional message
82
-     *
83
-     * @param string $name
84
-     */
85
-    public function logSpeed($name = 'Point in Time')
86
-    {
87
-        array_push($this->speed, array(
88
-            'time' => microtime(true),
89
-            'name' => $name,
90
-        ));
91
-    }
80
+	/**
81
+	 * Logs current time with optional message
82
+	 *
83
+	 * @param string $name
84
+	 */
85
+	public function logSpeed($name = 'Point in Time')
86
+	{
87
+		array_push($this->speed, array(
88
+			'time' => microtime(true),
89
+			'name' => $name,
90
+		));
91
+	}
92 92
 
93
-    /**
94
-     * Returns the collected logs
95
-     *
96
-     * @returns array
97
-     */
98
-    public function getLogs()
99
-    {
100
-        return array(
101
-            'log'    => $this->log,
102
-            'memory' => $this->memory,
103
-            'error'  => $this->error,
104
-            'speed'  => $this->speed
105
-        );
106
-    }
93
+	/**
94
+	 * Returns the collected logs
95
+	 *
96
+	 * @returns array
97
+	 */
98
+	public function getLogs()
99
+	{
100
+		return array(
101
+			'log'    => $this->log,
102
+			'memory' => $this->memory,
103
+			'error'  => $this->error,
104
+			'speed'  => $this->speed
105
+		);
106
+	}
107 107
 }
Please login to merge, or discard this patch.