/** * Registers the automatic joint points of a class * * This method will register a join point for each public member method of * the current class ending with the value of the JOINPOINT_METHOD_SUFFIX * constant. * * @return void * @see _registerJoinPoint */ private final function _registerAutomaticJoinPoints() { // Checks if the public methods have already been get for the current class if (!isset(self::$_publicMethods[$this->_className])) { // Storage array for the public methods self::$_publicMethods[$this->_className] = array(); // Creates the storage arrays for the join points self::$_joinPoints[$this->_className] = array(); self::$_joinPointsByName[$this->_className] = array(); // Process the user advice types foreach (self::$_userAdvices as $adviceType) { // Checks if the storage array exists (it could, if an advice was added before the creation of an instance of the current class) if (!isset(self::$_advices[$adviceType][$this->_className])) { // Creates the advice storage array for the current class self::$_advices[$adviceType][$this->_className] = array(); } } // Creates a reflection object for the current instance $reflection = Woops_Core_Reflection_Object::getInstance($this); // Gets all the public methods $methods = $reflection->getMethods(ReflectionMethod::IS_PUBLIC); // Process each method foreach ($methods as $method) { // Do not process static methods if ($method->isStatic()) { continue; } // Controls if the method name has the join point suffix if (substr($method->name, -strlen(self::JOINPOINT_METHOD_SUFFIX)) === self::JOINPOINT_METHOD_SUFFIX) { // Name of the join point $joinPointName = substr($method->name, 0, -strlen(self::JOINPOINT_METHOD_SUFFIX)); // Stores the name of the method self::$_publicMethods[$this->_className][$joinPointName] = $method->name; // Registers a join point for the current method $this->_registerJoinPoint($joinPointName, $method->name, self::ADVICE_TYPE_ALL); } } } else { // Process each public method to be defined as an automatic joint point foreach (self::$_publicMethods[$this->_className] as $joinPoint => $method) { // Registers a join point for the current method $this->_registerJoinPoint($joinPoint, $method, self::ADVICE_TYPE_ALL); } } }
/** * */ public static function getExceptionString($class, $code = 0) { if (is_object($class)) { $code = $class->getCode(); $reflector = Woops_Core_Reflection_Object::getInstance($class); } else { $reflector = Woops_Core_Reflection_Class::getInstance($class); } $constants = array_flip($reflector->getConstants()); return isset($constants[$code]) ? $constants[$code] : ''; }