@param DateTimeValue\MinimumDateTimeConstraint $constraint

@return string
554126
public function visitMinimumDateTimeConstraint(DateTimeValue\MinimumDateTimeConstraint $constraint)
    {
        return sprintf(
            'The date-time value must not be before %s.',
            var_export($constraint->minimum()->format('c'), true)
        );
    }
340940
public function visitItemsConstraint(ArrayValue\ItemsConstraint $constraint)
    {
        $value = $this->currentValue();
        if (!$value instanceof Value\ArrayValue) {
            return $this->createResult();
        }

        $result = $this->createResult();
        $matchedIndices = array();

        // items
        foreach ($constraint->schemas() as $index => $schema) {
            if ($value->has($index)) {
                $matchedIndices[$index] = true;
                $result = $result->merge(
                    $this->validateArrayIndex($index, $schema)
                );
            } elseif (null !== $schema->defaultValue()) {
                $result = $result->merge(
                    $this->createResult(
                        array(),
                        array($this->createDefaultValueMatch($schema, $index))
                    )
                );
            }
        }

        // additional items
        foreach ($value->keys() as $index) {
            if (!array_key_exists($index, $matchedIndices)) {
                $result = $result->merge(
                    $this->validateArrayIndex(
                        $index,
                        $constraint->additionalSchema()
                    )
                );
            }
        }

        return $result;
    }
1066284
public static function normalize(Constraint $constraint)
    {
        return [
            'name'      => $constraint->getName(),
            'options'   => array_map(
                function (ConstraintOption $option) {
                    return [
                        'name'  => $option->getName(),
                        'value' => $option->getValue(),
                    ];
                },
                $constraint->getOptions()
            ),
        ];
    }
1351429
public function setConstraint($constraint) 
    {
        if (!$this->_isNumericArray($constraint)) {
            $constraint =  array ($constraint);    
        }
        $this->_fields['Constraint']['FieldValue'] = $constraint;
        return $this;
    }
637065
public function addConstraint(Constraint $constraint) : void
    {
        $constraint->setValidator($this);
        array_push($this->constraints, $constraint);
    }
1264316
public function min(\DateTimeInterface $min)
    {
        $min = $this->processDateTime($min);

        return $this->attr(DateTimeTypeBase::ATTR_MIN, $min);
    }
1048875
protected function generateTableConstraints($constraintName, $constraints)
    {
        $annotations = array();
        foreach ($constraints as $name => $constraint) {
            $columns = array();
            foreach ($constraint['columns'] as $column) {
                $columns[] = '"' . $column . '"';
            }
            $annotations[] = '@' . $this->annotationsPrefix . $constraintName . '(name="' . $name . '", columns={' . implode(', ', $columns) . '})';
        }
        return implode(', ', $annotations);
    }
814721
protected function manageMandate(QuoteTransfer $data, ManageMandate $constraint)
    {
        $response = $constraint->getPayoneClient()->manageMandate($data);
        if ($response->getStatus() === PayoneApiConstants::RESPONSE_TYPE_ERROR) {
            return [$response->getCustomerErrorMessage()];
        }
        $data->getPayment()->getPayoneDirectDebit()->setMandateIdentification($response->getMandateIdentification());
        $data->getPayment()->getPayoneDirectDebit()->setMandateText(urldecode($response->getMandateText()));
        $data->getPayment()->getPayoneDirectDebit()->setBankcountry(urldecode($response->getBankCountry()));
        $data->getPayment()->getPayoneDirectDebit()->setBankaccount(urldecode($response->getBankAccount()));
        $data->getPayment()->getPayoneDirectDebit()->setBankcode(urldecode($response->getBankCode()));
        $data->getPayment()->getPayoneDirectDebit()->setIban(urldecode($response->getIban()));
        $data->getPayment()->getPayoneDirectDebit()->setBic(urldecode($response->getBic()));
        return [];
    }
238559
public function visitHostnameFormatConstraint(StringValue\HostnameFormatConstraint $constraint)
    {
        if (!$this->formatValidationEnabled()) {
            return $this->createResult();
        }

        $value = $this->currentValue();
        if (
            !$value instanceof Value\StringValue ||
            $this->hostnameValidator()->isValid($value->value())
        ) {
            return $this->createResult();
        }

        return $this->createSingleIssueResult($constraint);
    }
738058
private function guessPrimaryTypeFromConstraint(Constraint $constraint) : ?TypeDoc
    {
        // Try to guess primary types
        if (null !== ($type = $this->guessSimplePrimaryTypeFromConstraint($constraint))) {
            return $type;
        } elseif ($constraint instanceof Assert\DateTime) {
            return $this->guessDateTimeType($constraint);
        } elseif ($constraint instanceof Assert\Collection) {
            return $this->guestCollectionType($constraint);
        }

        return null;
    }
651778
public function getInstance(Constraint $constraint)
    {
        $name = $constraint->validatedBy();

        if (!isset($this->validators[$name])) {
            if ($this->container->has($name)) {
                $this->validators[$name] = $this->container->get($name);
            } else {
                if (!class_exists($name)) {
                    throw new ValidatorException(sprintf('Constraint validator "%s" does not exist or is not enabled. Check the "validatedBy" method in your constraint class "%s".', $name, \get_class($constraint)));
                }

                $this->validators[$name] = new $name();
            }
        }

        if (!$this->validators[$name] instanceof ConstraintValidatorInterface) {
            throw new UnexpectedTypeException($this->validators[$name], ConstraintValidatorInterface::class);
        }

        return $this->validators[$name];
    }
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();
            }
        }

    }
24894
public function visitPropertiesConstraint(ObjectValue\PropertiesConstraint $constraint)
    {
        return new ObjectValue\PropertiesConstraint(
            $this->transformConstraintArray($constraint->schemas()),
            $this->transformConstraintArray($constraint->patternSchemas()),
            $constraint->additionalSchema()->accept($this)
        );
    }
90546
public function validate($value, Constraint $constraint)
    {
        $url = $this->helper->getUrl($value);
        if($this->browser->get($url)->getStatusCode() >= 400) {
            $this->context->addViolation($constraint->message, array('%string%' => $url));
        }
    }
1022925
public function validate($value, Constraint $constraint)
    {
        $object = $this->context->getObject();
        $name = null;
        if (is_object($object)) {
            if (method_exists($object, 'getConfig'))
                $name = $object->getConfig()->getName();
            if (! $name && method_exists($object, '__toString'))
                $name = $object->__toString();
            if (! $name && method_exists($object, 'getName'))
                $name = $object->getName();
            if (! $name)
                $name = get_class($object);
        } else
            $name = strval($object);
        $this->context->buildViolation($constraint->message)
            ->setParameter('%{name}', $name)
            ->addViolation();
    }
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;
    }
162104
protected function validateDelimiter(Constraint $constraint)
    {
        if (strlen($constraint->delimiter) > 2) {
            throw new ConstraintDefinitionException(sprintf('"%s" is not a valid delimiter', $constraint->delimiter));
        }
    }