Example #1
0
 public static function binds($class, $name)
 {
     static $cache;
     if (isset($cache["{$class}-{$name}"])) {
         return $cache["{$class}-{$name}"];
     }
     $binds = [];
     foreach (class_real_uses($class) as $trait) {
         if (isset(self::$binds[$trait][$name])) {
             $binds[] = self::$binds[$trait][$name];
         }
     }
     return $cache["{$class}-{$name}"] = $binds;
 }
Example #2
0
 protected static function allschema()
 {
     $schema = [];
     foreach (class_real_uses(get_called_class()) as $trait) {
         if (!function_exists($func = "{$trait}__schema")) {
             continue;
         }
         $schema[] = $func();
     }
     foreach (get_parent_classes(get_called_class()) as $class) {
         $schema[] = $class::schema();
     }
     $schema[] = static::schema();
     return array_merge(...$schema);
 }