original_string: private function validateInGroup($value, $cacheKey, MetadataInterface $metadata, $group, ExecutionContextInterface $context)
      {
          $context->setGroup($group);
  
          foreach ($metadata->findConstraints($group) as $constraint) {
              // Prevent duplicate validation of constraints, in the case
              // that constraints belong to multiple validated groups
              if (null !== $cacheKey) {
                  $constraintHash = spl_object_hash($constraint);
  
                  if ($constraint instanceof Composite) {
                      $constraintHash .= $group;
                  }
  
                  if ($context->isConstraintValidated($cacheKey, $constraintHash)) {
                      continue;
                  }
  
                  $context->markConstraintAsValidated($cacheKey, $constraintHash);
              }
  
              $context->setConstraint($constraint);
  
              $validator = $this->validatorFactory->getInstance($constraint);
              $validator->initialize($context);
  
              try {
                  $validator->validate($value, $constraint);
              } catch (UnexpectedValueException $e) {
                  $context->buildViolation('This value should be of type {{ type }}.')
                      ->setParameter('{{ type }}', $e->getExpectedType())
                      ->addViolation();
              }
          }
      }
code: private function validateInGroup($value, $cacheKey, MetadataInterface $metadata, $group, ExecutionContextInterface $context)
      {
          $context->setGroup($group);
  
          foreach ($metadata->findConstraints($group) as $constraint) {
              // Prevent duplicate validation of constraints, in the case
              // that constraints belong to multiple validated groups
              if (null !== $cacheKey) {
                  $constraintHash = spl_object_hash($constraint);
  
                  if ($constraint instanceof Composite) {
                      $constraintHash .= $group;
                  }
  
                  if ($context->isConstraintValidated($cacheKey, $constraintHash)) {
                      continue;
                  }
  
                  $context->markConstraintAsValidated($cacheKey, $constraintHash);
              }
  
              $context->setConstraint($constraint);
  
              $validator = $this->validatorFactory->getInstance($constraint);
              $validator->initialize($context);
  
              try {
                  $validator->validate($value, $constraint);
              } catch (UnexpectedValueException $e) {
                  $context->buildViolation('This value should be of type {{ type }}.')
                      ->setParameter('{{ type }}', $e->getExpectedType())
                      ->addViolation();
              }
          }
      }
code_tokens: private function validateInGroup ( $ value , $ cacheKey , MetadataInterface $ metadata , $ group , ExecutionContextInterface $ context ) { $ context -> setGroup ( $ group ) ; foreach ( $ metadata -> findConstraints ( $ group ) as $ constraint ) { // Prevent duplicate validation of constraints, in the case // that constraints belong to multiple validated groups if ( null !== $ cacheKey ) { $ constraintHash = spl_object_hash ( $ constraint ) ; if ( $ constraint instanceof Composite ) { $ constraintHash .= $ group ; } if ( $ context -> isConstraintValidated ( $ cacheKey , $ constraintHash ) ) { continue ; } $ context -> markConstraintAsValidated ( $ cacheKey , $ constraintHash ) ; } $ context -> setConstraint ( $ constraint ) ; $ validator = $ this -> validatorFactory -> getInstance ( $ constraint ) ; $ validator -> initialize ( $ context ) ; try { $ validator -> validate ( $ value , $ constraint ) ; } catch ( UnexpectedValueException $ e ) { $ context -> buildViolation ( 'This value should be of type {{ type }}.' ) -> setParameter ( '{{ type }}' , $ e -> getExpectedType ( ) ) -> addViolation ( ) ; } } }
docstring: Validates a node's value against all constraints in the given group.
  
  @param mixed                     $value    The validated value
  @param string                    $cacheKey The key for caching the
  validated value
  @param MetadataInterface         $metadata The metadata of the value
  @param string                    $group    The group to validate
  @param ExecutionContextInterface $context  The execution context
docstring_tokens: Validates a node s value against all constraints in the given group .