コード例 #1
0
 /**
  * {@inheritdoc}
  * @throws PropertyDefinitionAlreadyExistsException
  * @throws PropertyDefinitionNotFoundException
  */
 public function analyze(DefinitionAnalyzer $analyzer, ClassDefinition $classDefinition, \ReflectionProperty $reflectionProperty)
 {
     $propertyName = $reflectionProperty->getName();
     // Resolve annotations
     $annotations = $this->reader->getPropertyAnnotations($reflectionProperty);
     if (count($annotations)) {
         // Define property if not exists
         if (!$classDefinition->hasProperty($propertyName)) {
             $classDefinition->defineProperty($propertyName);
         }
         // Exec annotations
         foreach ($annotations as $annotation) {
             if ($annotation instanceof ResolvePropertyInterface) {
                 $annotation->resolveProperty($analyzer, $classDefinition, $reflectionProperty);
             }
         }
     }
 }
コード例 #2
0
 /**
  * Resolve property
  *
  * @param ClassDefinition $classDefinition
  * @param array $propertyArray
  * @param string $propertyName
  * @throws \InvalidArgumentException
  * @throws ReferenceNotImplementsException
  * @throws PropertyDefinitionAlreadyExistsException
  */
 protected function resolveProperty(ClassDefinition $classDefinition, array $propertyArray, string $propertyName)
 {
     $propertyDefinition = $classDefinition->defineProperty($propertyName);
     $propertyDefinition->defineDependency($this->resolveDependency($propertyArray));
 }