/**
  * {@inheritDoc}
  */
 public function loadMetadata($class)
 {
     // Try get object annotation from class
     $objectAnnotation = null;
     $classAnnotations = Reflection::loadClassAnnotations($this->reader, $class, true);
     foreach ($classAnnotations as $classAnnotation) {
         if ($classAnnotation instanceof ObjectAnnotation) {
             if ($objectAnnotation) {
                 throw new \RuntimeException(sprintf('Many @Transformer\\Object annotation in class "%s".', $class));
             }
             $objectAnnotation = $classAnnotation;
         }
     }
     if (!$objectAnnotation) {
         throw new TransformAnnotationNotFoundException(sprintf('Not found @Object annotations in class "%s".', $class));
     }
     // Try get properties annotations
     $properties = [];
     $classProperties = Reflection::getClassProperties($class, true);
     foreach ($classProperties as $classProperty) {
         $propertyAnnotations = $this->reader->getPropertyAnnotations($classProperty);
         foreach ($propertyAnnotations as $propertyAnnotation) {
             if ($propertyAnnotation instanceof PropertyAnnotation) {
                 $property = new PropertyMetadata($propertyAnnotation->propertyName ?: $classProperty->getName(), $propertyAnnotation->groups, $propertyAnnotation->shouldTransform, $propertyAnnotation->expressionValue);
                 $properties[$classProperty->getName()] = $property;
             }
         }
     }
     return new ObjectMetadata($objectAnnotation->transformedClass, $properties);
 }
 /**
  * {@inheritDoc}
  */
 public function loadMetadata($class)
 {
     // Try get @Object annotation
     $objectAnnotation = null;
     $classAnnotations = Reflection::loadClassAnnotations($this->reader, $class);
     foreach ($classAnnotations as $classAnnotation) {
         if ($classAnnotation instanceof ObjectAnnotation) {
             if ($objectAnnotation) {
                 throw new \RuntimeException(sprintf('Many @Normalize\\Object annotations in class "%s".', $class));
             }
             $objectAnnotation = $classAnnotation;
         }
     }
     // Try get @Property annotation from properties
     $properties = [];
     $classProperties = Reflection::getClassProperties($class, true);
     if ($objectAnnotation && $objectAnnotation->allProperties) {
         foreach ($classProperties as $classProperty) {
             /** @var PropertyAnnotation $propertyAnnotation */
             $propertyAnnotation = $this->reader->getPropertyAnnotation($classProperty, 'FivePercent\\Component\\ModelNormalizer\\Annotation\\Property');
             if ($propertyAnnotation) {
                 $properties[$classProperty->getName()] = new PropertyMetadata($propertyAnnotation->fieldName ?: $classProperty->getName(), $propertyAnnotation->groups, $propertyAnnotation->shouldNormalize, $propertyAnnotation->expressionValue, $propertyAnnotation->denormalizerClass);
             } else {
                 $properties[$classProperty->getName()] = new PropertyMetadata($classProperty->getName(), [], false, null);
             }
         }
     } else {
         foreach ($classProperties as $classProperty) {
             $propertyAnnotations = $this->reader->getPropertyAnnotations($classProperty);
             foreach ($propertyAnnotations as $propertyAnnotation) {
                 if ($propertyAnnotation instanceof PropertyAnnotation) {
                     $properties[$classProperty->getName()] = new PropertyMetadata($propertyAnnotation->fieldName ?: $classProperty->getName(), $propertyAnnotation->groups, $propertyAnnotation->shouldNormalize, $propertyAnnotation->expressionValue, $propertyAnnotation->denormalizerClass);
                 }
             }
         }
     }
     if (!count($properties) && !$objectAnnotation) {
         throw new NormalizeAnnotationNotFoundException(sprintf('Not found normalize annotations in class "%s".', $class));
     }
     return new ObjectMetadata($properties);
 }
 /**
  * {@inheritDoc}
  */
 public function loadMetadata($class)
 {
     $notifications = [];
     $classAnnotations = Reflection::loadClassAnnotations($this->reader, $class);
     $withoutOnEventParameter = false;
     foreach ($classAnnotations as $classAnnotation) {
         if ($classAnnotation instanceof NotificationAnnotation) {
             if (!$classAnnotation->onEvent) {
                 $withoutOnEventParameter = true;
             }
             $notification = new NotificationMetadata($classAnnotation->name, $classAnnotation->strategy, $classAnnotation->onEvent);
             $notifications[] = $notification;
         }
     }
     if (count($notifications) > 1 && $withoutOnEventParameter) {
         throw new \RuntimeException(sprintf('The parameter "onEvent" is required, if you use many @Notification annotation in class "%s".', $class));
     }
     if (count($notifications) == 0) {
         throw new NotificationAnnotationNotFoundException(sprintf('Not found @Notification annotation in class "%s".', $class));
     }
     return new ClassMetadata($notifications);
 }