@@ -14,96 +14,96 @@ |
||
14 | 14 | class Console |
15 | 15 | { |
16 | 16 | |
17 | - /** @var array */ |
|
18 | - protected $log = array(); |
|
17 | + /** @var array */ |
|
18 | + protected $log = array(); |
|
19 | 19 | |
20 | - /** @var array */ |
|
21 | - protected $memory = array(); |
|
20 | + /** @var array */ |
|
21 | + protected $memory = array(); |
|
22 | 22 | |
23 | - /** @var array */ |
|
24 | - protected $error = array(); |
|
23 | + /** @var array */ |
|
24 | + protected $error = array(); |
|
25 | 25 | |
26 | - /** @var array */ |
|
27 | - protected $speed = array(); |
|
26 | + /** @var array */ |
|
27 | + protected $speed = array(); |
|
28 | 28 | |
29 | - /** |
|
30 | - * Logs data to the console |
|
31 | - * Accepts any data type |
|
32 | - * |
|
33 | - * @param mixed $data |
|
34 | - */ |
|
35 | - public function log($data) |
|
36 | - { |
|
37 | - array_push($this->logs, $data); |
|
38 | - } |
|
29 | + /** |
|
30 | + * Logs data to the console |
|
31 | + * Accepts any data type |
|
32 | + * |
|
33 | + * @param mixed $data |
|
34 | + */ |
|
35 | + public function log($data) |
|
36 | + { |
|
37 | + array_push($this->logs, $data); |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Logs memory usage of a variable |
|
42 | - * If no parameter is passed in, logs current memory usage |
|
43 | - * |
|
44 | - * @param mixed $object |
|
45 | - * @param string $name |
|
46 | - */ |
|
47 | - public function logMemory($object = null, $name = '') |
|
48 | - { |
|
49 | - if (!is_null($object)) { |
|
50 | - $memory = strlen(serialize($object)); |
|
51 | - } else { |
|
52 | - $memory = memory_get_usage(); |
|
53 | - $name = 'PHP'; |
|
54 | - } |
|
40 | + /** |
|
41 | + * Logs memory usage of a variable |
|
42 | + * If no parameter is passed in, logs current memory usage |
|
43 | + * |
|
44 | + * @param mixed $object |
|
45 | + * @param string $name |
|
46 | + */ |
|
47 | + public function logMemory($object = null, $name = '') |
|
48 | + { |
|
49 | + if (!is_null($object)) { |
|
50 | + $memory = strlen(serialize($object)); |
|
51 | + } else { |
|
52 | + $memory = memory_get_usage(); |
|
53 | + $name = 'PHP'; |
|
54 | + } |
|
55 | 55 | |
56 | - array_push($this->memory, array( |
|
57 | - 'data' => $memory, |
|
58 | - 'name' => $name, |
|
59 | - 'type' => gettype($object) |
|
60 | - )); |
|
61 | - } |
|
56 | + array_push($this->memory, array( |
|
57 | + 'data' => $memory, |
|
58 | + 'name' => $name, |
|
59 | + 'type' => gettype($object) |
|
60 | + )); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Logs exception with optional message override |
|
65 | - * |
|
66 | - * @param Exception $exception |
|
67 | - * @param string $message |
|
68 | - */ |
|
69 | - public function logError(Exception $exception, $message = '') |
|
70 | - { |
|
71 | - if (empty($message)) { |
|
72 | - $message = $exception->getMessage(); |
|
73 | - } |
|
63 | + /** |
|
64 | + * Logs exception with optional message override |
|
65 | + * |
|
66 | + * @param Exception $exception |
|
67 | + * @param string $message |
|
68 | + */ |
|
69 | + public function logError(Exception $exception, $message = '') |
|
70 | + { |
|
71 | + if (empty($message)) { |
|
72 | + $message = $exception->getMessage(); |
|
73 | + } |
|
74 | 74 | |
75 | - array_push($this->error, array( |
|
76 | - 'data' => $message, |
|
77 | - 'file' => $exception->getFile(), |
|
78 | - 'line' => $exception->getLine(), |
|
79 | - )); |
|
80 | - } |
|
75 | + array_push($this->error, array( |
|
76 | + 'data' => $message, |
|
77 | + 'file' => $exception->getFile(), |
|
78 | + 'line' => $exception->getLine(), |
|
79 | + )); |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * Logs current time with optional message |
|
84 | - * |
|
85 | - * @param string $name |
|
86 | - */ |
|
87 | - public function logSpeed($name = 'Point in Time') |
|
88 | - { |
|
89 | - array_push($this->speed, array( |
|
90 | - 'data' => microtime(true), |
|
91 | - 'name' => $name, |
|
92 | - )); |
|
93 | - } |
|
82 | + /** |
|
83 | + * Logs current time with optional message |
|
84 | + * |
|
85 | + * @param string $name |
|
86 | + */ |
|
87 | + public function logSpeed($name = 'Point in Time') |
|
88 | + { |
|
89 | + array_push($this->speed, array( |
|
90 | + 'data' => microtime(true), |
|
91 | + 'name' => $name, |
|
92 | + )); |
|
93 | + } |
|
94 | 94 | |
95 | - /** |
|
96 | - * Returns the collected logs |
|
97 | - * |
|
98 | - * @returns array |
|
99 | - */ |
|
100 | - public function getLogs() |
|
101 | - { |
|
102 | - return array( |
|
103 | - 'log' => $this->log, |
|
104 | - 'memory' => $this->memory, |
|
105 | - 'error' => $this->error, |
|
106 | - 'speed' => $this->speed |
|
107 | - ); |
|
108 | - } |
|
95 | + /** |
|
96 | + * Returns the collected logs |
|
97 | + * |
|
98 | + * @returns array |
|
99 | + */ |
|
100 | + public function getLogs() |
|
101 | + { |
|
102 | + return array( |
|
103 | + 'log' => $this->log, |
|
104 | + 'memory' => $this->memory, |
|
105 | + 'error' => $this->error, |
|
106 | + 'speed' => $this->speed |
|
107 | + ); |
|
108 | + } |
|
109 | 109 | } |