@param ConstraintInterface          $constraint
@param Value\ConcreteValueInterface &$value
@param PointerInterface|null        $entryPoint

@return Result\ValidationResult
350271
public function validate(
        ConstraintInterface $constraint,
        Value\ConcreteValueInterface &$value,
        PointerInterface $entryPoint = null
    ) {
        if (null === $entryPoint) {
            $entryPoint = new Pointer;
        }

        $this->clear();

        $this->pushContext(array($value, $entryPoint));
        $result = $constraint->accept($this);

        $this->clear();

        return $result;
    }
46458
public function validate($location, Constraint $constraint)
    {
        if (null === $location) {
            return;
        }

        $isWithinCopySubtreeLimit = new IsWithinCopySubtreeLimit($this->copySubtreeLimit, $this->searchService);
        try {
            if (!$isWithinCopySubtreeLimit->isSatisfiedBy($location)) {
                $this
                    ->context
                    ->buildViolation($constraint->message)
                    ->setParameter('%currentLimit%', $this->copySubtreeLimit)
                    ->addViolation();
            }
        } catch (InvalidArgumentException $e) {
            $this->context->addViolation($e->getMessage());
        }
    }
442079
public function validate($location, Constraint $constraint)
    {
        if (null === $location) {
            $this->context->addViolation($constraint->message);

            return;
        }

        $isContainer = new IsContainer();
        if (!$isContainer->isSatisfiedBy($location)) {
            $this->context->addViolation($constraint->message);
        }
    }
1056013
public function validate($value, Constraint $constraint)
    {
        /** @var Constraints\Disabled $constraint */
        Assert::isInstanceOf($constraint, Constraints\Disabled::class);

        if (null === $value) {
            return;
        }

        $this->ensureValueImplementsToggleableInterface($value);

        if ($value->isEnabled()) {
            $this->context->addViolation($constraint->message);
        }
    }
1258760
public function validate($value, Constraint $constraint)
    {
        if (!$value instanceof UrlAlias) {
            return;
        }

        if (false === $this->isStrict) {
            return;
        }

        // check for a managed state, if a empty array is returned
        // it is save to say we got a new entity.
        if ([] !== ($original = $this->getOriginalData($value))) {
            // no change in public_url field while updating, so no validation needed.
            if ($original['public_url'] === $value->getPublicUrl()) {
                return;
            }
        }

        if (0 < $this->getPublicUrlCount($value->getPublicUrl())) {
            $this->addViolation($value->getPublicUrl(), $constraint);
        }
    }
83858
public static function createFromConstraintViolationList(ConstraintViolationListInterface $errors)
    {
        $exception = static::createUnprocessable('Input validation errors.');

        /** @var ConstraintViolationInterface $error */
        foreach ($errors as $error) {
            $exception->errorValidation($error->getPropertyPath(), $error->getMessage());
        }

        return $exception;
    }
1197119
public function validate($entity, Constraint $constraint)
    {
        if (!$entity instanceof Review) {
            throw new \InvalidArgumentException('Expected instance of ' . Review::class);
        }
        
        $checker = new BadWordsChecker();
        
        if (false === $checker->isBadWord($entity->getReview())) {
            return;
        }
        
        if ($this->context instanceof ExecutionContextInterface) {
            $this->context->buildViolation($constraint->message)
                ->atPath('review')
                ->addViolation();
        }
    }
871700
protected function createMaximumDateTimeConstraint(Value\ConcreteValueInterface $value)
    {
        if ($value instanceof Value\DateTimeValue) {
            return new DateTimeValue\MaximumDateTimeConstraint($value->value());
        }

        return new DateTimeValue\MaximumDateTimeConstraint(
            new DateTime($value->value())
        );
    }
944564
public function validate($value, Constraint $constraint)
    {
        $check = $this->container->get('admin.configuration.configvalue_manager')->getRepository()->findOneBySectionGroupAndValueName(
            $value->getConfigGroup()->getConfigSection()->getName(),
            $value->getConfigGroup()->getName(),
            $value->getName()
        );
        if ( $check && $check->getId() != $value->getId()) {
            $message = $this->container->get('translator')->trans(
                $constraint->message,
                array(
                    '%value%' => $value->getName(),
                    '%group%' => $value->getConfigGroup()->getName(),
                    '%section%' => $value->getConfigGroup()->getConfigSection()->getName()
                ),
                'VinceTAdminConfigurationBundle'
            );
            $this->context->addViolation($message);
        }
    }
370606
public function validate($value, Constraint $constraint)
    {
        if (!$this->workflowRegistry instanceof Registry) {
            throw new Exception('Can not validate model: No workflows were defined');
        }

        if (!$constraint instanceof Model) {
            throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Model');
        }

        if (null === $value || '' === $value) {
            return;
        }

        if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) {
            throw new UnexpectedTypeException($value, 'string');
        }

        try {
            WorkflowHelper::get($this->workflowRegistry, $value);
        } catch (InvalidArgumentException $exception) {
            $this->context->buildViolation($constraint->message)
                ->setParameter('{{ string }}', $value)
                ->addViolation();
        }
    }
1179125
public function validate($value, Constraint $constraint)
    {
        if (!$constraint instanceof Media) {
            throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\Media');
        }

        if (!$value instanceof MediaObject) {
            return;
        }

        $mimeType = $value->getContentType();

        if ($constraint->mimeTypes) {
            $mimeTypes = (array) $constraint->mimeTypes;

            if (false === $this->validateMimeType($value, $mimeTypes)) {
                $this->context->buildViolation($constraint->mimeTypesMessage)
                    ->setParameter('{{ type }}', $this->formatValue($mimeType))
                    ->setParameter('{{ types }}', $this->formatValues($mimeTypes))
                    ->setCode(Media::INVALID_MIME_TYPE_ERROR)
                    ->addViolation();

                return;
            }
        }

        if (!preg_match('^image\/*^', $mimeType) || $mimeType === 'image/svg+xml') {
            return;
        }

        $this->validateDimensions($value, $constraint);
    }
1141134
public function validate($value, Constraint $constraint)
    {
        if (!$value) {
            return;
        }

        $fileHistory = $this->em->getRepository('JbFileUploaderBundle:FileHistory')->find($value);
        if (!$fileHistory) {
            return;
        }

        // No userid associated with file. Every one can use it.
        if (!$fileHistory->getUserId()) {
            return;
        }

        // No token. Violation as there is a user id associate with file.
        $token = $this->tokenStorage->getToken();
        if (!$token) {
            return $this->createViolation($value, $constraint);
        }

        // No user. Violation as there is a user id associate with file.
        $user = $token->getUser();
        if (!$user) {
            return $this->createViolation($value, $constraint);
        }

        if ($user->getId() !== $fileHistory->getUserId()) {
            return $this->createViolation($value, $constraint);
        }

        return;
    }
499461
public function validate($value, Constraint $constraint)
    {
        if (!$constraint instanceof BankAccount) {
            throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\BankAccount');
        }

        if ($value === null || $value === '') {
            return;
        }

    /** @var \Symfony\Component\Form\Form $root */
        $root = $this->context->getRoot();

    /** @var \Generated\Shared\Transfer\QuoteTransfer $data */
        $data = $root->getData();

        $validationMessages = $this->validateBankAccount($data, $constraint);

        if (count($validationMessages) > 0) {
            foreach ($validationMessages as $validationMessage) {
                $this->buildViolation($validationMessage)
                ->addViolation();
            }
        }
    }
322159
public function validate($value, Constraint $constraint)
    {
        if ($value->isInMenu() || $value->isInFooter()) {
            if (preg_match('/{.*}/', $value->getRoutePattern())) {
                $this->context->buildViolation($constraint->message)
                    ->atPath('routePattern')
                    ->addViolation();
            }
        }
    }
427188
public function validate($value, Constraint $constraint)
    {
        $block = $constraint->block;
        if ($block instanceof BlockInterface && true === $block->isTransverse() && !empty($value)) {
            $blockCode = $this->repository->findOneTransverseBlockByCode($value, $block->getLanguage(), $block->getSiteId());
            if (null !== $blockCode && $blockCode->getId() !== $block->getId()) {
                $this->context->buildViolation($constraint->message)
                    ->atPath('code')
                    ->addViolation();
            }
        }

    }
13642
public function visitDependencyConstraint(ObjectValue\DependencyConstraint $constraint)
    {
        $value = $this->currentValue();
        if (
            !$value instanceof Value\ObjectValue ||
            !$value->has($constraint->property())
        ) {
            return $this->createResult();
        }

        return $constraint->schema()->accept($this);
    }
1090119
public function force($value, $rule, AppliesToResource $resource=null)
    {
        if (!$this->check($value, $rule, $resource)) {
            throw new ConstraintViolationException('Value does not match constraint.');
        }

        return true;
    }