コード例 #1
0
ファイル: Set_Annotation.php プロジェクト: TuxBoy/Demo-saf
 /**
  * @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);
     }
 }
コード例 #2
0
ファイル: Sort_Annotation.php プロジェクト: TuxBoy/Demo-saf
 /**
  * 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();
                 }
             }
         }
     }
 }
コード例 #3
0
 /**
  * @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;
 }
コード例 #4
0
ファイル: Link_Annotation.php プロジェクト: TuxBoy/Demo-saf
 /**
  * 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;
 }