From 69ead6da5689bea88941bc65e9b50d12026abea6 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Sat, 12 Jul 2008 23:11:57 +0000 Subject: [PATCH] improved dibi, Texy and Nette exceptions compatibility --- dibi/Nette/IDebuggable.php | 5 ++ dibi/Nette/Object.php | 28 +++++----- dibi/Nette/exceptions.php | 110 ------------------------------------- dibi/dibi.php | 26 ++++++++- license.cs.txt | 60 ++++++++++---------- license.txt | 25 +++++---- 6 files changed, 87 insertions(+), 167 deletions(-) delete mode 100644 dibi/Nette/exceptions.php diff --git a/dibi/Nette/IDebuggable.php b/dibi/Nette/IDebuggable.php index 8931218a..d4f96da4 100644 --- a/dibi/Nette/IDebuggable.php +++ b/dibi/Nette/IDebuggable.php @@ -23,6 +23,11 @@ /** * Custom output for Nette::Debug. + * + * @author David Grudl + * @copyright Copyright (c) 2004, 2008 David Grudl + * @package Nette + * @version $Revision$ $Date$ */ interface IDebuggable { diff --git a/dibi/Nette/Object.php b/dibi/Nette/Object.php index 75b41f33..95203d40 100644 --- a/dibi/Nette/Object.php +++ b/dibi/Nette/Object.php @@ -98,12 +98,12 @@ abstract class Object */ protected function __call($name, $args) { - if ($name === '') { - throw new /*::*/MemberAccessException("Call to method without name."); - } - $class = get_class($this); + if ($name === '') { + throw new /*::*/MemberAccessException("Call to class '$class' method without name."); + } + // event functionality if (self::hasEvent($class, $name)) { $list = $this->$name; @@ -155,17 +155,18 @@ abstract class Object */ protected function &__get($name) { + $class = get_class($this); + if ($name === '') { - throw new /*::*/MemberAccessException("Cannot read an property without name."); + throw new /*::*/MemberAccessException("Cannot read an class '$class' property without name."); } // property getter support - $class = get_class($this); $m = 'get' . $name; if (self::hasAccessor($class, $m)) { // ampersands: - // - using &__get() because declaration should be forward compatible (e.g. with Nette::Web::Html) - // - not using &$this->$m because user could bypass property setter by: $x = & $obj->property; $x = 'new value'; + // - uses &__get() because declaration should be forward compatible (e.g. with Nette::Web::Html) + // - doesn't call &$this->$m because user could bypass property setter by: $x = & $obj->property; $x = 'new value'; $val = $this->$m(); return $val; @@ -179,19 +180,20 @@ abstract class Object /** * Sets value of a property. Do not call directly. * - * @param string property name - * @param mixed property value + * @param string property name + * @param mixed property value * @return void * @throws ::MemberAccessException if the property is not defined or is read-only */ protected function __set($name, $value) { + $class = get_class($this); + if ($name === '') { - throw new /*::*/MemberAccessException('Cannot assign to an property without name.'); + throw new /*::*/MemberAccessException("Cannot assign to an class '$class' property without name."); } // property setter support - $class = get_class($this); if (self::hasAccessor($class, 'get' . $name)) { $m = 'set' . $name; if (self::hasAccessor($class, $m)) { @@ -211,7 +213,7 @@ abstract class Object /** * Is property defined? * - * @param string property name + * @param string property name * @return bool */ protected function __isset($name) diff --git a/dibi/Nette/exceptions.php b/dibi/Nette/exceptions.php deleted file mode 100644 index 8f96c288..00000000 --- a/dibi/Nette/exceptions.php +++ /dev/null @@ -1,110 +0,0 @@ -