Completed
Push — master ( 77243d...dac2cf )
by Jacob
02:14
created
src/PhpQuickProfiler.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
   protected $console;
25 25
 	
26 26
 	public function __construct($console, $startTime = null) {
27
-    $this->console = $console;
27
+	$this->console = $console;
28 28
 
29
-    if (is_null($startTime)) {
30
-        $startTime = microtime(true);
31
-    }
29
+	if (is_null($startTime)) {
30
+		$startTime = microtime(true);
31
+	}
32 32
 
33 33
 		$this->startTime = $startTime;
34 34
 	}
@@ -38,49 +38,49 @@  discard block
 block discarded – undo
38 38
 	-------------------------------------------*/
39 39
 	
40 40
 	public function gatherConsoleData() {
41
-    $console = array(
42
-      'messages' => array(),
43
-      'totals' => array(
44
-        'log' => 0,
45
-        'memory' => 0,
46
-        'error' => 0,
47
-        'speed' => 0
48
-      ));
41
+	$console = array(
42
+	  'messages' => array(),
43
+	  'totals' => array(
44
+		'log' => 0,
45
+		'memory' => 0,
46
+		'error' => 0,
47
+		'speed' => 0
48
+	  ));
49 49
 		$logs = $this->console->getLogs();
50 50
 			foreach($logs as $log) {
51 51
 				if($log['type'] == 'log') {
52 52
 					$message = array(
53
-            'data' => print_r($log['data'], true),
54
-            'type' => 'log'
55
-          );
56
-          $console['totals']['log']++;
53
+			'data' => print_r($log['data'], true),
54
+			'type' => 'log'
55
+		  );
56
+		  $console['totals']['log']++;
57 57
 				}
58 58
 				elseif($log['type'] == 'memory') {
59 59
 					$message = array(
60
-            'name'    => $log['name'],
61
-            'data_type'    => $log['data_type'],
62
-            'data'   => $this->getReadableFileSize($log['data']),
63
-            'type' => 'memory'
64
-          );
65
-          $console['totals']['memory']++;
60
+			'name'    => $log['name'],
61
+			'data_type'    => $log['data_type'],
62
+			'data'   => $this->getReadableFileSize($log['data']),
63
+			'type' => 'memory'
64
+		  );
65
+		  $console['totals']['memory']++;
66 66
 				}
67 67
 				elseif($log['type'] == 'speed') {
68
-          $message = array(
69
-            'name' => $log['name'],
70
-            'data'    => $this->getReadableTime(($log['data'] - $this->startTime) * 1000),
71
-            'type' => 'speed'
72
-          );
73
-          $console['totals']['speed']++;
68
+		  $message = array(
69
+			'name' => $log['name'],
70
+			'data'    => $this->getReadableTime(($log['data'] - $this->startTime) * 1000),
71
+			'type' => 'speed'
72
+		  );
73
+		  $console['totals']['speed']++;
74 74
 				} else {
75
-          $message = array(
76
-            'data' => $log['data'],
77
-            'type' => 'error',
78
-            'file' => $log['file'],
79
-            'line' => $log['line']
80
-          );
81
-          $console['totals']['error']++;
82
-        }
83
-        array_push($console['messages'], $message);
75
+		  $message = array(
76
+			'data' => $log['data'],
77
+			'type' => 'error',
78
+			'file' => $log['file'],
79
+			'line' => $log['line']
80
+		  );
81
+		  $console['totals']['error']++;
82
+		}
83
+		array_push($console['messages'], $message);
84 84
 			}
85 85
 		$this->output['logs'] = array('console' => $console);
86 86
 	}
@@ -183,19 +183,19 @@  discard block
 block discarded – undo
183 183
 	-------------------------------------------*/
184 184
 	
185 185
 	public function getReadableFileSize($size, $retstring = null) {
186
-        	// adapted from code at http://aidanlister.com/repos/v/function.size_readable.php
187
-	       $sizes = array('bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
186
+			// adapted from code at http://aidanlister.com/repos/v/function.size_readable.php
187
+		   $sizes = array('bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
188 188
 
189
-	       if ($retstring === null) { $retstring = '%01.2f %s'; }
189
+		   if ($retstring === null) { $retstring = '%01.2f %s'; }
190 190
 
191 191
 		$lastsizestring = end($sizes);
192 192
 
193 193
 		foreach ($sizes as $sizestring) {
194
-	       	if ($size < 1024) { break; }
195
-	           if ($sizestring != $lastsizestring) { $size /= 1024; }
196
-	       }
197
-	       if ($sizestring == $sizes[0]) { $retstring = '%01d %s'; } // Bytes aren't normally fractional
198
-	       return sprintf($retstring, $size, $sizestring);
194
+		   	if ($size < 1024) { break; }
195
+			   if ($sizestring != $lastsizestring) { $size /= 1024; }
196
+		   }
197
+		   if ($sizestring == $sizes[0]) { $retstring = '%01d %s'; } // Bytes aren't normally fractional
198
+		   return sprintf($retstring, $size, $sizestring);
199 199
 	}
200 200
 	
201 201
 	public function getReadableTime($time) {
Please login to merge, or discard this patch.