public static function setCallback($callback) { self::$callback = $callback; }
public function __construct($message, $code = null) { parent::__construct($message, array("code" => $code)); }
/** * method: addMixin * * todo: write documentation * * notes: * - There is a potential !!GOTCHA!! here, if you mixin one object into another, * then that object into another, the second mixin only searches for native * methods in the first object, it won't see the mixed in methods from the original object * e.g: object2::mixin(object1::mixin(object0))), * object2 can only call native methods on object1, object0's methods are invisible * - TODO: implement reject+accept, now its just the bare idea */ public function addMixin($object, $reject = array(), $accept = array()) { if (!is_array($reject)) { $reject = array(); } if (!is_array($accept)) { $accept = array(); } // FIXME: this has never happened, but if "object" is not an instance, then does that mean it'll // all it's functions statically??? that could mean don't work like expected...... if (is_object($object) || class_exists($object)) { $reject = array_merge($reject, get_class_methods("Amslib_Mixin"), array("__construct", "getInstance")); $mixin = method_exists($object, "getMixin") ? $object->getMixin() : array(); $list = array_merge(get_class_methods($object), $mixin); foreach ($list as $m) { // Block some requested methods and then some obvious methods from being added to the mixin if (!empty($reject) && in_array($m, $reject)) { continue; } $this->mixin[$m] = $object; } } else { $name = $object; if (is_string($object)) { $name = $object; } if (is_object($object)) { $name = get_class($object); } $e = new Amslib_Exception("Mixin Failure: Object was not valid"); $e->setData("object", $object); throw $e; } return $object; }
public function setExceptionCallback($callback) { Amslib_Exception::setCallback($callback); }