Example #1
0
 /**
  * @param $value string
  * @param $class Reflection_Class
  */
 public function __construct($value, Reflection_Class $class)
 {
     parent::__construct($value);
     if (!$this->value) {
         $class_name = $class->getName();
         $this->value = Set::defaultSetClassNameOf($class_name);
     }
 }
Example #2
0
 /**
  * Builds representative annotation content
  *
  * Default representative is the list of non-static properties of the class
  *
  * @param $value string
  * @param $class Reflection_Class
  */
 public function __construct($value, Reflection_Class $class)
 {
     parent::__construct($value);
     // default sort : all representative values but links
     if (!$this->value) {
         $representative = (new Representative_Annotation($value, $class))->value;
         foreach ($class->getProperties([T_EXTENDS, T_USE]) as $property) {
             if (in_array($property->getName(), $representative)) {
                 if (!$property->isStatic() && !$property->getAnnotation('link')->value) {
                     $this->value[] = $property->getName();
                 }
             }
         }
     }
 }
 /**
  * @return Reflection_Property[]
  */
 public function getProperties()
 {
     if (!isset($this->properties)) {
         $this->properties = [];
         $properties = $this->class->getProperties([T_EXTENDS, T_USE]);
         foreach ($this->values() as $property_path) {
             $each = explode(DOT, $property_path);
             $property = $properties[array_shift($each)];
             foreach ($each as $property_name) {
                 /** @noinspection PhpUndefinedMethodInspection Inspector bug */
                 $property = $property->getType()->asReflectionClass(get_class($this->class))->getProperties([T_EXTENDS, T_USE])[$property_name];
             }
             $this->properties[$property_path] = $property;
         }
     }
     return $this->properties;
 }
Example #4
0
 /**
  * Get link properties names list
  *
  * @return Reflection_Property[] The key contains the name of the property
  */
 public function getLinkProperties()
 {
     if (!is_array($this->link_properties)) {
         $temp = $this->link_properties;
         $this->link_properties = [];
         if (is_string($temp)) {
             // if properties names are told, this will be faster to get their names here
             $properties = $this->class->getProperties([T_EXTENDS, T_USE]);
             foreach (explode(SP, $temp) as $property_name) {
                 if ($property_name) {
                     $this->link_properties[$property_name] = $properties[$property_name];
                 }
             }
         } elseif ($this->class) {
             // if properties names are not set : get explicit composite properties names
             foreach ($this->class->getProperties([T_EXTENDS, T_USE]) as $property) {
                 if ($property->getAnnotation('composite')->value) {
                     $this->link_properties[$property->getName()] = $property;
                 }
             }
         }
     }
     return $this->link_properties;
 }