@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | /** |
38 | 38 | * Read JSON config file and return array |
39 | 39 | * |
40 | - * @param string $file |
|
40 | + * @param string $filename |
|
41 | 41 | * @return array $config |
42 | 42 | */ |
43 | 43 | public static function getConfigFile($filename) |
@@ -60,6 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Get configuration |
63 | + * @param string $context |
|
63 | 64 | */ |
64 | 65 | public static function getConfig($name = 'application', $context = null) |
65 | 66 | { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param string $level |
57 | 57 | * @param string or an object with a __toString() method$ message |
58 | 58 | * @param array $context |
59 | - * @return bool |
|
59 | + * @return integer|null |
|
60 | 60 | */ |
61 | 61 | public function log($level, $message, array $context = array()) |
62 | 62 | { |
@@ -100,7 +100,8 @@ discard block |
||
100 | 100 | * @param string $level |
101 | 101 | * @param string or an object with a __toString() method$ message |
102 | 102 | * @param array $context |
103 | - * @return bool |
|
103 | + * @param string $message |
|
104 | + * @return integer |
|
104 | 105 | */ |
105 | 106 | public function addRecord($level, $message, array $context = array()) |
106 | 107 | { |
@@ -118,7 +119,7 @@ discard block |
||
118 | 119 | * |
119 | 120 | * @param string $message or an object with a __toString() method |
120 | 121 | * @param array $context replacement values for placeholders |
121 | - * @return bool |
|
122 | + * @return string |
|
122 | 123 | */ |
123 | 124 | function interpolate($message, array $context = array()) |
124 | 125 | { |
@@ -142,7 +143,7 @@ discard block |
||
142 | 143 | * |
143 | 144 | * @param mixed $key |
144 | 145 | * @param string $logFileName |
145 | - * @return bool |
|
146 | + * @return string |
|
146 | 147 | */ |
147 | 148 | public function addLogFile($key, $logFileName) |
148 | 149 | { |
@@ -198,7 +199,7 @@ discard block |
||
198 | 199 | * @param string $message |
199 | 200 | * @param array $context |
200 | 201 | * |
201 | - * @return null |
|
202 | + * @return integer |
|
202 | 203 | */ |
203 | 204 | public function emergency($message, array $context = array()) |
204 | 205 | { |
@@ -215,7 +216,7 @@ discard block |
||
215 | 216 | * @param string $message |
216 | 217 | * @param array $context |
217 | 218 | * |
218 | - * @return null |
|
219 | + * @return integer |
|
219 | 220 | */ |
220 | 221 | public function alert($message, array $context = array()) |
221 | 222 | { |
@@ -231,7 +232,7 @@ discard block |
||
231 | 232 | * @param string $message |
232 | 233 | * @param array $context |
233 | 234 | * |
234 | - * @return null |
|
235 | + * @return integer |
|
235 | 236 | */ |
236 | 237 | public function critical($message, array $context = array()) |
237 | 238 | { |
@@ -246,7 +247,7 @@ discard block |
||
246 | 247 | * @param string $message |
247 | 248 | * @param array $context |
248 | 249 | * |
249 | - * @return null |
|
250 | + * @return integer |
|
250 | 251 | */ |
251 | 252 | public function error($message, array $context = array()) |
252 | 253 | { |
@@ -263,7 +264,7 @@ discard block |
||
263 | 264 | * @param string $message |
264 | 265 | * @param array $context |
265 | 266 | * |
266 | - * @return null |
|
267 | + * @return integer |
|
267 | 268 | */ |
268 | 269 | public function warning($message, array $context = array()) |
269 | 270 | { |
@@ -277,7 +278,7 @@ discard block |
||
277 | 278 | * @param string $message |
278 | 279 | * @param array $context |
279 | 280 | * |
280 | - * @return null |
|
281 | + * @return integer |
|
281 | 282 | */ |
282 | 283 | public function notice($message, array $context = array()) |
283 | 284 | { |
@@ -293,7 +294,7 @@ discard block |
||
293 | 294 | * @param string $message |
294 | 295 | * @param array $context |
295 | 296 | * |
296 | - * @return null |
|
297 | + * @return integer |
|
297 | 298 | */ |
298 | 299 | public function info($message, array $context = array()) |
299 | 300 | { |
@@ -307,7 +308,7 @@ discard block |
||
307 | 308 | * @param string $message |
308 | 309 | * @param array $context |
309 | 310 | * |
310 | - * @return null |
|
311 | + * @return integer |
|
311 | 312 | */ |
312 | 313 | public function debug($message, array $context = array()) |
313 | 314 | { |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * @param string $name |
207 | 207 | * @param string $cssFile URL of injected css file |
208 | 208 | * @param int $order |
209 | - * @param boolean $active defaults to 1 |
|
209 | + * @param integer $active defaults to 1 |
|
210 | 210 | * @todo need to resolve order of merging and/or eliminate/refactor this function |
211 | 211 | */ |
212 | 212 | public function addCss($name, $cssFile, $order = 10, $active = 1) |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * @param string $name |
240 | 240 | * @param string $jsFile URL of js file |
241 | 241 | * @param int $order |
242 | - * @param boolean $active defaults to 1 |
|
242 | + * @param integer $active defaults to 1 |
|
243 | 243 | * @todo same issue as addCss |
244 | 244 | */ |
245 | 245 | public function addJs($name, $jsFile, $order = 10, $active = 1) |
@@ -254,7 +254,6 @@ discard block |
||
254 | 254 | /** |
255 | 255 | * Get Theme Root Folder |
256 | 256 | * |
257 | - * @param string $folder |
|
258 | 257 | */ |
259 | 258 | public function getThemeRootFolder() |
260 | 259 | { |
@@ -295,7 +294,7 @@ discard block |
||
295 | 294 | /** |
296 | 295 | * Set content |
297 | 296 | * |
298 | - * @param string|Container $content any string or object that implements __toString() |
|
297 | + * @param string $content any string or object that implements __toString() |
|
299 | 298 | */ |
300 | 299 | public function setContent($content) |
301 | 300 | { |
@@ -13,70 +13,70 @@ |
||
13 | 13 | |
14 | 14 | class ErrorHandler |
15 | 15 | { |
16 | - public static function init() |
|
17 | - { |
|
18 | - ini_set('html_errors',0); // @todo review this line |
|
19 | - // error_reporting((E_ALL | E_STRICT)); // @note we shouldn't override by default, but we could inject |
|
20 | - set_error_handler("\\erdiko\\core\\ErrorHandler::errorHandler"); |
|
21 | - register_shutdown_function("\\erdiko\\core\\ErrorHandler::fatalErrorShutdownHandler"); |
|
22 | - } |
|
16 | + public static function init() |
|
17 | + { |
|
18 | + ini_set('html_errors',0); // @todo review this line |
|
19 | + // error_reporting((E_ALL | E_STRICT)); // @note we shouldn't override by default, but we could inject |
|
20 | + set_error_handler("\\erdiko\\core\\ErrorHandler::errorHandler"); |
|
21 | + register_shutdown_function("\\erdiko\\core\\ErrorHandler::fatalErrorShutdownHandler"); |
|
22 | + } |
|
23 | 23 | |
24 | - public static function errorHandler($errno, $errstr, $errfile, $errline) |
|
25 | - { |
|
26 | - $debug = \erdiko\core\ErrorHandler::isDebug(); |
|
27 | - if ( ! ( error_reporting() & $errno ) || empty( $errstr ) ) { |
|
28 | - return null; |
|
29 | - } |
|
24 | + public static function errorHandler($errno, $errstr, $errfile, $errline) |
|
25 | + { |
|
26 | + $debug = \erdiko\core\ErrorHandler::isDebug(); |
|
27 | + if ( ! ( error_reporting() & $errno ) || empty( $errstr ) ) { |
|
28 | + return null; |
|
29 | + } |
|
30 | 30 | |
31 | - switch ( $errno ) { |
|
32 | - case E_USER_ERROR: |
|
33 | - $vars['msg_type'] = "USER ERROR"; |
|
34 | - $vars['msg_description'] = " Fatal error in line $errline of $errfile file"; |
|
35 | - $vars['msg_description'] .= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")"; |
|
36 | - break; |
|
31 | + switch ( $errno ) { |
|
32 | + case E_USER_ERROR: |
|
33 | + $vars['msg_type'] = "USER ERROR"; |
|
34 | + $vars['msg_description'] = " Fatal error in line $errline of $errfile file"; |
|
35 | + $vars['msg_description'] .= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")"; |
|
36 | + break; |
|
37 | 37 | |
38 | - case E_USER_WARNING: |
|
39 | - $vars['msg_type'] = "USER WARNING"; |
|
40 | - break; |
|
38 | + case E_USER_WARNING: |
|
39 | + $vars['msg_type'] = "USER WARNING"; |
|
40 | + break; |
|
41 | 41 | |
42 | - case E_USER_NOTICE: |
|
43 | - $vars['msg_type'] = "USER NOTICE"; |
|
44 | - break; |
|
42 | + case E_USER_NOTICE: |
|
43 | + $vars['msg_type'] = "USER NOTICE"; |
|
44 | + break; |
|
45 | 45 | |
46 | - case E_ERROR: |
|
47 | - $vars['msg_type'] = "ERROR"; |
|
48 | - $vars['msg_description'] = print_r(debug_backtrace(),1); |
|
49 | - break; |
|
46 | + case E_ERROR: |
|
47 | + $vars['msg_type'] = "ERROR"; |
|
48 | + $vars['msg_description'] = print_r(debug_backtrace(),1); |
|
49 | + break; |
|
50 | 50 | |
51 | - default: |
|
52 | - $vars['msg_type'] = "Type of error: [$errno] $errstr"; |
|
53 | - $vars['msg_description'] = print_r(debug_backtrace(),1); |
|
54 | - break; |
|
55 | - } |
|
51 | + default: |
|
52 | + $vars['msg_type'] = "Type of error: [$errno] $errstr"; |
|
53 | + $vars['msg_description'] = print_r(debug_backtrace(),1); |
|
54 | + break; |
|
55 | + } |
|
56 | 56 | |
57 | - $vars['code'] = $errno; |
|
58 | - $vars['error'] = trim($errstr); |
|
59 | - $vars['path_info'] = $errfile . " on line " . $errline; |
|
60 | - $vars['debug'] = $debug; |
|
61 | - ToroHook::fire( "general_error", $vars ); |
|
57 | + $vars['code'] = $errno; |
|
58 | + $vars['error'] = trim($errstr); |
|
59 | + $vars['path_info'] = $errfile . " on line " . $errline; |
|
60 | + $vars['debug'] = $debug; |
|
61 | + ToroHook::fire( "general_error", $vars ); |
|
62 | 62 | |
63 | - return false; |
|
64 | - } |
|
63 | + return false; |
|
64 | + } |
|
65 | 65 | |
66 | - public static function fatalErrorShutdownHandler() |
|
67 | - { |
|
68 | - $last_error = error_get_last(); |
|
69 | - self::errorHandler(E_ERROR, |
|
70 | - $last_error['message'], $last_error['file'], $last_error['line']); |
|
71 | - } |
|
66 | + public static function fatalErrorShutdownHandler() |
|
67 | + { |
|
68 | + $last_error = error_get_last(); |
|
69 | + self::errorHandler(E_ERROR, |
|
70 | + $last_error['message'], $last_error['file'], $last_error['line']); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * isDebug |
|
75 | - * |
|
76 | - * @return bool |
|
77 | - */ |
|
78 | - public static function isDebug() |
|
79 | - { |
|
80 | - return (getenv("ERDIKO_DEBUG")=='1'); |
|
81 | - } |
|
73 | + /** |
|
74 | + * isDebug |
|
75 | + * |
|
76 | + * @return bool |
|
77 | + */ |
|
78 | + public static function isDebug() |
|
79 | + { |
|
80 | + return (getenv("ERDIKO_DEBUG")=='1'); |
|
81 | + } |
|
82 | 82 | } |
83 | 83 | \ No newline at end of file |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | { |
16 | 16 | public static function init() |
17 | 17 | { |
18 | - ini_set('html_errors',0); // @todo review this line |
|
18 | + ini_set('html_errors', 0); // @todo review this line |
|
19 | 19 | // error_reporting((E_ALL | E_STRICT)); // @note we shouldn't override by default, but we could inject |
20 | 20 | set_error_handler("\\erdiko\\core\\ErrorHandler::errorHandler"); |
21 | 21 | register_shutdown_function("\\erdiko\\core\\ErrorHandler::fatalErrorShutdownHandler"); |
@@ -24,15 +24,15 @@ discard block |
||
24 | 24 | public static function errorHandler($errno, $errstr, $errfile, $errline) |
25 | 25 | { |
26 | 26 | $debug = \erdiko\core\ErrorHandler::isDebug(); |
27 | - if ( ! ( error_reporting() & $errno ) || empty( $errstr ) ) { |
|
27 | + if (!(error_reporting() & $errno) || empty($errstr)) { |
|
28 | 28 | return null; |
29 | 29 | } |
30 | 30 | |
31 | - switch ( $errno ) { |
|
31 | + switch ($errno) { |
|
32 | 32 | case E_USER_ERROR: |
33 | 33 | $vars['msg_type'] = "USER ERROR"; |
34 | 34 | $vars['msg_description'] = " Fatal error in line $errline of $errfile file"; |
35 | - $vars['msg_description'] .= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")"; |
|
35 | + $vars['msg_description'] .= ", PHP ".PHP_VERSION." (".PHP_OS.")"; |
|
36 | 36 | break; |
37 | 37 | |
38 | 38 | case E_USER_WARNING: |
@@ -45,20 +45,20 @@ discard block |
||
45 | 45 | |
46 | 46 | case E_ERROR: |
47 | 47 | $vars['msg_type'] = "ERROR"; |
48 | - $vars['msg_description'] = print_r(debug_backtrace(),1); |
|
48 | + $vars['msg_description'] = print_r(debug_backtrace(), 1); |
|
49 | 49 | break; |
50 | 50 | |
51 | 51 | default: |
52 | 52 | $vars['msg_type'] = "Type of error: [$errno] $errstr"; |
53 | - $vars['msg_description'] = print_r(debug_backtrace(),1); |
|
53 | + $vars['msg_description'] = print_r(debug_backtrace(), 1); |
|
54 | 54 | break; |
55 | 55 | } |
56 | 56 | |
57 | 57 | $vars['code'] = $errno; |
58 | 58 | $vars['error'] = trim($errstr); |
59 | - $vars['path_info'] = $errfile . " on line " . $errline; |
|
59 | + $vars['path_info'] = $errfile." on line ".$errline; |
|
60 | 60 | $vars['debug'] = $debug; |
61 | - ToroHook::fire( "general_error", $vars ); |
|
61 | + ToroHook::fire("general_error", $vars); |
|
62 | 62 | |
63 | 63 | return false; |
64 | 64 | } |
@@ -77,6 +77,6 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public static function isDebug() |
79 | 79 | { |
80 | - return (getenv("ERDIKO_DEBUG")=='1'); |
|
80 | + return (getenv("ERDIKO_DEBUG") == '1'); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | \ No newline at end of file |