-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCodeErrorHandler.php
More file actions
36 lines (30 loc) · 967 Bytes
/
CodeErrorHandler.php
File metadata and controls
36 lines (30 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace BitSensor\Handler;
use BitSensor\Core\BitSensor;
use Proto\Error;
/**
* Handler to run when an error in the application occurs. Collects data about.
*
* @package BitSensor\Handler
*/
class CodeErrorHandler
{
/**
* @param int $errno Error code.
* @param string $errstr Error description.
* @param string $errfile Name of the file in which the error occurred.
* @param int $errline Line at which the error occurred.
*/
public static function handle($errno, $errstr, $errfile, $errline, $errcontext)
{
$error = new Error();
$error->setCode($errno);
$error->setDescription($errstr);
$error->setLocation($errfile);
$error->setLine($errline);
$error->setType("Code");
BitSensor::addError($error);
if (isset(BitSensor::$errorHandler))
call_user_func(BitSensor::$errorHandler, $errno, $errstr, $errfile, $errline, $errcontext);
}
}