コード例 #1
0
 /**
  * Default value is 'full' when no value is given
  *
  * Can be empty (eq full) contain 'full', 'simple', 'block' (implicitly 'simple')
  *
  * @param $value string
  * @see List_Annotation::__construct()
  */
 public function __construct($value)
 {
     if (isset($value) && empty($value)) {
         $value = 'full';
     }
     parent::__construct($value);
     if ($this->value && !parent::has('simple') && (parent::has('block') || parent::has('alias'))) {
         $this->value[] = 'simple';
     }
 }
コード例 #2
0
ファイル: Group_Annotation.php プロジェクト: TuxBoy/Demo-saf
 /**
  * @param $value string
  */
 public function __construct($value)
 {
     $i = strpos($value, ',');
     if ($i === false) {
         $i = strlen($value);
     }
     $i = strrpos(substr($value, 0, $i), SP);
     if ($i === false) {
         $i = strlen($value);
     }
     $this->name = substr($value, 0, $i);
     parent::__construct(substr($value, $i + 1));
 }
コード例 #3
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, $class);
     $this->class = $class;
     if (!$this->value) {
         $this->properties = [];
         foreach ($class->getProperties([T_EXTENDS, T_USE]) as $property) {
             if (!$property->isStatic() && !$property->getType()->isMultiple()) {
                 $this->properties[$property->getName()] = $property;
                 $this->value[] = $property->getName();
             }
         }
     }
 }
コード例 #4
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();
                 }
             }
         }
     }
 }
コード例 #5
0
ファイル: Values_Annotation.php プロジェクト: TuxBoy/Demo-saf
 /**
  * @param $value               string
  * @param $reflection_property Reflection_Property
  */
 public function __construct($value, Reflection_Property $reflection_property)
 {
     parent::__construct($value);
     if (isset($value)) {
         $type = $reflection_property->getType();
         switch ($type->getElementTypeAsString()) {
             case Type::FLOAT:
                 $function = 'floatval';
                 break;
             case Type::INTEGER:
                 $function = 'intval';
                 break;
             default:
                 $function = 'strval';
         }
         foreach ($this->values() as $key => $value) {
             $this->value[$key] = $function($value);
         }
     }
 }