| @@ -153,19 +153,19 @@ | ||
| 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) { | 
| @@ -15,93 +15,93 @@ | ||
| 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 | } |