Exemplo n.º 1
0
 /**
  * Adds a custom method to the RaxanElement Class. Use addMethod($object) to add multiple methods from an object
  */
 public static function addMethod($name, $callback = null)
 {
     if (!self::$callMethods) {
         self::$callMethods = array();
     }
     if ($callback === null && is_object($name)) {
         // add methods from an object
         $obj = $name;
         $names = get_class_methods($obj);
         foreach ($names as $name) {
             if ($name[0] != '_') {
                 self::$callMethods[$name] = array($obj, $name);
             }
         }
         // don't add names that begins with '_'
     } else {
         if (!is_callable($callback)) {
             Raxan::throwCallbackException($callback);
         }
         self::$callMethods[$name] = $callback;
     }
 }