/**
  * {@inheritDoc}
  */
 public function loadMetadata($class)
 {
     $cacheKey = 'var_tag_validator.metadata:' . $class;
     if ($this->cache->has($cacheKey)) {
         return $this->cache->get($cacheKey);
     }
     $metadata = $this->delegate->loadMetadata($class);
     $this->cache->set($cacheKey, $metadata);
     return $metadata;
 }
 /**
  * {@inheritDoc}
  */
 public function validateObjectByVarTags($object)
 {
     if (!is_object($object)) {
         throw UnexpectedTypeException::create($object, 'object');
     }
     $classMetadata = $this->metadataFactory->loadMetadata(get_class($object));
     $constraintViolationList = new ConstraintViolationList();
     foreach ($classMetadata->getProperties() as $propertyName => $propertyMetadata) {
         $availableVarTypes = $propertyMetadata->getTypes();
         if (!count($availableVarTypes)) {
             continue;
         }
         $violationListForProperty = $this->validatePropertyValueByTypes($object, $propertyName, $availableVarTypes);
         if ($violationListForProperty && count($violationListForProperty)) {
             foreach ($violationListForProperty as $violationForProperty) {
                 // Recreate violation for save property path
                 $violation = new ConstraintViolation($violationForProperty->getMessage(), $violationForProperty->getMessageTemplate(), $violationForProperty->getMessageParameters(), $violationForProperty->getRoot(), $propertyName, $violationForProperty->getInvalidValue(), $violationForProperty->getMessagePluralization(), $violationForProperty->getCode());
                 $constraintViolationList->add($violation);
             }
         }
     }
     return $constraintViolationList;
 }