Пример #1
0
 /**
  * Copies methods from one prototype to another
  * @param mixed $class
  * @param mixed $target
  */
 public static function addExtension($class, $target)
 {
     if (is_object($class)) {
         $class = get_class($class);
     }
     if (is_object($target)) {
         $target = get_class($target);
     }
     $target = strtolower($target);
     $class = strtolower($class);
     if (!Extension::extending($class, $target)) {
         Extension::addExtension($class, $target);
     } else {
         if (!array_key_exists($target, self::$methods)) {
             self::$methods[$target] = [];
         }
         $functions = self::getPrototypes($target);
         if (array_key_exists($class, self::$methods)) {
             self::$methods[$class] = array_merge(self::$methods[$class], $functions);
         } else {
             self::$methods[$class] = $functions;
         }
     }
 }