Ejemplo n.º 1
0
 /**
  * Search file for matching addon annotations and automaticly resolve and add them into their collections
  *
  * @param \Codex\Addons\Scanner\ClassFileInfo $file
  */
 public function resolveAndRegister(ClassFileInfo $file)
 {
     $class = $file->getClassName();
     if (array_key_exists($class, $this->registered)) {
         return;
     }
     $this->registered[$class] = $file;
     foreach ($file->getClassAnnotations() as $annotation) {
         if ($annotation instanceof Annotations\Processor) {
             $this->processors->add($file, $annotation);
         } elseif ($annotation instanceof Annotations\Hook) {
             $this->hooks->add($file, $annotation);
         } elseif ($annotation instanceof Annotations\Plugin) {
             $this->plugins->add($file, $annotation);
         }
     }
     foreach ($file->getMethodAnnotations(true) as $method => $annotations) {
         foreach ($annotations as $annotation) {
             if ($annotation instanceof Annotations\Hook) {
                 $this->hooks->add($file, $annotation, $method);
             }
         }
     }
     foreach ($file->getPropertyAnnotations(true) as $property => $annotations) {
         foreach ($annotations as $annotation) {
         }
     }
 }