예제 #1
0
 public function instantiateAnnotation($class, $parameters, $targetReflection = false)
 {
     $class = Addendum::resolveClassName($class);
     // FIXME
     if (class_exists($class) && is_subclass_of($class, 'Addendum\\Annotation') && !Addendum::ignores($class) || $class === 'Addendum\\Annotation') {
         $annotationReflection = new \ReflectionClass($class);
         return $annotationReflection->newInstance($parameters, $targetReflection);
     }
     return false;
 }
 public function getAllAnnotations($restriction = false)
 {
     $restriction = Addendum::resolveClassName($restriction);
     $result = array();
     foreach ($this->annotations as $class => $instances) {
         if (!$restriction || $restriction == $class) {
             $result = array_merge($result, $instances);
         }
     }
     return $result;
 }
 public function testClassResolverShouldTriggerErrorOnCommonSuffix()
 {
     $this->expectError("Cannot resolve class name for 'CommonSuffix'. Possible matches: Namespace1_CommonSuffix, Namespace2_CommonSuffix");
     Addendum::resolveClassName('CommonSuffix');
 }
예제 #4
0
 public function instantiateAnnotation($class, $parameters, $targetReflection = FALSE)
 {
     $class = Addendum::resolveClassName($class);
     if (is_subclass_of($class, 'Annotation') && !Addendum::ignores($class) || $class == 'Annotation') {
         $annotationReflection = new ReflectionClass($class);
         return $annotationReflection->newInstance($parameters, $targetReflection);
     }
     return FALSE;
 }