Example #1
0
 public function getPlugins($type)
 {
     $plugins = array();
     $index = 0;
     foreach ($this->getMyPlugins($type) as $plugin) {
         list($name, $class) = $plugin;
         foreach ($class->getMethods($type) as $method) {
             $method = new Type($method->getOne($type), $name);
             $method->pos = ++$index;
             $this->addWeight($class, $method);
             $plugins[] = $method;
         }
     }
     usort($plugins, function ($a, $b) {
         return $b->pos - $a->pos;
     });
     return $plugins;
 }
Example #2
0
 public function getMethodsByAnnotation($ann)
 {
     if (!$this->isClass()) {
         throw new \RuntimeException("Invalid call, it is not a class");
     }
     $methods = array();
     foreach ($this->annotation->getMethods() as $method) {
         if ($method->has($ann)) {
             $method = new Type($method->getOne($ann), $ann);
             $method->setPath($this->getPath());
             $methods[] = $method;
         }
     }
     return $methods;
 }