1 | <?php |
||
13 | class Recorder extends Component { |
||
14 | |||
15 | /** |
||
16 | * @var mixed |
||
17 | */ |
||
18 | protected $config = []; |
||
19 | |||
20 | /** |
||
21 | * The constructor |
||
22 | */ |
||
23 | 42 | public function __construct() { |
|
26 | |||
27 | /** |
||
28 | * Records an Exception to the database |
||
29 | * @param Exception $e The exception you want to record |
||
30 | * @return false|ExceptionModel |
||
31 | * @throws RecorderFailedException |
||
32 | 12 | */ |
|
33 | public function record(Exception $e) |
||
64 | |||
65 | /** |
||
66 | * Checks the config to see if you can collect certain information |
||
67 | * @param string $type the config value you want to check |
||
68 | * @return boolean |
||
69 | 9 | */ |
|
70 | 9 | private function canCollect($type) { |
|
76 | |||
77 | /** |
||
78 | * @param string $key |
||
79 | 3 | * @param Exception $e |
|
80 | * @return array|int|null|string |
||
81 | 3 | * @throws Exception |
|
82 | 3 | */ |
|
83 | 3 | protected function collect($key, Exception $e = null) { |
|
102 | |||
103 | 3 | /** |
|
104 | 3 | * Gets the ID of the User that is logged in |
|
105 | 3 | * @return integer|null The ID of the User or Null if not logged in |
|
106 | */ |
||
107 | protected function getUserId() { |
||
115 | |||
116 | 3 | /** |
|
117 | 3 | * Gets the Method of the Request |
|
118 | 3 | * @return string|null Possible values are null or GET, POST, DELETE, PUT, etc... |
|
119 | 3 | */ |
|
120 | protected function getMethod() { |
||
128 | |||
129 | 3 | /** |
|
130 | 3 | * Gets the input data of the Request |
|
131 | 3 | * @return array|null The Input data or null |
|
132 | 3 | */ |
|
133 | 3 | protected function getData() { |
|
142 | |||
143 | 3 | /** |
|
144 | 3 | * Gets the URL of the Request |
|
145 | 3 | * @return string|null Returns a URL string or null |
|
146 | 3 | */ |
|
147 | protected function getUrl() { |
||
155 | |||
156 | /** |
||
157 | 3 | * Gets the status code of the Exception |
|
158 | 3 | * @param Exception $e The Exception to check |
|
159 | * @return string|integer The status code value |
||
160 | */ |
||
161 | 3 | protected function getStatusCode(Exception $e) { |
|
168 | |||
169 | /** |
||
170 | 9 | * This function will remove all keys from an array recursively as defined in the config file |
|
171 | 9 | * @param array $data The array to remove keys from |
|
172 | 9 | * @return void |
|
173 | 6 | */ |
|
174 | 6 | protected function excludeKeys(array $data) { |
|
186 | } |
||
187 |