Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
<?php
namespace components\debug {
function init_error_handling() {
if (\components\configuration\ConfigurationFactory::getInstance()->get('debugger', 0) !== 0) {
set_error_handler('\components\debug\error_handler');
}
}
function error_handler($errno, $errstr, $errfile, $errline) {
Debug::addError(new Error($errno, $errstr, $errfile, $errline));
}
abstract class Debug {
private static $errors = array();
public static function addError($error) {
if ($error instanceof Error) {
self::$errors[] = $error;
}
}
public static function hasErrors() {
return !empty(self::$errors);
}
public static function getErrors() {
return self::$errors;
}
}
class Error {
private $number = 0;
private $string = '';
private $file = '';
private $line = 0;
public function __construct($errno, $errstr, $errfile, $errline) {
$this->number = $errno;
$this->string = $errstr;
$this->file = $errfile;
$this->line = $errline;
}
public function getNumber() {
return $this->number;
}
public function getString() {
return $this->string;
}
public function getFile() {
return $this->file;
}
public function getLine() {
return $this->line;
}
}
}