Completed
Push — master ( 75db82...680631 )
by Jacob
02:13
created
src/Console.php 1 patch
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -15,86 +15,86 @@
 block discarded – undo
15 15
 class Console
16 16
 {
17 17
 
18
-    /** @var  array */
19
-    protected $store = array();
18
+	/** @var  array */
19
+	protected $store = array();
20 20
 
21
-    /**
22
-     * Logs data to the console
23
-     * Accepts any data type
24
-     *
25
-     * @param mixed $data
26
-     */
27
-    public function log($data)
28
-    {
29
-        array_push($this->store, array(
30
-          'data' => $data,
31
-          'type' => 'log'
32
-        ));
33
-    }
21
+	/**
22
+	 * Logs data to the console
23
+	 * Accepts any data type
24
+	 *
25
+	 * @param mixed $data
26
+	 */
27
+	public function log($data)
28
+	{
29
+		array_push($this->store, array(
30
+		  'data' => $data,
31
+		  'type' => 'log'
32
+		));
33
+	}
34 34
 
35
-    /**
36
-     * Logs memory usage of a variable
37
-     * If no parameter is passed in, logs current memory usage
38
-     *
39
-     * @param mixed $object
40
-     * @param string $name
41
-     */
42
-    public function logMemory($object = null, $name = '')
43
-    {
44
-        $memory = memory_get_usage();
45
-        if (!is_null($object)) {
46
-            $memory = strlen(serialize($object));
47
-        }
35
+	/**
36
+	 * Logs memory usage of a variable
37
+	 * If no parameter is passed in, logs current memory usage
38
+	 *
39
+	 * @param mixed $object
40
+	 * @param string $name
41
+	 */
42
+	public function logMemory($object = null, $name = '')
43
+	{
44
+		$memory = memory_get_usage();
45
+		if (!is_null($object)) {
46
+			$memory = strlen(serialize($object));
47
+		}
48 48
 
49
-        array_push($this->store, array(
50
-            'name'      => $name,
51
-            'data'      => $memory,
52
-            'data_type' => gettype($object),
53
-            'type'      => 'memory'
54
-        ));
55
-    }
49
+		array_push($this->store, array(
50
+			'name'      => $name,
51
+			'data'      => $memory,
52
+			'data_type' => gettype($object),
53
+			'type'      => 'memory'
54
+		));
55
+	}
56 56
 
57
-    /**
58
-     * Logs exception with optional message override
59
-     *
60
-     * @param Exception $exception
61
-     * @param string    $message
62
-     */
63
-    public function logError(Exception $exception, $message = '')
64
-    {
65
-        if (empty($message)) {
66
-            $message = $exception->getMessage();
67
-        }
57
+	/**
58
+	 * Logs exception with optional message override
59
+	 *
60
+	 * @param Exception $exception
61
+	 * @param string    $message
62
+	 */
63
+	public function logError(Exception $exception, $message = '')
64
+	{
65
+		if (empty($message)) {
66
+			$message = $exception->getMessage();
67
+		}
68 68
 
69
-        array_push($this->store, array(
70
-            'data' => $message,
71
-            'file' => $exception->getFile(),
72
-            'line' => $exception->getLine(),
73
-            'type' => 'error'
74
-        ));
75
-    }
69
+		array_push($this->store, array(
70
+			'data' => $message,
71
+			'file' => $exception->getFile(),
72
+			'line' => $exception->getLine(),
73
+			'type' => 'error'
74
+		));
75
+	}
76 76
 
77
-    /**
78
-     * Logs current time with optional message
79
-     *
80
-     * @param string $name
81
-     */
82
-    public function logSpeed($name = 'Point in Time')
83
-    {
84
-        array_push($this->store, array(
85
-            'data' => microtime(true),
86
-            'name' => $name,
87
-            'type' => 'speed'
88
-        ));
89
-    }
77
+	/**
78
+	 * Logs current time with optional message
79
+	 *
80
+	 * @param string $name
81
+	 */
82
+	public function logSpeed($name = 'Point in Time')
83
+	{
84
+		array_push($this->store, array(
85
+			'data' => microtime(true),
86
+			'name' => $name,
87
+			'type' => 'speed'
88
+		));
89
+	}
90 90
 
91
-    /**
92
-     * Returns the collected logs
93
-     *
94
-     * @returns array
95
-     */
96
-    public function getLogs()
97
-    {
98
-        return $this->store;
99
-    }
91
+	/**
92
+	 * Returns the collected logs
93
+	 *
94
+	 * @returns array
95
+	 */
96
+	public function getLogs()
97
+	{
98
+		return $this->store;
99
+	}
100 100
 }
Please login to merge, or discard this patch.
src/PhpQuickProfiler.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
   protected $console;
26 26
 	
27 27
 	public function __construct($console, $startTime = null, $config = '/pqp/') {
28
-    $this->console = $console;
28
+	$this->console = $console;
29 29
 		$this->startTime = $startTime;
30 30
 		$this->config = $config;
31 31
 	}
@@ -35,49 +35,49 @@  discard block
 block discarded – undo
35 35
 	-------------------------------------------*/
36 36
 	
37 37
 	public function gatherConsoleData() {
38
-    $console = array(
39
-      'messages' => array(),
40
-      'totals' => array(
41
-        'log' => 0,
42
-        'memory' => 0,
43
-        'error' => 0,
44
-        'speed' => 0
45
-      ));
38
+	$console = array(
39
+	  'messages' => array(),
40
+	  'totals' => array(
41
+		'log' => 0,
42
+		'memory' => 0,
43
+		'error' => 0,
44
+		'speed' => 0
45
+	  ));
46 46
 		$logs = $this->console->getLogs();
47 47
 			foreach($logs as $log) {
48 48
 				if($log['type'] == 'log') {
49 49
 					$message = array(
50
-            'data' => print_r($log['data'], true),
51
-            'type' => 'log'
52
-          );
53
-          $console['totals']['log']++;
50
+			'data' => print_r($log['data'], true),
51
+			'type' => 'log'
52
+		  );
53
+		  $console['totals']['log']++;
54 54
 				}
55 55
 				elseif($log['type'] == 'memory') {
56 56
 					$message = array(
57
-            'name'    => $log['name'],
58
-            'data_type'    => $log['data_type'],
59
-            'data'   => $this->getReadableFileSize($log['data']),
60
-            'type' => 'memory'
61
-          );
62
-          $console['totals']['memory']++;
57
+			'name'    => $log['name'],
58
+			'data_type'    => $log['data_type'],
59
+			'data'   => $this->getReadableFileSize($log['data']),
60
+			'type' => 'memory'
61
+		  );
62
+		  $console['totals']['memory']++;
63 63
 				}
64 64
 				elseif($log['type'] == 'speed') {
65
-          $message = array(
66
-            'name' => $log['name'],
67
-            'data'    => $this->getReadableTime(($log['data'] - $this->startTime) * 1000),
68
-            'type' => 'speed'
69
-          );
70
-          $console['totals']['speed']++;
65
+		  $message = array(
66
+			'name' => $log['name'],
67
+			'data'    => $this->getReadableTime(($log['data'] - $this->startTime) * 1000),
68
+			'type' => 'speed'
69
+		  );
70
+		  $console['totals']['speed']++;
71 71
 				} else {
72
-          $message = array(
73
-            'data' => $log['data'],
74
-            'type' => 'error',
75
-            'file' => $log['file'],
76
-            'line' => $log['line']
77
-          );
78
-          $console['totals']['error']++;
79
-        }
80
-        array_push($console['messages'], $message);
72
+		  $message = array(
73
+			'data' => $log['data'],
74
+			'type' => 'error',
75
+			'file' => $log['file'],
76
+			'line' => $log['line']
77
+		  );
78
+		  $console['totals']['error']++;
79
+		}
80
+		array_push($console['messages'], $message);
81 81
 			}
82 82
 		$this->output['logs'] = array('console' => $console);
83 83
 	}
@@ -186,19 +186,19 @@  discard block
 block discarded – undo
186 186
 	}
187 187
 	
188 188
 	public function getReadableFileSize($size, $retstring = null) {
189
-        	// adapted from code at http://aidanlister.com/repos/v/function.size_readable.php
190
-	       $sizes = array('bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
189
+			// adapted from code at http://aidanlister.com/repos/v/function.size_readable.php
190
+		   $sizes = array('bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
191 191
 
192
-	       if ($retstring === null) { $retstring = '%01.2f %s'; }
192
+		   if ($retstring === null) { $retstring = '%01.2f %s'; }
193 193
 
194 194
 		$lastsizestring = end($sizes);
195 195
 
196 196
 		foreach ($sizes as $sizestring) {
197
-	       	if ($size < 1024) { break; }
198
-	           if ($sizestring != $lastsizestring) { $size /= 1024; }
199
-	       }
200
-	       if ($sizestring == $sizes[0]) { $retstring = '%01d %s'; } // Bytes aren't normally fractional
201
-	       return sprintf($retstring, $size, $sizestring);
197
+		   	if ($size < 1024) { break; }
198
+			   if ($sizestring != $lastsizestring) { $size /= 1024; }
199
+		   }
200
+		   if ($sizestring == $sizes[0]) { $retstring = '%01d %s'; } // Bytes aren't normally fractional
201
+		   return sprintf($retstring, $size, $sizestring);
202 202
 	}
203 203
 	
204 204
 	public function getReadableTime($time) {
Please login to merge, or discard this patch.