setProperty() public méthode

public setProperty ( string $name, PropertyMetadata $property )
$name string
$property PropertyMetadata
 protected function parseAnnotationValue($name, array $types, $access, $params)
 {
     $property = new PropertyMetadata($name, $types, $access);
     $this->metadata->setProperty($name, $property);
     if ($params) {
         preg_match_all('#\\{([^}]+)\\}#i', $params, $matches, PREG_SET_ORDER);
         if ($matches) {
             foreach ($matches as $match) {
                 $this->processPropertyModifier($property, preg_split('#\\s+#', $match[1]));
             }
         }
     }
 }
Exemple #2
0
 protected function parseAnnotationValue($name, array $types, $access, $propertyComment)
 {
     $property = new PropertyMetadata($name, $types, $access);
     $this->metadata->setProperty($name, $property);
     if (!$propertyComment) {
         return;
     }
     $matches = $this->modifierParser->matchModifiers($propertyComment);
     foreach ($matches as $macroContent) {
         try {
             $args = $this->modifierParser->parse($macroContent, $this->currentReflection);
         } catch (InvalidModifierDefinitionException $e) {
             throw new InvalidModifierDefinitionException("Invalid maco definition for {$this->currentReflection->name}::\${$name} property.", 0, $e);
         }
         $this->processPropertyModifier($property, $args[0], $args[1]);
     }
 }
Exemple #3
0
 protected function parseAnnotations(ClassType $reflection)
 {
     foreach ($reflection->getAnnotations() as $annotation => $values) {
         if ($annotation === 'property') {
             $isReadonly = false;
         } elseif ($annotation === 'property-read') {
             $isReadonly = true;
         } else {
             continue;
         }
         foreach ($values as $value) {
             $splitted = preg_split('#\\s+#', $value, 3);
             if (count($splitted) < 2 || $splitted[1][0] !== '$') {
                 throw new InvalidArgumentException("Annotation syntax error '{$value}'.");
             }
             $property = new PropertyMetadata();
             $property->name = substr($splitted[1], 1);
             $property->isReadonly = $isReadonly;
             $this->metadata->setProperty($property->name, $property);
             $this->parseAnnotationTypes($property, $splitted[0]);
             $this->parseAnnotationValue($property, isset($splitted[2]) ? $splitted[2] : null);
         }
     }
 }