1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-14 01:54:08 +02:00

now compatible with Debug / NDebug / Nette\Debug

This commit is contained in:
David Grudl
2010-08-25 01:15:59 +02:00
parent 310d43f404
commit 46a3b8a42c
6 changed files with 125 additions and 164 deletions

View File

@@ -32,64 +32,45 @@ if (version_compare(PHP_VERSION, '5.2.0', '<')) {
/**
* Compatibility with Nette
*/
if (!class_exists('NotImplementedException', FALSE)) {
/** @package exceptions */
if (interface_exists('Nette\\IDebugPanel', FALSE)) {
class_alias('Nette\\IDebugPanel', 'IDebugPanel');
} elseif (!interface_exists('IDebugPanel', FALSE)) {
interface IDebugPanel {}
}
if (!defined('NETTE')) {
/**#@+ @package exceptions */
class NotImplementedException extends LogicException {}
}
if (!class_exists('NotSupportedException', FALSE)) {
/** @package exceptions */
class NotSupportedException extends LogicException {}
}
if (!class_exists('MemberAccessException', FALSE)) {
/** @package exceptions */
class MemberAccessException extends LogicException {}
}
if (!class_exists('InvalidStateException', FALSE)) {
/** @package exceptions */
class InvalidStateException extends RuntimeException {}
}
if (!class_exists('IOException', FALSE)) {
/** @package exceptions */
class IOException extends RuntimeException {}
}
if (!class_exists('FileNotFoundException', FALSE)) {
/** @package exceptions */
class FileNotFoundException extends IOException {}
}
/**#@-*/
if (!class_exists('PcreException', FALSE)) {
/** @package exceptions */
class PcreException extends Exception {
public function __construct()
{
static $messages = array(
PREG_INTERNAL_ERROR => 'Internal error.',
PREG_BACKTRACK_LIMIT_ERROR => 'Backtrack limit was exhausted.',
PREG_RECURSION_LIMIT_ERROR => 'Recursion limit was exhausted.',
PREG_BAD_UTF8_ERROR => 'Malformed UTF-8 data.',
5 => 'Offset didn\'t correspond to the begin of a valid UTF-8 code point.', // PREG_BAD_UTF8_OFFSET_ERROR
);
$code = preg_last_error();
parent::__construct(isset($messages[$code]) ? $messages[$code] : 'Unknown error.', $code);
}
}
}
if (!interface_exists(/*Nette\*/'IDebugPanel', FALSE)) {
require_once dirname(__FILE__) . '/Nette/IDebugPanel.php';
}
if (!class_exists('DateTime53', FALSE)) {
require_once dirname(__FILE__) . '/Nette/DateTime53.php';
}
/** @package exceptions */
class PcreException extends Exception {
public function __construct($message = '%msg.')
{
static $messages = array(
PREG_INTERNAL_ERROR => 'Internal error',
PREG_BACKTRACK_LIMIT_ERROR => 'Backtrack limit was exhausted',
PREG_RECURSION_LIMIT_ERROR => 'Recursion limit was exhausted',
PREG_BAD_UTF8_ERROR => 'Malformed UTF-8 data',
5 => 'Offset didn\'t correspond to the begin of a valid UTF-8 code point', // PREG_BAD_UTF8_OFFSET_ERROR
);
$code = preg_last_error();
parent::__construct(str_replace('%msg', isset($messages[$code]) ? $messages[$code] : 'Unknown error', $message), $code);
}
}
/**
* @deprecated