@@ -15,88 +15,88 @@ |
||
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 = 'PHP') |
|
43 | - { |
|
44 | - $memory = memory_get_usage(); |
|
45 | - $dataType = ''; |
|
46 | - if (!is_null($object)) { |
|
47 | - $memory = strlen(serialize($object)); |
|
48 | - $dataType = gettype($object); |
|
49 | - } |
|
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 = 'PHP') |
|
43 | + { |
|
44 | + $memory = memory_get_usage(); |
|
45 | + $dataType = ''; |
|
46 | + if (!is_null($object)) { |
|
47 | + $memory = strlen(serialize($object)); |
|
48 | + $dataType = gettype($object); |
|
49 | + } |
|
50 | 50 | |
51 | - array_push($this->store, array( |
|
52 | - 'name' => $name, |
|
53 | - 'data' => $memory, |
|
54 | - 'data_type' => $dataType, |
|
55 | - 'type' => 'memory' |
|
56 | - )); |
|
57 | - } |
|
51 | + array_push($this->store, array( |
|
52 | + 'name' => $name, |
|
53 | + 'data' => $memory, |
|
54 | + 'data_type' => $dataType, |
|
55 | + 'type' => 'memory' |
|
56 | + )); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * Logs exception with optional message override |
|
61 | - * |
|
62 | - * @param Exception $exception |
|
63 | - * @param string $message |
|
64 | - */ |
|
65 | - public function logError(Exception $exception, $message = '') |
|
66 | - { |
|
67 | - if (empty($message)) { |
|
68 | - $message = $exception->getMessage(); |
|
69 | - } |
|
59 | + /** |
|
60 | + * Logs exception with optional message override |
|
61 | + * |
|
62 | + * @param Exception $exception |
|
63 | + * @param string $message |
|
64 | + */ |
|
65 | + public function logError(Exception $exception, $message = '') |
|
66 | + { |
|
67 | + if (empty($message)) { |
|
68 | + $message = $exception->getMessage(); |
|
69 | + } |
|
70 | 70 | |
71 | - array_push($this->store, array( |
|
72 | - 'data' => $message, |
|
73 | - 'file' => $exception->getFile(), |
|
74 | - 'line' => $exception->getLine(), |
|
75 | - 'type' => 'error' |
|
76 | - )); |
|
77 | - } |
|
71 | + array_push($this->store, array( |
|
72 | + 'data' => $message, |
|
73 | + 'file' => $exception->getFile(), |
|
74 | + 'line' => $exception->getLine(), |
|
75 | + 'type' => 'error' |
|
76 | + )); |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * Logs current time with optional message |
|
81 | - * |
|
82 | - * @param string $name |
|
83 | - */ |
|
84 | - public function logSpeed($name = 'Point in Time') |
|
85 | - { |
|
86 | - array_push($this->store, array( |
|
87 | - 'data' => microtime(true), |
|
88 | - 'name' => $name, |
|
89 | - 'type' => 'speed' |
|
90 | - )); |
|
91 | - } |
|
79 | + /** |
|
80 | + * Logs current time with optional message |
|
81 | + * |
|
82 | + * @param string $name |
|
83 | + */ |
|
84 | + public function logSpeed($name = 'Point in Time') |
|
85 | + { |
|
86 | + array_push($this->store, array( |
|
87 | + 'data' => microtime(true), |
|
88 | + 'name' => $name, |
|
89 | + 'type' => 'speed' |
|
90 | + )); |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * Returns the collected logs |
|
95 | - * |
|
96 | - * @returns array |
|
97 | - */ |
|
98 | - public function getLogs() |
|
99 | - { |
|
100 | - return $this->store; |
|
101 | - } |
|
93 | + /** |
|
94 | + * Returns the collected logs |
|
95 | + * |
|
96 | + * @returns array |
|
97 | + */ |
|
98 | + public function getLogs() |
|
99 | + { |
|
100 | + return $this->store; |
|
101 | + } |
|
102 | 102 | } |