Пример #1
0
 /**
  * @param  ErrorHandler       $errorHandler
  * @throws SerializeException
  */
 public function validateMappingConfiguration(ErrorHandler $errorHandler)
 {
     $propertyNames = array();
     $serializedNames = array();
     foreach ($this->getMappingConfigurations() as $mappingConfiguration) {
         $propertyName = $mappingConfiguration->getPropertyName();
         $serializedName = $mappingConfiguration->getSerializedName();
         if (!property_exists($this, $propertyName)) {
             $errorHandler->mappingNotFoundPropertyName($this, $propertyName);
         }
         if (in_array($propertyName, $propertyNames, true)) {
             $errorHandler->mappingDuplicatePropertyName($this, $propertyName);
         }
         if (in_array($serializedName, $serializedNames, true)) {
             $errorHandler->mappingDuplicateSerializedName($this, $serializedName);
         }
     }
 }
Пример #2
0
 /**
  * @param AbstractAuthorizationResponse $authorizationResponse
  * @return \Symfony\Component\Validator\ConstraintViolationListInterface
  */
 public function validateAuthorizationResponse(AbstractAuthorizationResponse $authorizationResponse)
 {
     $violations = $this->validator->validate($authorizationResponse);
     $this->errorHandler->violations($violations);
     return $violations;
 }