Exemplo n.º 1
0
 /**
  * Parse class and returns names and target classes of annotated properties
  * @param $className
  * @return mixed
  * @throws RestException
  */
 public function getAnnotatedProperties($className)
 {
     if (!isset($this->classProperties[$className])) {
         $this->classProperties[$className] = array();
         $ref = new ClassType($className);
         if ($ref->isAbstract() or $ref->isInterface()) {
             throw new RestException("Class can not be either abstract nor interface");
         }
         $ann = $ref->getAnnotations();
         $parents = class_parents($className);
         $parents[$className] = $className;
         if ($className != DataHash::class and (!$parents or !in_array(DataHash::class, $parents))) {
             throw RestException::notInheritedForm($className, DataHash::class);
         }
         $this->parseProperties($ref, $ann, 'property');
         $this->parseProperties($ref, $ann, 'property-read');
     }
     return $this->classProperties[$className];
 }