diff --git a/core/composer.json b/core/composer.json index 293f0c4..2233d96 100644 --- a/core/composer.json +++ b/core/composer.json @@ -14,7 +14,7 @@ "symfony/http-kernel": "2.6.*", "symfony/routing": "2.6.*", "symfony/serializer": "2.6.*", - "symfony/validator": "2.6.*", + "symfony/validator": "2.7.0-dev", "symfony/process": "2.6.*", "symfony/yaml": "2.6.*", "twig/twig": "1.16.*", @@ -33,6 +33,21 @@ "fabpot/goutte": "^2.0.3", "masterminds/html5": "~2.1" }, + "repositories": [ + { + "type":"package", + "package": { + "name": "symfony/validator", + "type": "library", + "version":"2.7.0-dev", + "source": { + "url": "git@github.com:fago/Validator.git", + "type": "git", + "reference":"drupal-8.0.x" + } + } + } + ], "autoload": { "psr-4": { "Drupal\\Core\\": "lib/Drupal/Core", diff --git a/core/composer.lock b/core/composer.lock index 8195a56..4d7affe 100644 --- a/core/composer.lock +++ b/core/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "17d7b4a789169d1156ff398b5889b1a2", + "hash": "4e2cf686bbdeec6ee287d20ab4622abf", "packages": [ { "name": "behat/mink", @@ -2728,75 +2728,13 @@ }, { "name": "symfony/validator", - "version": "v2.6.6", - "target-dir": "Symfony/Component/Validator", + "version": "2.7.0-dev", "source": { "type": "git", - "url": "https://github.com/symfony/Validator.git", - "reference": "85d9b42fe71bf88e7a1e5dec2094605dc9fbff28" + "url": "git@github.com:fago/Validator.git", + "reference": "drupal-8.0.x" }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Validator/zipball/85d9b42fe71bf88e7a1e5dec2094605dc9fbff28", - "reference": "85d9b42fe71bf88e7a1e5dec2094605dc9fbff28", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "symfony/translation": "~2.0,>=2.0.5" - }, - "require-dev": { - "doctrine/annotations": "~1.0", - "doctrine/cache": "~1.0", - "doctrine/common": "~2.3", - "egulias/email-validator": "~1.2,>=1.2.1", - "symfony/config": "~2.2", - "symfony/expression-language": "~2.4", - "symfony/http-foundation": "~2.1", - "symfony/intl": "~2.3", - "symfony/phpunit-bridge": "~2.7", - "symfony/property-access": "~2.3", - "symfony/yaml": "~2.0,>=2.0.5" - }, - "suggest": { - "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", - "doctrine/cache": "For using the default cached annotation reader and metadata cache.", - "egulias/email-validator": "Strict (RFC compliant) email validation", - "symfony/config": "", - "symfony/expression-language": "For using the 2.4 Expression validator", - "symfony/http-foundation": "", - "symfony/intl": "", - "symfony/property-access": "For using the 2.4 Validator API", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Validator\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Validator Component", - "homepage": "http://symfony.com", - "time": "2015-03-30 15:54:10" + "type": "library" }, { "name": "symfony/yaml", @@ -3058,7 +2996,9 @@ "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "symfony/validator": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/core/lib/Drupal/Core/TypedData/TypedDataManager.php b/core/lib/Drupal/Core/TypedData/TypedDataManager.php index cd7ad17..2a6a823 100644 --- a/core/lib/Drupal/Core/TypedData/TypedDataManager.php +++ b/core/lib/Drupal/Core/TypedData/TypedDataManager.php @@ -28,7 +28,7 @@ class TypedDataManager extends DefaultPluginManager { /** * The validator used for validating typed data. * - * @var \Symfony\Component\Validator\ValidatorInterface + * @var \Symfony\Component\Validator\Validator\ValidatorInterface */ protected $validator; @@ -335,7 +335,7 @@ public function getValidator() { ->setMetadataFactory(new MetadataFactory($this)) ->setTranslator(new DrupalTranslator()) ->setConstraintValidatorFactory(new ConstraintValidatorFactory($this->classResolver)) - ->setApiVersion(Validation::API_VERSION_2_4) + ->setApiVersion(Validation::API_VERSION_2_5) ->getValidator(); } return $this->validator; diff --git a/core/lib/Drupal/Core/TypedData/Validation/GenericMetadata.php b/core/lib/Drupal/Core/TypedData/Validation/GenericMetadata.php new file mode 100755 index 0000000..a8eedd8 --- /dev/null +++ b/core/lib/Drupal/Core/TypedData/Validation/GenericMetadata.php @@ -0,0 +1,46 @@ +typedData); + } + + /** + * {@inheritdoc} + */ + public function getCascadingStrategy() { + return CascadingStrategy::NONE; + } + + /** + * {@inheritdoc} + */ + public function getPropertyValue($container) { + return $this->typedData; + } + + /** + * {@inheritdoc} + */ + public function getPropertyName() { + return $this->typedData->getName(); + } + +} diff --git a/core/lib/Drupal/Core/TypedData/Validation/Metadata.php b/core/lib/Drupal/Core/TypedData/Validation/Metadata.php deleted file mode 100644 index 6fe5255..0000000 --- a/core/lib/Drupal/Core/TypedData/Validation/Metadata.php +++ /dev/null @@ -1,115 +0,0 @@ -typedData = $typed_data; - $this->name = $name; - $this->factory = $factory; - $this->typedDataManager = $typed_data_manager; - } - - /** - * Implements MetadataInterface::accept(). - */ - public function accept(ValidationVisitorInterface $visitor, $typed_data, $group, $propertyPath) { - - // @todo: Do we have to care about groups? Symfony class metadata has - // $propagatedGroup. - - $visitor->visit($this, $this->typedDataManager->getCanonicalRepresentation($typed_data), $group, $propertyPath); - } - - /** - * Implements MetadataInterface::findConstraints(). - */ - public function findConstraints($group) { - return $this->typedData->getConstraints(); - } - - /** - * Returns the name of the property. - * - * @return string The property name. - */ - public function getPropertyName() { - return $this->name; - } - - /** - * Extracts the value of the property from the given container. - * - * @param mixed $container The container to extract the property value from. - * - * @return mixed The value of the property. - */ - public function getPropertyValue($container) { - return $this->typedDataManager->getCanonicalRepresentation($this->typedData); - } - - /** - * Returns the typed data object. - * - * @return \Drupal\Core\TypedData\TypedDataInterface - * The typed data object. - */ - public function getTypedData() { - return $this->typedData; - } -} diff --git a/core/lib/Drupal/Core/TypedData/Validation/MetadataBase.php b/core/lib/Drupal/Core/TypedData/Validation/MetadataBase.php new file mode 100755 index 0000000..424632a --- /dev/null +++ b/core/lib/Drupal/Core/TypedData/Validation/MetadataBase.php @@ -0,0 +1,158 @@ +typedData = $typed_data; + $this->typedDataManager = $typed_data_manager; + } + + /** + * {@inheritdoc} + */ + public function getTypedData() { + return $this->typedData; + } + + /** + * {@inheritdoc} + */ + public function preprocessValue(&$value) { + if (!$value instanceof TypedDataInterface) { + throw new \LogicException('This class may be used with Typed Data objects only.'); + } + // Pass the canonical representation to validators. + $value = $this->typedDataManager->getCanonicalRepresentation($value); + } + + /** + * {@inheritdoc} + */ + public function accept(ValidationVisitorInterface $visitor, $typed_data, $group, $propertyPath) { + throw new BadMethodCallException('Not supported.'); + } + + /** + * {@inheritdoc} + */ + public function findConstraints($group) { + return $this->getConstraints(); + } + + /** + * {@inheritdoc} + */ + public function getConstraints() { + return array_merge($this->typedData->getConstraints(), $this->extraConstraints); + } + + /** + * {@inheritdoc} + */ + public function getTraversalStrategy() { + return TraversalStrategy::NONE; + } + + /** + * {@inheritdoc} + */ + public function addExtraConstraints(array $constraints) { + $this->extraConstraints = array_merge($this->extraConstraints, $constraints); + } + + /** + * {@inheritdoc} + */ + public function getClassName() { + return get_class($this->typedData); + } + + /** + * {@inheritdoc} + */ + public function getGroupSequence() { + return NULL; + } + + /** + * {@inheritdoc} + */ + public function hasGroupSequence() { + return FALSE; + } + + /** + * {@inheritdoc} + */ + public function isGroupSequenceProvider() { + return FALSE; + } + + /** + * {@inheritdoc} + */ + public function getConstrainedProperties() { + return []; + } + + /** + * {@inheritdoc} + */ + public function hasPropertyMetadata($property) { + return FALSE; + } + + /** + * {@inheritdoc} + */ + public function getPropertyMetadata($property) { + return []; + } + +} diff --git a/core/lib/Drupal/Core/TypedData/Validation/MetadataFactory.php b/core/lib/Drupal/Core/TypedData/Validation/MetadataFactory.php old mode 100644 new mode 100755 index fcd0557..9a6a47f --- a/core/lib/Drupal/Core/TypedData/Validation/MetadataFactory.php +++ b/core/lib/Drupal/Core/TypedData/Validation/MetadataFactory.php @@ -11,7 +11,7 @@ use Drupal\Core\TypedData\ListInterface; use Drupal\Core\TypedData\TypedDataInterface; use Drupal\Core\TypedData\TypedDataManager; -use Symfony\Component\Validator\MetadataFactoryInterface; +use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; /** * Typed data implementation of the validator MetadataFactoryInterface. @@ -39,24 +39,25 @@ public function __construct(TypedDataManager $typed_data_manager) { * {@inheritdoc} * * @param \Drupal\Core\TypedData\TypedDataInterface $typed_data - * Some typed data object containing the value to validate. - * @param $name - * (optional) The name of the property to get metadata for. Leave empty, if - * the data is the root of the typed data tree. + * A typed data object containing the value to validate. */ - public function getMetadataFor($typed_data, $name = '') { + public function getMetadataFor($typed_data) { if (!$typed_data instanceof TypedDataInterface) { throw new \InvalidArgumentException('The passed value must be a typed data object.'); } - $is_container = $typed_data instanceof ComplexDataInterface || $typed_data instanceof ListInterface; - $class = '\Drupal\Core\TypedData\Validation\\' . ($is_container ? 'PropertyContainerMetadata' : 'Metadata'); - return new $class($typed_data, $name, $this, $this->typedDataManager); + $class = '\Drupal\Core\TypedData\Validation\GenericMetadata'; + if ($typed_data instanceof ComplexDataInterface || $typed_data instanceof ListInterface) { + // When validation is started on a container, we need its class metadata. + $class = '\Drupal\Core\TypedData\Validation\PropertyContainerClassMetadata'; + } + return new $class($typed_data, $this->typedDataManager); } /** - * Implements MetadataFactoryInterface::hasMetadataFor(). + * {@inheritdoc} */ public function hasMetadataFor($value) { return $value instanceof TypedDataInterface; } + } diff --git a/core/lib/Drupal/Core/TypedData/Validation/PropertyContainerClassMetadata.php b/core/lib/Drupal/Core/TypedData/Validation/PropertyContainerClassMetadata.php new file mode 100644 index 0000000..b917684 --- /dev/null +++ b/core/lib/Drupal/Core/TypedData/Validation/PropertyContainerClassMetadata.php @@ -0,0 +1,97 @@ +typedData->isEmpty()) { + // Do not continue cascading down the tree if a data structure is empty. + return []; + } + if ($this->typedData instanceof ListInterface) { + // @todo: When https://www.drupal.org/node/2164601 gets committed, + // simplify this to return the list indexes based on the list count. + return array_keys(iterator_to_array($this->typedData)); + } + elseif ($this->typedData instanceof ComplexDataInterface) { + return array_keys($this->typedData->getProperties()); + } + else { + throw new \LogicException("This class should be only used for property containers."); + } + } + + /** + * {@inheritdoc} + */ + public function hasPropertyMetadata($property_name) { + if ($this->typedData instanceof ComplexDataInterface) { + return (bool) $this->typedData->getDataDefinition()->getPropertyDefinition($property_name); + } + elseif ($this->typedData instanceof ListInterface) { + try { + $item = $this->typedData->get($property_name); + return TRUE; + } + catch (\InvalidArgumentException $exception) { + return FALSE; + } + } + else { + throw new \LogicException("This class should be only used for property containers."); + } + } + + /** + * {@inheritdoc} + */ + public function getPropertyMetadata($property_name) { + if (!isset($this->propertyMetadata[$property_name])) { + $property = $this->typedData->get($property_name); + $class = '\Drupal\Core\TypedData\Validation\GenericMetadata'; + + if ($property instanceof ComplexDataInterface || $property instanceof ListInterface) { + $class = '\Drupal\Core\TypedData\Validation\PropertyContainerPropertyMetadata'; + } + $this->propertyMetadata[$property_name] = new $class($property, $this->typedDataManager); + } + return [ + $this->propertyMetadata[$property_name] + ]; + } + + /** + * {@inheritdoc} + */ + public function getCascadingStrategy() { + return CascadingStrategy::CASCADE; + } + +} diff --git a/core/lib/Drupal/Core/TypedData/Validation/PropertyContainerMetadata.php b/core/lib/Drupal/Core/TypedData/Validation/PropertyContainerMetadata.php deleted file mode 100644 index 80d3320..0000000 --- a/core/lib/Drupal/Core/TypedData/Validation/PropertyContainerMetadata.php +++ /dev/null @@ -1,72 +0,0 @@ -isEmpty()) { - $data = NULL; - } - else { - $data = $this->typedDataManager->getCanonicalRepresentation($typed_data); - } - $visitor->visit($this, $data, $group, $propertyPath); - $pathPrefix = isset($propertyPath) && $propertyPath !== '' ? $propertyPath . '.' : ''; - - // Only continue validating if the data is not empty. - if ($data) { - foreach ($typed_data as $name => $data) { - $metadata = $this->factory->getMetadataFor($data, $name); - $metadata->accept($visitor, $data, $group, $pathPrefix . $name); - } - } - } - - /** - * Implements PropertyMetadataContainerInterface::hasPropertyMetadata(). - */ - public function hasPropertyMetadata($property_name) { - try { - $exists = (bool)$this->getPropertyMetadata($property_name); - } - catch (\LogicException $e) { - $exists = FALSE; - } - return $exists; - } - - /** - * Implements PropertyMetadataContainerInterface::getPropertyMetadata(). - */ - public function getPropertyMetadata($property_name) { - if ($this->typedData instanceof ListInterface) { - return array(new Metadata($this->typedData[$property_name], $property_name, $this->factory, $this->typedDataManager)); - } - elseif ($this->typedData instanceof ComplexDataInterface) { - return array(new Metadata($this->typedData->get($property_name), $property_name, $this->factory, $this->typedDataManager)); - } - else { - throw new \LogicException("There are no known properties."); - } - } -} diff --git a/core/lib/Drupal/Core/TypedData/Validation/PropertyContainerPropertyMetadata.php b/core/lib/Drupal/Core/TypedData/Validation/PropertyContainerPropertyMetadata.php new file mode 100644 index 0000000..0ddd54e --- /dev/null +++ b/core/lib/Drupal/Core/TypedData/Validation/PropertyContainerPropertyMetadata.php @@ -0,0 +1,51 @@ +extraConstraints; + } + + /** + * {@inheritdoc} + */ + public function getPropertyValue($container) { + return $this->typedData; + } + + /** + * {@inheritdoc} + */ + public function getPropertyName() { + return $this->typedData->getName(); + } + +} diff --git a/core/lib/Drupal/Core/TypedData/Validation/TypedDataAwareValidatorTrait.php b/core/lib/Drupal/Core/TypedData/Validation/TypedDataAwareValidatorTrait.php new file mode 100644 index 0000000..4b61207 --- /dev/null +++ b/core/lib/Drupal/Core/TypedData/Validation/TypedDataAwareValidatorTrait.php @@ -0,0 +1,36 @@ +context; + /** @var \Symfony\Component\Validator\Context\ExecutionContextInterface $context */ + $metadata = $context->getMetadata(); + if ($metadata instanceof TypedDataMetadataInterface) { + return $metadata->getTypedData(); + } + else { + throw new \LogicException("The validator is not using the Typed Data metadata classes."); + } + } + +} diff --git a/core/lib/Drupal/Core/TypedData/Validation/TypedDataMetadataInterface.php b/core/lib/Drupal/Core/TypedData/Validation/TypedDataMetadataInterface.php new file mode 100644 index 0000000..aad790a --- /dev/null +++ b/core/lib/Drupal/Core/TypedData/Validation/TypedDataMetadataInterface.php @@ -0,0 +1,39 @@ +discovery->setDefinition('Null', array( - 'label' => new TranslationWrapper('Null'), - 'class' => '\Symfony\Component\Validator\Constraints\Null', - 'type' => FALSE, - )); - $this->discovery->setDefinition('NotNull', array( - 'label' => new TranslationWrapper('Not null'), - 'class' => '\Symfony\Component\Validator\Constraints\NotNull', - 'type' => FALSE, - )); $this->discovery->setDefinition('Blank', array( 'label' => new TranslationWrapper('Blank'), 'class' => '\Symfony\Component\Validator\Constraints\Blank', diff --git a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraintValidator.php b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraintValidator.php index efc6906..ef1fce8 100644 --- a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraintValidator.php +++ b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraintValidator.php @@ -7,25 +7,46 @@ namespace Drupal\Core\Validation\Plugin\Validation\Constraint; +use Drupal\Core\DependencyInjection\ContainerInjectionInterface; +use Drupal\Core\Session\AccountInterface; use Drupal\Core\TypedData\OptionsProviderInterface; use Drupal\Core\TypedData\ComplexDataInterface; +use Drupal\Core\TypedData\Validation\TypedDataAwareValidatorTrait; +use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\ChoiceValidator; /** * Validates the AllowedValues constraint. */ -class AllowedValuesConstraintValidator extends ChoiceValidator { +class AllowedValuesConstraintValidator extends ChoiceValidator implements ContainerInjectionInterface { + + use TypedDataAwareValidatorTrait; + + /** + * The current user. + * + * @var \Drupal\Core\Session\AccountInterface + */ + protected $currentUser; + + /** + * Constructs a new AllowedValuesConstraintValidator. + * + * @param \Drupal\Core\Session\AccountInterface $current_user + * The current user. + */ + public function __construct(AccountInterface $current_user) { + $this->currentUser = $current_user; + } /** * {@inheritdoc} */ public function validate($value, Constraint $constraint) { - $typed_data = $this->context->getMetadata()->getTypedData(); - + $typed_data = $this->getTypedData(); if ($typed_data instanceof OptionsProviderInterface) { - $account = \Drupal::currentUser(); - $allowed_values = $typed_data->getSettableValues($account); + $allowed_values = $typed_data->getSettableValues($this->currentUser); $constraint->choices = $allowed_values; // If the data is complex, we have to validate its main property. @@ -49,4 +70,11 @@ public function validate($value, Constraint $constraint) { parent::validate($value, $constraint); } + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + return new static($container->get('current_user')); + } + } diff --git a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/ComplexDataConstraintValidator.php b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/ComplexDataConstraintValidator.php old mode 100644 new mode 100755 index add46eb..aab0e7e --- a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/ComplexDataConstraintValidator.php +++ b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/ComplexDataConstraintValidator.php @@ -9,6 +9,8 @@ use Drupal\Core\TypedData\ComplexDataInterface; use Drupal\Core\TypedData\TypedDataInterface; +use Drupal\Core\TypedData\Validation\TypedDataAwareValidatorTrait; +use Drupal\Core\TypedData\Validation\TypedDataPropertyValidationEnvelope; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\Exception\UnexpectedTypeException; @@ -18,6 +20,8 @@ */ class ComplexDataConstraintValidator extends ConstraintValidator { + use TypedDataAwareValidatorTrait; + /** * {@inheritdoc} */ @@ -28,25 +32,18 @@ public function validate($value, Constraint $constraint) { // If un-wrapped data has been passed, fetch the typed data object first. if (!$value instanceof TypedDataInterface) { - $value = $this->context->getMetadata()->getTypedData(); + $value = $this->getTypedData(); } if (!$value instanceof ComplexDataInterface) { throw new UnexpectedTypeException($value, 'ComplexData'); } - $group = $this->context->getGroup(); - + $metadata = $this->context->getMetadata(); foreach ($constraint->properties as $name => $constraints) { - $property = $value->get($name); - $is_container = $property instanceof ComplexDataInterface || $property instanceof ListInterface; - if (!$is_container) { - $property = $property->getValue(); - } - elseif ($property->isEmpty()) { - // @see \Drupal\Core\TypedData\Validation\PropertyContainerMetadata::accept(); - $property = NULL; - } - $this->context->validateValue($property, $constraints, $name, $group); + $result = $metadata->getPropertyMetadata($name); + $property_metadata = reset($result); + $property_metadata->addExtraConstraints($constraints); } } + } diff --git a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/NotNullConstraint.php b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/NotNullConstraint.php new file mode 100644 index 0000000..cdf1b63 --- /dev/null +++ b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/NotNullConstraint.php @@ -0,0 +1,25 @@ +getTypedData(); + if (($typed_data instanceof ListInterface || $typed_data instanceof ComplexDataInterface) && $typed_data->isEmpty()) { + $value = NULL; + } + parent::validate($value, $constraint); + } + +} diff --git a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/NullConstraint.php b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/NullConstraint.php new file mode 100644 index 0000000..3d87128 --- /dev/null +++ b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/NullConstraint.php @@ -0,0 +1,25 @@ +getTypedData(); + if (($typed_data instanceof ListInterface || $typed_data instanceof ComplexDataInterface) && $typed_data->isEmpty()) { + $value = NULL; + } + parent::validate($value, $constraint); + } + +} diff --git a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidator.php b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidator.php index d1bdc0f..d873820 100644 --- a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidator.php +++ b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidator.php @@ -15,6 +15,7 @@ use Drupal\Core\TypedData\Type\IntegerInterface; use Drupal\Core\TypedData\Type\StringInterface; use Drupal\Core\TypedData\Type\UriInterface; +use Drupal\Core\TypedData\Validation\TypedDataAwareValidatorTrait; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; @@ -23,6 +24,8 @@ */ class PrimitiveTypeConstraintValidator extends ConstraintValidator { + use TypedDataAwareValidatorTrait; + /** * Implements \Symfony\Component\Validator\ConstraintValidatorInterface::validate(). */ @@ -32,7 +35,7 @@ public function validate($value, Constraint $constraint) { return; } - $typed_data = $this->context->getMetadata()->getTypedData(); + $typed_data = $this->getTypedData(); $valid = TRUE; if ($typed_data instanceof BinaryInterface && !is_resource($value)) { $valid = FALSE; diff --git a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/UniqueFieldValueValidator.php b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/UniqueFieldValueValidator.php index a5dde71..d6c3910 100644 --- a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/UniqueFieldValueValidator.php +++ b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/UniqueFieldValueValidator.php @@ -19,7 +19,7 @@ class UniqueFieldValueValidator extends ConstraintValidator { * {@inheritdoc} */ public function validate($items, Constraint $constraint) { - if (!isset($items)) { + if (!$item = $items->first()) { return; } $field_name = $items->getFieldDefinition()->getName(); @@ -31,13 +31,13 @@ public function validate($items, Constraint $constraint) { $value_taken = (bool) \Drupal::entityQuery($entity_type_id) // The id could be NULL, so we cast it to 0 in that case. ->condition($id_key, (int) $items->getEntity()->id(), '<>') - ->condition($field_name, $items->first()->value) + ->condition($field_name, $item->value) ->range(0, 1) ->count() ->execute(); if ($value_taken) { - $this->context->addViolation($constraint->message, array("%value" => $items->value)); + $this->context->addViolation($constraint->message, array("%value" => $item->value)); } } } diff --git a/core/modules/forum/src/Plugin/Validation/Constraint/ForumLeafConstraintValidator.php b/core/modules/forum/src/Plugin/Validation/Constraint/ForumLeafConstraintValidator.php index e4e9be2..f2d2400 100644 --- a/core/modules/forum/src/Plugin/Validation/Constraint/ForumLeafConstraintValidator.php +++ b/core/modules/forum/src/Plugin/Validation/Constraint/ForumLeafConstraintValidator.php @@ -20,10 +20,10 @@ class ForumLeafConstraintValidator extends ConstraintValidator { * {@inheritdoc} */ public function validate($items, Constraint $constraint) { - if (!isset($items)) { - return; - } $item = $items->first(); + if (!isset($item)) { + return NULL; + } // Verify that a term has been selected. if (!$item->entity) { diff --git a/core/modules/quickedit/src/Form/QuickEditFieldForm.php b/core/modules/quickedit/src/Form/QuickEditFieldForm.php index 2db50c4..68d96ed 100644 --- a/core/modules/quickedit/src/Form/QuickEditFieldForm.php +++ b/core/modules/quickedit/src/Form/QuickEditFieldForm.php @@ -17,7 +17,7 @@ use Drupal\Core\Entity\Entity\EntityFormDisplay; use Drupal\user\PrivateTempStoreFactory; use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\Validator\ValidatorInterface; +use Symfony\Component\Validator\Validator\ValidatorInterface; /** * Builds and process a form for editing a single entity field. @@ -48,7 +48,7 @@ class QuickEditFieldForm extends FormBase { /** * The typed data validator. * - * @var \Symfony\Component\Validator\ValidatorInterface + * @var \Symfony\Component\Validator\Validator\ValidatorInterface */ protected $validator; @@ -61,7 +61,7 @@ class QuickEditFieldForm extends FormBase { * The module handler. * @param \Drupal\Core\Entity\EntityStorageInterface $node_type_storage * The node type storage. - * @param \Symfony\Component\Validator\ValidatorInterface $validator + * @param \Symfony\Component\Validator\Validator\ValidatorInterface $validator * The typed data validator service. */ public function __construct(PrivateTempStoreFactory $temp_store_factory, ModuleHandlerInterface $module_handler, EntityStorageInterface $node_type_storage, ValidatorInterface $validator) { @@ -165,7 +165,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) { // @todo: Improve this in https://www.drupal.org/node/2395831. $typed_entity = $entity->getTypedData(); $violations = $this->validator - ->validateValue($entity, $typed_entity->getConstraints()); + ->validate($entity, $typed_entity->getConstraints()); foreach ($violations as $violation) { $form_state->setErrorByName($violation->getPropertyPath(), $violation->getMessage()); diff --git a/core/modules/user/src/Plugin/Validation/Constraint/UserMailRequired.php b/core/modules/user/src/Plugin/Validation/Constraint/UserMailRequired.php index 76bc17d..6e9fa3b 100644 --- a/core/modules/user/src/Plugin/Validation/Constraint/UserMailRequired.php +++ b/core/modules/user/src/Plugin/Validation/Constraint/UserMailRequired.php @@ -8,6 +8,7 @@ namespace Drupal\user\Plugin\Validation\Constraint; use Drupal\Component\Utility\SafeMarkup; +use Drupal\Core\TypedData\Validation\TypedDataAwareValidatorTrait; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidatorInterface; use Symfony\Component\Validator\ExecutionContextInterface; @@ -58,7 +59,7 @@ public function validatedBy() { public function validate($items, Constraint $constraint) { /** @var \Drupal\Core\Field\FieldItemListInterface $items */ /** @var \Drupal\user\UserInterface $account */ - $account = $this->context->getMetadata()->getTypedData()->getEntity(); + $account = $items->getEntity(); $existing_value = NULL; if ($account->id()) { $account_unchanged = \Drupal::entityManager() diff --git a/core/modules/user/src/Tests/UserValidationTest.php b/core/modules/user/src/Tests/UserValidationTest.php index ec44a79..172b79d 100644 --- a/core/modules/user/src/Tests/UserValidationTest.php +++ b/core/modules/user/src/Tests/UserValidationTest.php @@ -122,9 +122,9 @@ function testValidation() { // https://drupal.org/node/2023465. $this->assertEqual(count($violations), 2, 'Violations found when email is too long'); $this->assertEqual($violations[0]->getPropertyPath(), 'mail.0.value'); - $this->assertEqual($violations[0]->getMessage(), t('%name: the email address can not be longer than @max characters.', array('%name' => $user->get('mail')->getFieldDefinition()->getLabel(), '@max' => Email::EMAIL_MAX_LENGTH))); + $this->assertEqual($violations[0]->getMessage(), t('This value is not a valid email address.')); $this->assertEqual($violations[1]->getPropertyPath(), 'mail.0.value'); - $this->assertEqual($violations[1]->getMessage(), t('This value is not a valid email address.')); + $this->assertEqual($violations[1]->getMessage(), t('%name: the email address can not be longer than @max characters.', array('%name' => $user->get('mail')->getFieldDefinition()->getLabel(), '@max' => Email::EMAIL_MAX_LENGTH))); // Provoke an email collision with an existing user. $user->set('mail', 'existing@example.com'); diff --git a/core/tests/Drupal/Tests/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidatorTest.php b/core/tests/Drupal/Tests/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidatorTest.php index 0e90672..3a73b60 100644 --- a/core/tests/Drupal/Tests/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidatorTest.php +++ b/core/tests/Drupal/Tests/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidatorTest.php @@ -24,7 +24,7 @@ class PrimitiveTypeConstraintValidatorTest extends UnitTestCase { * @dataProvider provideTestValidate */ public function testValidate(PrimitiveInterface $typed_data, $value, $valid) { - $metadata = $this->getMockBuilder('Drupal\Core\TypedData\Validation\Metadata') + $metadata = $this->getMockBuilder('Drupal\Core\TypedData\Validation\GenericMetadata') ->disableOriginalConstructor() ->getMock(); $metadata->expects($this->any()) diff --git a/core/vendor/composer/autoload_namespaces.php b/core/vendor/composer/autoload_namespaces.php index d21e1be..577e2ef9 100644 --- a/core/vendor/composer/autoload_namespaces.php +++ b/core/vendor/composer/autoload_namespaces.php @@ -9,7 +9,6 @@ 'org\\bovigo\\vfs\\' => array($vendorDir . '/mikey179/vfsStream/src/main/php'), 'Twig_' => array($vendorDir . '/twig/twig/lib'), 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), - 'Symfony\\Component\\Validator\\' => array($vendorDir . '/symfony/validator'), 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), 'Symfony\\Component\\Serializer\\' => array($vendorDir . '/symfony/serializer'), 'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'), diff --git a/core/vendor/composer/installed.json b/core/vendor/composer/installed.json index 921f06e..03a6705 100644 --- a/core/vendor/composer/installed.json +++ b/core/vendor/composer/installed.json @@ -2711,80 +2711,6 @@ "homepage": "http://symfony.com" }, { - "name": "symfony/validator", - "version": "v2.6.6", - "version_normalized": "2.6.6.0", - "target-dir": "Symfony/Component/Validator", - "source": { - "type": "git", - "url": "https://github.com/symfony/Validator.git", - "reference": "85d9b42fe71bf88e7a1e5dec2094605dc9fbff28" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Validator/zipball/85d9b42fe71bf88e7a1e5dec2094605dc9fbff28", - "reference": "85d9b42fe71bf88e7a1e5dec2094605dc9fbff28", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "symfony/translation": "~2.0,>=2.0.5" - }, - "require-dev": { - "doctrine/annotations": "~1.0", - "doctrine/cache": "~1.0", - "doctrine/common": "~2.3", - "egulias/email-validator": "~1.2,>=1.2.1", - "symfony/config": "~2.2", - "symfony/expression-language": "~2.4", - "symfony/http-foundation": "~2.1", - "symfony/intl": "~2.3", - "symfony/phpunit-bridge": "~2.7", - "symfony/property-access": "~2.3", - "symfony/yaml": "~2.0,>=2.0.5" - }, - "suggest": { - "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", - "doctrine/cache": "For using the default cached annotation reader and metadata cache.", - "egulias/email-validator": "Strict (RFC compliant) email validation", - "symfony/config": "", - "symfony/expression-language": "For using the 2.4 Expression validator", - "symfony/http-foundation": "", - "symfony/intl": "", - "symfony/property-access": "For using the 2.4 Validator API", - "symfony/yaml": "" - }, - "time": "2015-03-30 15:54:10", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Symfony\\Component\\Validator\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Validator Component", - "homepage": "http://symfony.com" - }, - { "name": "symfony/process", "version": "v2.6.6", "version_normalized": "2.6.6.0", @@ -3156,5 +3082,17 @@ "feed", "zf2" ] + }, + { + "name": "symfony/validator", + "version": "2.7.0-dev", + "version_normalized": "2.7.0.0-dev", + "source": { + "type": "git", + "url": "git@github.com:fago/Validator.git", + "reference": "drupal-8.0.x" + }, + "type": "library", + "installation-source": "source" } ] diff --git a/core/vendor/symfony/validator/.gitignore b/core/vendor/symfony/validator/.gitignore new file mode 100644 index 0000000..c49a5d8 --- /dev/null +++ b/core/vendor/symfony/validator/.gitignore @@ -0,0 +1,3 @@ +vendor/ +composer.lock +phpunit.xml diff --git a/core/vendor/symfony/validator/CHANGELOG.md b/core/vendor/symfony/validator/CHANGELOG.md new file mode 100644 index 0000000..dc925b7 --- /dev/null +++ b/core/vendor/symfony/validator/CHANGELOG.md @@ -0,0 +1,164 @@ +CHANGELOG +========= + +2.7.0 +----- + + * deprecated `DefaultTranslator` in favor of `Symfony\Component\Translation\IdentityTranslator` + +2.6.0 +----- + + * [BC BREAK] `FileValidator` disallow empty files + * [BC BREAK] `UserPasswordValidator` source message change + * [BC BREAK] added internal `ExecutionContextInterface::setConstraint()` + * added `ConstraintViolation::getConstraint()` + * [BC BREAK] The `ExpressionValidator` will now evaluate the Expression even when the property value is null or an empty string + * deprecated `ClassMetadata::hasMemberMetadatas()` + * deprecated `ClassMetadata::getMemberMetadatas()` + * deprecated `ClassMetadata::addMemberMetadata()` + * [BC BREAK] added `Mapping\MetadataInterface::getConstraints()` + * added generic "payload" option to all constraints for attaching domain-specific data + * [BC BREAK] added `ConstraintViolationBuilderInterface::setCause()` + +2.5.0 +----- + + * deprecated `ApcCache` in favor of `DoctrineCache` + * added `DoctrineCache` to adapt any Doctrine cache + * `GroupSequence` now implements `ArrayAccess`, `Countable` and `Traversable` + * [BC BREAK] changed `ClassMetadata::getGroupSequence()` to return a `GroupSequence` instance instead of an array + * `Callback` can now be put onto properties (useful when you pass a closure to the constraint) + * deprecated `ClassBasedInterface` + * deprecated `MetadataInterface` + * deprecated `PropertyMetadataInterface` + * deprecated `PropertyMetadataContainerInterface` + * deprecated `Mapping\ElementMetadata` + * added `Mapping\MetadataInterface` + * added `Mapping\ClassMetadataInterface` + * added `Mapping\PropertyMetadataInterface` + * added `Mapping\GenericMetadata` + * added `Mapping\CascadingStrategy` + * added `Mapping\TraversalStrategy` + * deprecated `Mapping\ClassMetadata::accept()` + * deprecated `Mapping\MemberMetadata::accept()` + * removed array type hint of `Mapping\ClassMetadata::setGroupSequence()` + * deprecated `MetadataFactoryInterface` + * deprecated `Mapping\BlackholeMetadataFactory` + * deprecated `Mapping\ClassMetadataFactory` + * added `Mapping\Factory\MetadataFactoryInterface` + * added `Mapping\Factory\BlackHoleMetadataFactory` + * added `Mapping\Factory\LazyLoadingMetadataFactory` + * deprecated `ExecutionContextInterface` + * deprecated `ExecutionContext` + * deprecated `GlobalExecutionContextInterface` + * added `Context\ExecutionContextInterface` + * added `Context\ExecutionContext` + * added `Context\ExecutionContextFactoryInterface` + * added `Context\ExecutionContextFactory` + * deprecated `ValidatorInterface` + * deprecated `Validator` + * deprecated `ValidationVisitorInterface` + * deprecated `ValidationVisitor` + * added `Validator\ValidatorInterface` + * added `Validator\RecursiveValidator` + * added `Validator\ContextualValidatorInterface` + * added `Validator\RecursiveContextualValidator` + * added `Violation\ConstraintViolationBuilderInterface` + * added `Violation\ConstraintViolationBuilder` + * added `ConstraintViolation::getParameters()` + * added `ConstraintViolation::getPlural()` + * added `Constraints\Traverse` + * deprecated `$deep` property in `Constraints\Valid` + * added `ValidatorBuilderInterface::setApiVersion()` + * added `Validation::API_VERSION_2_4` + * added `Validation::API_VERSION_2_5` + * added `Exception\OutOfBoundsException` + * added `Exception\UnsupportedMetadataException` + * made `Exception\ValidatorException` extend `Exception\RuntimeException` + * added `Util\PropertyPath` + * made the PropertyAccess component an optional dependency + * deprecated `ValidatorBuilder::setPropertyAccessor()` + * deprecated `validate` and `validateValue` on `Validator\Context\ExecutionContext` use `getValidator()` together with `inContext()` instead + +2.4.0 +----- + + * added a constraint the uses the expression language + * added `minRatio`, `maxRatio`, `allowSquare`, `allowLandscape`, and `allowPortrait` to Image validator + +2.3.0 +----- + + * added the ISBN, ISSN, and IBAN validators + * copied the constraints `Optional` and `Required` to the + `Symfony\Component\Validator\Constraints\` namespace and deprecated the original + classes. + * added comparison validators (EqualTo, NotEqualTo, LessThan, LessThanOrEqualTo, GreaterThan, GreaterThanOrEqualTo, IdenticalTo, NotIdenticalTo) + +2.2.0 +----- + + * added a CardScheme validator + * added a Luhn validator + * moved @api-tags from `Validator` to `ValidatorInterface` + * moved @api-tags from `ConstraintViolation` to the new `ConstraintViolationInterface` + * moved @api-tags from `ConstraintViolationList` to the new `ConstraintViolationListInterface` + * moved @api-tags from `ExecutionContext` to the new `ExecutionContextInterface` + * [BC BREAK] `ConstraintValidatorInterface::initialize` is now type hinted against `ExecutionContextInterface` instead of `ExecutionContext` + * [BC BREAK] changed the visibility of the properties in `Validator` from protected to private + * deprecated `ClassMetadataFactoryInterface` in favor of the new `MetadataFactoryInterface` + * deprecated `ClassMetadataFactory::getClassMetadata` in favor of `getMetadataFor` + * created `MetadataInterface`, `PropertyMetadataInterface`, `ClassBasedInterface` and `PropertyMetadataContainerInterface` + * deprecated `GraphWalker` in favor of the new `ValidationVisitorInterface` + * deprecated `ExecutionContext::addViolationAtPath` + * deprecated `ExecutionContext::addViolationAtSubPath` in favor of `ExecutionContextInterface::addViolationAt` + * deprecated `ExecutionContext::getCurrentClass` in favor of `ExecutionContextInterface::getClassName` + * deprecated `ExecutionContext::getCurrentProperty` in favor of `ExecutionContextInterface::getPropertyName` + * deprecated `ExecutionContext::getCurrentValue` in favor of `ExecutionContextInterface::getValue` + * deprecated `ExecutionContext::getGraphWalker` in favor of `ExecutionContextInterface::validate` and `ExecutionContextInterface::validateValue` + * improved `ValidatorInterface::validateValue` to accept arrays of constraints + * changed `ValidatorInterface::getMetadataFactory` to return a `MetadataFactoryInterface` instead of a `ClassMetadataFactoryInterface` + * removed `ClassMetadataFactoryInterface` type hint from `ValidatorBuilderInterface::setMetadataFactory`. + As of Symfony 2.3, this method will be typed against `MetadataFactoryInterface` instead. + * [BC BREAK] the switches `traverse` and `deep` in the `Valid` constraint and in `GraphWalker::walkReference` + are ignored for arrays now. Arrays are always traversed recursively. + * added dependency to Translation component + * violation messages are now translated with a TranslatorInterface implementation + * [BC BREAK] inserted argument `$message` in the constructor of `ConstraintViolation` + * [BC BREAK] inserted arguments `$translator` and `$translationDomain` in the constructor of `ExecutionContext` + * [BC BREAK] inserted arguments `$translator` and `$translationDomain` in the constructor of `GraphWalker` + * [BC BREAK] inserted arguments `$translator` and `$translationDomain` in the constructor of `ValidationVisitor` + * [BC BREAK] inserted arguments `$translator` and `$translationDomain` in the constructor of `Validator` + * [BC BREAK] added `setTranslator()` and `setTranslationDomain()` to `ValidatorBuilderInterface` + * improved the Validator to support pluralized messages by default + * [BC BREAK] changed the source of all pluralized messages in the translation files to the pluralized version + * added ExceptionInterface, BadMethodCallException and InvalidArgumentException + +2.1.0 +----- + + * added support for `ctype_*` assertions in `TypeValidator` + * improved the ImageValidator with min width, max width, min height, and max height constraints + * added support for MIME with wildcard in FileValidator + * changed Collection validator to add "missing" and "extra" errors to + individual fields + * changed default value for `extraFieldsMessage` and `missingFieldsMessage` + in Collection constraint + * made ExecutionContext immutable + * deprecated Constraint methods `setMessage`, `getMessageTemplate` and + `getMessageParameters` + * added support for dynamic group sequences with the GroupSequenceProvider pattern + * [BC BREAK] ConstraintValidatorInterface method `isValid` has been renamed to + `validate`, its return value was dropped. ConstraintValidator still contains + `isValid` for BC + * [BC BREAK] collections in fields annotated with `Valid` are not traversed + recursively anymore by default. `Valid` contains a new property `deep` + which enables the BC behavior. + * added Count constraint + * added Length constraint + * added Range constraint + * deprecated the Min and Max constraints + * deprecated the MinLength and MaxLength constraints + * added Validation and ValidatorBuilderInterface + * deprecated ValidatorContext, ValidatorContextInterface and ValidatorFactory diff --git a/core/vendor/symfony/validator/ClassBasedInterface.php b/core/vendor/symfony/validator/ClassBasedInterface.php new file mode 100644 index 0000000..7c2eb8f --- /dev/null +++ b/core/vendor/symfony/validator/ClassBasedInterface.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * An object backed by a PHP class. + * + * @author Bernhard Schussek + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link Mapping\ClassMetadataInterface} instead. + */ +interface ClassBasedInterface +{ + /** + * Returns the name of the backing PHP class. + * + * @return string The name of the backing class. + */ + public function getClassName(); +} diff --git a/core/vendor/symfony/validator/Constraint.php b/core/vendor/symfony/validator/Constraint.php new file mode 100644 index 0000000..ad86f44 --- /dev/null +++ b/core/vendor/symfony/validator/Constraint.php @@ -0,0 +1,321 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\InvalidArgumentException; +use Symfony\Component\Validator\Exception\InvalidOptionsException; +use Symfony\Component\Validator\Exception\MissingOptionsException; + +/** + * Contains the properties of a constraint definition. + * + * A constraint can be defined on a class, an option or a getter method. + * The Constraint class encapsulates all the configuration required for + * validating this class, option or getter result successfully. + * + * Constraint instances are immutable and serializable. + * + * @property array $groups The groups that the constraint belongs to + * + * @author Bernhard Schussek + * + * @api + */ +abstract class Constraint +{ + /** + * The name of the group given to all constraints with no explicit group. + * + * @var string + */ + const DEFAULT_GROUP = 'Default'; + + /** + * Marks a constraint that can be put onto classes. + * + * @var string + */ + const CLASS_CONSTRAINT = 'class'; + + /** + * Marks a constraint that can be put onto properties. + * + * @var string + */ + const PROPERTY_CONSTRAINT = 'property'; + + /** + * Maps error codes to the names of their constants + * @var array + */ + protected static $errorNames = array(); + + /** + * Domain-specific data attached to a constraint + * @var mixed + */ + public $payload; + + /** + * Returns the name of the given error code. + * + * @param int $errorCode The error code + * + * @return string The name of the error code + * + * @throws InvalidArgumentException If the error code does not exist + */ + public static function getErrorName($errorCode) + { + if (!isset(static::$errorNames[$errorCode])) { + throw new InvalidArgumentException(sprintf( + 'The error code "%s" does not exist for constraint of type "%s".', + $errorCode, + get_called_class() + )); + } + + return static::$errorNames[$errorCode]; + } + + /** + * Initializes the constraint with options. + * + * You should pass an associative array. The keys should be the names of + * existing properties in this class. The values should be the value for these + * properties. + * + * Alternatively you can override the method getDefaultOption() to return the + * name of an existing property. If no associative array is passed, this + * property is set instead. + * + * You can force that certain options are set by overriding + * getRequiredOptions() to return the names of these options. If any + * option is not set here, an exception is thrown. + * + * @param mixed $options The options (as associative array) + * or the value for the default + * option (any other type) + * + * @throws InvalidOptionsException When you pass the names of non-existing + * options + * @throws MissingOptionsException When you don't pass any of the options + * returned by getRequiredOptions() + * @throws ConstraintDefinitionException When you don't pass an associative + * array, but getDefaultOption() returns + * null + * + * @api + */ + public function __construct($options = null) + { + $invalidOptions = array(); + $missingOptions = array_flip((array) $this->getRequiredOptions()); + $knownOptions = get_object_vars($this); + + // The "groups" option is added to the object lazily + $knownOptions['groups'] = true; + + if (is_array($options) && count($options) >= 1 && isset($options['value']) && !property_exists($this, 'value')) { + $options[$this->getDefaultOption()] = $options['value']; + unset($options['value']); + } + + if (is_array($options) && count($options) > 0 && is_string(key($options))) { + foreach ($options as $option => $value) { + if (array_key_exists($option, $knownOptions)) { + $this->$option = $value; + unset($missingOptions[$option]); + } else { + $invalidOptions[] = $option; + } + } + } elseif (null !== $options && !(is_array($options) && count($options) === 0)) { + $option = $this->getDefaultOption(); + + if (null === $option) { + throw new ConstraintDefinitionException( + sprintf('No default option is configured for constraint %s', get_class($this)) + ); + } + + if (array_key_exists($option, $knownOptions)) { + $this->$option = $options; + unset($missingOptions[$option]); + } else { + $invalidOptions[] = $option; + } + } + + if (count($invalidOptions) > 0) { + throw new InvalidOptionsException( + sprintf('The options "%s" do not exist in constraint %s', implode('", "', $invalidOptions), get_class($this)), + $invalidOptions + ); + } + + if (count($missingOptions) > 0) { + throw new MissingOptionsException( + sprintf('The options "%s" must be set for constraint %s', implode('", "', array_keys($missingOptions)), get_class($this)), + array_keys($missingOptions) + ); + } + } + + /** + * Sets the value of a lazily initialized option. + * + * Corresponding properties are added to the object on first access. Hence + * this method will be called at most once per constraint instance and + * option name. + * + * @param string $option The option name + * @param mixed $value The value to set + * + * @throws InvalidOptionsException If an invalid option name is given + */ + public function __set($option, $value) + { + if ('groups' === $option) { + $this->groups = (array) $value; + + return; + } + + throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, get_class($this)), array($option)); + } + + /** + * Returns the value of a lazily initialized option. + * + * Corresponding properties are added to the object on first access. Hence + * this method will be called at most once per constraint instance and + * option name. + * + * @param string $option The option name + * + * @return mixed The value of the option + * + * @throws InvalidOptionsException If an invalid option name is given + * + * @internal This method should not be used or overwritten in userland code. + * + * @since 2.6 + */ + public function __get($option) + { + if ('groups' === $option) { + $this->groups = array(self::DEFAULT_GROUP); + + return $this->groups; + } + + throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, get_class($this)), array($option)); + } + + /** + * Adds the given group if this constraint is in the Default group. + * + * @param string $group + * + * @api + */ + public function addImplicitGroupName($group) + { + if (in_array(self::DEFAULT_GROUP, $this->groups) && !in_array($group, $this->groups)) { + $this->groups[] = $group; + } + } + + /** + * Returns the name of the default option. + * + * Override this method to define a default option. + * + * @return string + * + * @see __construct() + * + * @api + */ + public function getDefaultOption() + { + } + + /** + * Returns the name of the required options. + * + * Override this method if you want to define required options. + * + * @return array + * + * @see __construct() + * + * @api + */ + public function getRequiredOptions() + { + return array(); + } + + /** + * Returns the name of the class that validates this constraint. + * + * By default, this is the fully qualified name of the constraint class + * suffixed with "Validator". You can override this method to change that + * behaviour. + * + * @return string + * + * @api + */ + public function validatedBy() + { + return get_class($this).'Validator'; + } + + /** + * Returns whether the constraint can be put onto classes, properties or + * both. + * + * This method should return one or more of the constants + * Constraint::CLASS_CONSTRAINT and Constraint::PROPERTY_CONSTRAINT. + * + * @return string|array One or more constant values + * + * @api + */ + public function getTargets() + { + return self::PROPERTY_CONSTRAINT; + } + + /** + * Optimizes the serialized value to minimize storage space. + * + * @return array The properties to serialize + * + * @internal This method may be replaced by an implementation of + * {@link \Serializable} in the future. Please don't use or + * overwrite it. + * + * @since 2.6 + */ + public function __sleep() + { + // Initialize "groups" option if it is not set + $this->groups; + + return array_keys(get_object_vars($this)); + } +} diff --git a/core/vendor/symfony/validator/ConstraintValidator.php b/core/vendor/symfony/validator/ConstraintValidator.php new file mode 100644 index 0000000..7a41273 --- /dev/null +++ b/core/vendor/symfony/validator/ConstraintValidator.php @@ -0,0 +1,220 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +use Symfony\Component\Validator\Context\ExecutionContextInterface as ExecutionContextInterface2Dot5; +use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface; +use Symfony\Component\Validator\Violation\LegacyConstraintViolationBuilder; + +/** + * Base class for constraint validators. + * + * @author Bernhard Schussek + * + * @api + */ +abstract class ConstraintValidator implements ConstraintValidatorInterface +{ + /** + * Whether to format {@link \DateTime} objects as RFC-3339 dates + * ("Y-m-d H:i:s"). + * + * @var int + */ + const PRETTY_DATE = 1; + + /** + * Whether to cast objects with a "__toString()" method to strings. + * + * @var int + */ + const OBJECT_TO_STRING = 2; + + /** + * @var ExecutionContextInterface + */ + protected $context; + + /** + * {@inheritdoc} + */ + public function initialize(ExecutionContextInterface $context) + { + $this->context = $context; + } + + /** + * Wrapper for {@link ExecutionContextInterface::buildViolation} that + * supports the 2.4 context API. + * + * @param string $message The violation message + * @param array $parameters The message parameters + * + * @return ConstraintViolationBuilderInterface The violation builder + * + * @deprecated since version 2.5, to be removed in 3.0. + */ + protected function buildViolation($message, array $parameters = array()) + { + trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); + + if ($this->context instanceof ExecutionContextInterface2Dot5) { + return $this->context->buildViolation($message, $parameters); + } + + return new LegacyConstraintViolationBuilder($this->context, $message, $parameters); + } + + /** + * Wrapper for {@link ExecutionContextInterface::buildViolation} that + * supports the 2.4 context API. + * + * @param ExecutionContextInterface $context The context to use + * @param string $message The violation message + * @param array $parameters The message parameters + * + * @return ConstraintViolationBuilderInterface The violation builder + * + * @deprecated since version 2.5, to be removed in 3.0. + */ + protected function buildViolationInContext(ExecutionContextInterface $context, $message, array $parameters = array()) + { + trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); + + if ($context instanceof ExecutionContextInterface2Dot5) { + return $context->buildViolation($message, $parameters); + } + + return new LegacyConstraintViolationBuilder($context, $message, $parameters); + } + + /** + * Returns a string representation of the type of the value. + * + * This method should be used if you pass the type of a value as + * message parameter to a constraint violation. Note that such + * parameters should usually not be included in messages aimed at + * non-technical people. + * + * @param mixed $value The value to return the type of + * + * @return string The type of the value + */ + protected function formatTypeOf($value) + { + return is_object($value) ? get_class($value) : gettype($value); + } + + /** + * Returns a string representation of the value. + * + * This method returns the equivalent PHP tokens for most scalar types + * (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped + * in double quotes ("). Objects, arrays and resources are formatted as + * "object", "array" and "resource". If the parameter $prettyDateTime + * is set to true, {@link \DateTime} objects will be formatted as + * RFC-3339 dates ("Y-m-d H:i:s"). + * + * Be careful when passing message parameters to a constraint violation + * that (may) contain objects, arrays or resources. These parameters + * should only be displayed for technical users. Non-technical users + * won't know what an "object", "array" or "resource" is and will be + * confused by the violation message. + * + * @param mixed $value The value to format as string + * @param int $format A bitwise combination of the format + * constants in this class + * + * @return string The string representation of the passed value + */ + protected function formatValue($value, $format = 0) + { + $isDateTime = $value instanceof \DateTime || $value instanceof \DateTimeInterface; + + if (($format & self::PRETTY_DATE) && $isDateTime) { + if (class_exists('IntlDateFormatter')) { + $locale = \Locale::getDefault(); + $formatter = new \IntlDateFormatter($locale, \IntlDateFormatter::MEDIUM, \IntlDateFormatter::SHORT); + + // neither the native nor the stub IntlDateFormatter support + // DateTimeImmutable as of yet + if (!$value instanceof \DateTime) { + $value = new \DateTime( + $value->format('Y-m-d H:i:s.u e'), + $value->getTimezone() + ); + } + + return $formatter->format($value); + } + + return $value->format('Y-m-d H:i:s'); + } + + if (is_object($value)) { + if ($format & self::OBJECT_TO_STRING && method_exists($value, '__toString')) { + return $value->__toString(); + } + + return 'object'; + } + + if (is_array($value)) { + return 'array'; + } + + if (is_string($value)) { + return '"'.$value.'"'; + } + + if (is_resource($value)) { + return 'resource'; + } + + if (null === $value) { + return 'null'; + } + + if (false === $value) { + return 'false'; + } + + if (true === $value) { + return 'true'; + } + + return (string) $value; + } + + /** + * Returns a string representation of a list of values. + * + * Each of the values is converted to a string using + * {@link formatValue()}. The values are then concatenated with commas. + * + * @param array $values A list of values + * @param int $format A bitwise combination of the format + * constants in this class + * + * @return string The string representation of the value list + * + * @see formatValue() + */ + protected function formatValues(array $values, $format = 0) + { + foreach ($values as $key => $value) { + $values[$key] = $this->formatValue($value, $format); + } + + return implode(', ', $values); + } +} diff --git a/core/vendor/symfony/validator/ConstraintValidatorFactory.php b/core/vendor/symfony/validator/ConstraintValidatorFactory.php new file mode 100644 index 0000000..cc6981b --- /dev/null +++ b/core/vendor/symfony/validator/ConstraintValidatorFactory.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +use Symfony\Component\Validator\Constraints\ExpressionValidator; + +/** + * Default implementation of the ConstraintValidatorFactoryInterface. + * + * This enforces the convention that the validatedBy() method on any + * Constraint will return the class name of the ConstraintValidator that + * should validate the Constraint. + * + * @author Bernhard Schussek + */ +class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface +{ + protected $validators = array(); + + private $propertyAccessor; + + public function __construct($propertyAccessor = null) + { + $this->propertyAccessor = $propertyAccessor; + } + + /** + * {@inheritdoc} + */ + public function getInstance(Constraint $constraint) + { + $className = $constraint->validatedBy(); + + if (!isset($this->validators[$className])) { + $this->validators[$className] = 'validator.expression' === $className + ? new ExpressionValidator($this->propertyAccessor) + : new $className(); + } + + return $this->validators[$className]; + } +} diff --git a/core/vendor/symfony/validator/ConstraintValidatorFactoryInterface.php b/core/vendor/symfony/validator/ConstraintValidatorFactoryInterface.php new file mode 100644 index 0000000..5e21627 --- /dev/null +++ b/core/vendor/symfony/validator/ConstraintValidatorFactoryInterface.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * Specifies an object able to return the correct ConstraintValidatorInterface + * instance given a Constraint object. + */ +interface ConstraintValidatorFactoryInterface +{ + /** + * Given a Constraint, this returns the ConstraintValidatorInterface + * object that should be used to verify its validity. + * + * @param Constraint $constraint The source constraint + * + * @return ConstraintValidatorInterface + */ + public function getInstance(Constraint $constraint); +} diff --git a/core/vendor/symfony/validator/ConstraintValidatorInterface.php b/core/vendor/symfony/validator/ConstraintValidatorInterface.php new file mode 100644 index 0000000..f7538a1 --- /dev/null +++ b/core/vendor/symfony/validator/ConstraintValidatorInterface.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * @author Bernhard Schussek + * + * @api + */ +interface ConstraintValidatorInterface +{ + /** + * Initializes the constraint validator. + * + * @param ExecutionContextInterface $context The current validation context + */ + public function initialize(ExecutionContextInterface $context); + + /** + * Checks if the passed value is valid. + * + * @param mixed $value The value that should be validated + * @param Constraint $constraint The constraint for the validation + * + * @api + */ + public function validate($value, Constraint $constraint); +} diff --git a/core/vendor/symfony/validator/ConstraintViolation.php b/core/vendor/symfony/validator/ConstraintViolation.php new file mode 100644 index 0000000..7df3f3f --- /dev/null +++ b/core/vendor/symfony/validator/ConstraintViolation.php @@ -0,0 +1,243 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * Default implementation of {@ConstraintViolationInterface}. + * + * @author Bernhard Schussek + */ +class ConstraintViolation implements ConstraintViolationInterface +{ + /** + * @var string + */ + private $message; + + /** + * @var string + */ + private $messageTemplate; + + /** + * @var array + */ + private $parameters; + + /** + * @var int|null + */ + private $plural; + + /** + * @var mixed + */ + private $root; + + /** + * @var string + */ + private $propertyPath; + + /** + * @var mixed + */ + private $invalidValue; + + /** + * @var Constraint|null + */ + private $constraint; + + /** + * @var mixed + */ + private $code; + + /** + * @var mixed + */ + private $cause; + + /** + * Creates a new constraint violation. + * + * @param string $message The violation message + * @param string $messageTemplate The raw violation message + * @param array $parameters The parameters to substitute in the + * raw violation message + * @param mixed $root The value originally passed to the + * validator + * @param string $propertyPath The property path from the root + * value to the invalid value + * @param mixed $invalidValue The invalid value that caused this + * violation + * @param int|null $plural The number for determining the plural + * form when translating the message + * @param mixed $code The error code of the violation + * @param Constraint|null $constraint The constraint whose validation + * caused the violation + * @param mixed $cause The cause of the violation + */ + public function __construct($message, $messageTemplate, array $parameters, $root, $propertyPath, $invalidValue, $plural = null, $code = null, Constraint $constraint = null, $cause = null) + { + $this->message = $message; + $this->messageTemplate = $messageTemplate; + $this->parameters = $parameters; + $this->plural = $plural; + $this->root = $root; + $this->propertyPath = $propertyPath; + $this->invalidValue = $invalidValue; + $this->constraint = $constraint; + $this->code = $code; + $this->cause = $cause; + } + + /** + * Converts the violation into a string for debugging purposes. + * + * @return string The violation as string. + */ + public function __toString() + { + if (is_object($this->root)) { + $class = 'Object('.get_class($this->root).')'; + } elseif (is_array($this->root)) { + $class = 'Array'; + } else { + $class = (string) $this->root; + } + + $propertyPath = (string) $this->propertyPath; + $code = $this->code; + + if ('' !== $propertyPath && '[' !== $propertyPath[0] && '' !== $class) { + $class .= '.'; + } + + if (!empty($code)) { + $code = ' (code '.$code.')'; + } + + return $class.$propertyPath.":\n ".$this->getMessage().$code; + } + + /** + * {@inheritdoc} + */ + public function getMessageTemplate() + { + return $this->messageTemplate; + } + + /** + * {@inheritdoc} + * + * @deprecated since version 2.7, to be removed in 3.0. + * Use getParameters() instead + */ + public function getMessageParameters() + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.7, to be removed in 3.0. Use the ConstraintViolation::getParameters() method instead.', E_USER_DEPRECATED); + + return $this->parameters; + } + + /** + * Alias of {@link getMessageParameters()}. + */ + public function getParameters() + { + return $this->parameters; + } + + /** + * {@inheritdoc} + * + * @deprecated since version 2.7, to be removed in 3.0. + * Use getPlural() instead + */ + public function getMessagePluralization() + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.7, to be removed in 3.0. Use the ConstraintViolation::getPlural() method instead.', E_USER_DEPRECATED); + + return $this->plural; + } + + /** + * Alias of {@link getMessagePluralization()}. + */ + public function getPlural() + { + return $this->plural; + } + + /** + * {@inheritdoc} + */ + public function getMessage() + { + return $this->message; + } + + /** + * {@inheritdoc} + */ + public function getRoot() + { + return $this->root; + } + + /** + * {@inheritdoc} + */ + public function getPropertyPath() + { + return $this->propertyPath; + } + + /** + * {@inheritdoc} + */ + public function getInvalidValue() + { + return $this->invalidValue; + } + + /** + * Returns the constraint whose validation caused the violation. + * + * @return Constraint|null The constraint or null if it is not known + */ + public function getConstraint() + { + return $this->constraint; + } + + /** + * Returns the cause of the violation. + * + * @return mixed + */ + public function getCause() + { + return $this->cause; + } + + /** + * {@inheritdoc} + */ + public function getCode() + { + return $this->code; + } +} diff --git a/core/vendor/symfony/validator/ConstraintViolationInterface.php b/core/vendor/symfony/validator/ConstraintViolationInterface.php new file mode 100644 index 0000000..232fb55 --- /dev/null +++ b/core/vendor/symfony/validator/ConstraintViolationInterface.php @@ -0,0 +1,136 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * A violation of a constraint that happened during validation. + * + * For each constraint that fails during validation one or more violations are + * created. The violations store the violation message, the path to the failing + * element in the validation graph and the root element that was originally + * passed to the validator. For example, take the following graph: + * + *
+ * (Person)---(firstName: string)
+ *      \
+ *   (address: Address)---(street: string)
+ * 
+ * + * If the Person object is validated and validation fails for the + * "firstName" property, the generated violation has the Person + * instance as root and the property path "firstName". If validation fails + * for the "street" property of the related Address instance, the root + * element is still the person, but the property path is "address.street". + * + * @author Bernhard Schussek + * + * @api + */ +interface ConstraintViolationInterface +{ + /** + * Returns the violation message. + * + * @return string The violation message. + * + * @api + */ + public function getMessage(); + + /** + * Returns the raw violation message. + * + * The raw violation message contains placeholders for the parameters + * returned by {@link getMessageParameters}. Typically you'll pass the + * message template and parameters to a translation engine. + * + * @return string The raw violation message. + * + * @api + */ + public function getMessageTemplate(); + + /** + * Returns the parameters to be inserted into the raw violation message. + * + * @return array A possibly empty list of parameters indexed by the names + * that appear in the message template. + * + * @see getMessageTemplate() + * + * @api + */ + public function getMessageParameters(); + + /** + * Returns a number for pluralizing the violation message. + * + * For example, the message template could have different translation based + * on a parameter "choices": + * + *
    + *
  • Please select exactly one entry. (choices=1)
  • + *
  • Please select two entries. (choices=2)
  • + *
+ * + * This method returns the value of the parameter for choosing the right + * pluralization form (in this case "choices"). + * + * @return int|null The number to use to pluralize of the message. + */ + public function getMessagePluralization(); + + /** + * Returns the root element of the validation. + * + * @return mixed The value that was passed originally to the validator when + * the validation was started. Because the validator traverses + * the object graph, the value at which the violation occurs + * is not necessarily the value that was originally validated. + * + * @api + */ + public function getRoot(); + + /** + * Returns the property path from the root element to the violation. + * + * @return string The property path indicates how the validator reached + * the invalid value from the root element. If the root + * element is a Person instance with a property + * "address" that contains an Address instance + * with an invalid property "street", the generated property + * path is "address.street". Property access is denoted by + * dots, while array access is denoted by square brackets, + * for example "addresses[1].street". + * + * @api + */ + public function getPropertyPath(); + + /** + * Returns the value that caused the violation. + * + * @return mixed The invalid value that caused the validated constraint to + * fail. + * + * @api + */ + public function getInvalidValue(); + + /** + * Returns a machine-digestible error code for the violation. + * + * @return mixed The error code. + */ + public function getCode(); +} diff --git a/core/vendor/symfony/validator/ConstraintViolationList.php b/core/vendor/symfony/validator/ConstraintViolationList.php new file mode 100644 index 0000000..cccfa86 --- /dev/null +++ b/core/vendor/symfony/validator/ConstraintViolationList.php @@ -0,0 +1,159 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * Default implementation of {@ConstraintViolationListInterface}. + * + * @author Bernhard Schussek + */ +class ConstraintViolationList implements \IteratorAggregate, ConstraintViolationListInterface +{ + /** + * @var ConstraintViolationInterface[] + */ + private $violations = array(); + + /** + * Creates a new constraint violation list. + * + * @param ConstraintViolationInterface[] $violations The constraint violations to add to the list + */ + public function __construct(array $violations = array()) + { + foreach ($violations as $violation) { + $this->add($violation); + } + } + + /** + * Converts the violation into a string for debugging purposes. + * + * @return string The violation as string. + */ + public function __toString() + { + $string = ''; + + foreach ($this->violations as $violation) { + $string .= $violation."\n"; + } + + return $string; + } + + /** + * {@inheritdoc} + */ + public function add(ConstraintViolationInterface $violation) + { + $this->violations[] = $violation; + } + + /** + * {@inheritdoc} + */ + public function addAll(ConstraintViolationListInterface $otherList) + { + foreach ($otherList as $violation) { + $this->violations[] = $violation; + } + } + + /** + * {@inheritdoc} + */ + public function get($offset) + { + if (!isset($this->violations[$offset])) { + throw new \OutOfBoundsException(sprintf('The offset "%s" does not exist.', $offset)); + } + + return $this->violations[$offset]; + } + + /** + * {@inheritdoc} + */ + public function has($offset) + { + return isset($this->violations[$offset]); + } + + /** + * {@inheritdoc} + */ + public function set($offset, ConstraintViolationInterface $violation) + { + $this->violations[$offset] = $violation; + } + + /** + * {@inheritdoc} + */ + public function remove($offset) + { + unset($this->violations[$offset]); + } + + /** + * {@inheritdoc} + */ + public function getIterator() + { + return new \ArrayIterator($this->violations); + } + + /** + * {@inheritdoc} + */ + public function count() + { + return count($this->violations); + } + + /** + * {@inheritdoc} + */ + public function offsetExists($offset) + { + return $this->has($offset); + } + + /** + * {@inheritdoc} + */ + public function offsetGet($offset) + { + return $this->get($offset); + } + + /** + * {@inheritdoc} + */ + public function offsetSet($offset, $violation) + { + if (null === $offset) { + $this->add($violation); + } else { + $this->set($offset, $violation); + } + } + + /** + * {@inheritdoc} + */ + public function offsetUnset($offset) + { + $this->remove($offset); + } +} diff --git a/core/vendor/symfony/validator/ConstraintViolationListInterface.php b/core/vendor/symfony/validator/ConstraintViolationListInterface.php new file mode 100644 index 0000000..088c70c --- /dev/null +++ b/core/vendor/symfony/validator/ConstraintViolationListInterface.php @@ -0,0 +1,83 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * A list of constraint violations. + * + * @author Bernhard Schussek + * + * @api + */ +interface ConstraintViolationListInterface extends \Traversable, \Countable, \ArrayAccess +{ + /** + * Adds a constraint violation to this list. + * + * @param ConstraintViolationInterface $violation The violation to add. + * + * @api + */ + public function add(ConstraintViolationInterface $violation); + + /** + * Merges an existing violation list into this list. + * + * @param ConstraintViolationListInterface $otherList The list to merge. + * + * @api + */ + public function addAll(ConstraintViolationListInterface $otherList); + + /** + * Returns the violation at a given offset. + * + * @param int $offset The offset of the violation. + * + * @return ConstraintViolationInterface The violation. + * + * @throws \OutOfBoundsException If the offset does not exist. + * + * @api + */ + public function get($offset); + + /** + * Returns whether the given offset exists. + * + * @param int $offset The violation offset. + * + * @return bool Whether the offset exists. + * + * @api + */ + public function has($offset); + + /** + * Sets a violation at a given offset. + * + * @param int $offset The violation offset. + * @param ConstraintViolationInterface $violation The violation. + * + * @api + */ + public function set($offset, ConstraintViolationInterface $violation); + + /** + * Removes a violation at a given offset. + * + * @param int $offset The offset to remove. + * + * @api + */ + public function remove($offset); +} diff --git a/core/vendor/symfony/validator/Constraints/AbstractComparison.php b/core/vendor/symfony/validator/Constraints/AbstractComparison.php new file mode 100644 index 0000000..fb1f1f3 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/AbstractComparison.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * Used for the comparison of values. + * + * @author Daniel Holmes + */ +abstract class AbstractComparison extends Constraint +{ + public $message; + public $value; + + /** + * {@inheritdoc} + */ + public function __construct($options = null) + { + if (is_array($options) && !isset($options['value'])) { + throw new ConstraintDefinitionException(sprintf( + 'The %s constraint requires the "value" option to be set.', + get_class($this) + )); + } + + parent::__construct($options); + } + + /** + * {@inheritdoc} + */ + public function getDefaultOption() + { + return 'value'; + } +} diff --git a/core/vendor/symfony/validator/Constraints/AbstractComparisonValidator.php b/core/vendor/symfony/validator/Constraints/AbstractComparisonValidator.php new file mode 100644 index 0000000..67d73a5 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/AbstractComparisonValidator.php @@ -0,0 +1,83 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Provides a base class for the validation of property comparisons. + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +abstract class AbstractComparisonValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof AbstractComparison) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\AbstractComparison'); + } + + if (null === $value) { + return; + } + + $comparedValue = $constraint->value; + + // Convert strings to DateTimes if comparing another DateTime + // This allows to compare with any date/time value supported by + // the DateTime constructor: + // http://php.net/manual/en/datetime.formats.php + if (is_string($comparedValue)) { + if ($value instanceof \DatetimeImmutable) { + // If $value is immutable, convert the compared value to a + // DateTimeImmutable too + $comparedValue = new \DatetimeImmutable($comparedValue); + } elseif ($value instanceof \DateTime || $value instanceof \DateTimeInterface) { + // Otherwise use DateTime + $comparedValue = new \DateTime($comparedValue); + } + } + + if (!$this->compareValues($value, $comparedValue)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value, self::OBJECT_TO_STRING | self::PRETTY_DATE)) + ->setParameter('{{ compared_value }}', $this->formatValue($comparedValue, self::OBJECT_TO_STRING | self::PRETTY_DATE)) + ->setParameter('{{ compared_value_type }}', $this->formatTypeOf($comparedValue)) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value, self::OBJECT_TO_STRING | self::PRETTY_DATE)) + ->setParameter('{{ compared_value }}', $this->formatValue($comparedValue, self::OBJECT_TO_STRING | self::PRETTY_DATE)) + ->setParameter('{{ compared_value_type }}', $this->formatTypeOf($comparedValue)) + ->addViolation(); + } + } + } + + /** + * Compares the two given values to find if their relationship is valid. + * + * @param mixed $value1 The first value to compare + * @param mixed $value2 The second value to compare + * + * @return bool true if the relationship is valid, false otherwise + */ + abstract protected function compareValues($value1, $value2); +} diff --git a/core/vendor/symfony/validator/Constraints/All.php b/core/vendor/symfony/validator/Constraints/All.php new file mode 100644 index 0000000..3250fcf --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/All.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class All extends Composite +{ + public $constraints = array(); + + public function getDefaultOption() + { + return 'constraints'; + } + + public function getRequiredOptions() + { + return array('constraints'); + } + + protected function getCompositeOption() + { + return 'constraints'; + } +} diff --git a/core/vendor/symfony/validator/Constraints/AllValidator.php b/core/vendor/symfony/validator/Constraints/AllValidator.php new file mode 100644 index 0000000..a655afc --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/AllValidator.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + * + * @api + */ +class AllValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof All) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\All'); + } + + if (null === $value) { + return; + } + + if (!is_array($value) && !$value instanceof \Traversable) { + throw new UnexpectedTypeException($value, 'array or Traversable'); + } + + $context = $this->context; + + if ($context instanceof ExecutionContextInterface) { + $validator = $context->getValidator()->inContext($context); + + foreach ($value as $key => $element) { + $validator->atPath('['.$key.']')->validate($element, $constraint->constraints); + } + } else { + // 2.4 API + foreach ($value as $key => $element) { + $context->validateValue($element, $constraint->constraints, '['.$key.']'); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Blank.php b/core/vendor/symfony/validator/Constraints/Blank.php new file mode 100644 index 0000000..766ce6c --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Blank.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class Blank extends Constraint +{ + public $message = 'This value should be blank.'; +} diff --git a/core/vendor/symfony/validator/Constraints/BlankValidator.php b/core/vendor/symfony/validator/Constraints/BlankValidator.php new file mode 100644 index 0000000..2d26e4a --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/BlankValidator.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + * + * @api + */ +class BlankValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Blank) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Blank'); + } + + if ('' !== $value && null !== $value) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Callback.php b/core/vendor/symfony/validator/Constraints/Callback.php new file mode 100644 index 0000000..bb8c076 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Callback.php @@ -0,0 +1,81 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class Callback extends Constraint +{ + /** + * @var string|callable + * + * @since 2.4 + */ + public $callback; + + /** + * @var array + * + * @deprecated since version 2.4, to be removed in 3.0. + */ + public $methods; + + /** + * {@inheritdoc} + */ + public function __construct($options = null) + { + // Invocation through annotations with an array parameter only + if (is_array($options) && 1 === count($options) && isset($options['value'])) { + $options = $options['value']; + } + + if (is_array($options) && isset($options['methods'])) { + trigger_error('The "methods" option of the '.__CLASS__.' class is deprecated since version 2.4 and will be removed in 3.0. Use the "callback" option instead.', E_USER_DEPRECATED); + } + + if (is_array($options) && !isset($options['callback']) && !isset($options['methods']) && !isset($options['groups'])) { + if (is_callable($options) || !$options) { + $options = array('callback' => $options); + } else { + // @deprecated, to be removed in 3.0 + $options = array('methods' => $options); + } + } + + parent::__construct($options); + } + + /** + * {@inheritdoc} + */ + public function getDefaultOption() + { + return 'callback'; + } + + /** + * {@inheritdoc} + */ + public function getTargets() + { + return array(self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT); + } +} diff --git a/core/vendor/symfony/validator/Constraints/CallbackValidator.php b/core/vendor/symfony/validator/Constraints/CallbackValidator.php new file mode 100644 index 0000000..9939306 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/CallbackValidator.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Validator for Callback constraint. + * + * @author Bernhard Schussek + * + * @api + */ +class CallbackValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($object, Constraint $constraint) + { + if (!$constraint instanceof Callback) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Callback'); + } + + if (null !== $constraint->callback && null !== $constraint->methods) { + throw new ConstraintDefinitionException( + 'The Callback constraint supports either the option "callback" '. + 'or "methods", but not both at the same time.' + ); + } + + // has to be an array so that we can differentiate between callables + // and method names + if (null !== $constraint->methods && !is_array($constraint->methods)) { + throw new UnexpectedTypeException($constraint->methods, 'array'); + } + + $methods = $constraint->methods ?: array($constraint->callback); + + foreach ($methods as $method) { + if ($method instanceof \Closure) { + $method($object, $this->context); + } elseif (is_array($method)) { + if (!is_callable($method)) { + throw new ConstraintDefinitionException(sprintf('"%s::%s" targeted by Callback constraint is not a valid callable', $method[0], $method[1])); + } + + call_user_func($method, $object, $this->context); + } elseif (null !== $object) { + if (!method_exists($object, $method)) { + throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist', $method)); + } + + $reflMethod = new \ReflectionMethod($object, $method); + + if ($reflMethod->isStatic()) { + $reflMethod->invoke(null, $object, $this->context); + } else { + $reflMethod->invoke($object, $this->context); + } + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/CardScheme.php b/core/vendor/symfony/validator/Constraints/CardScheme.php new file mode 100644 index 0000000..14f3b5d --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/CardScheme.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * Metadata for the CardSchemeValidator. + * + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Tim Nagel + * @author Bernhard Schussek + */ +class CardScheme extends Constraint +{ + const NOT_NUMERIC_ERROR = 1; + const INVALID_FORMAT_ERROR = 2; + + protected static $errorNames = array( + self::NOT_NUMERIC_ERROR => 'NOT_NUMERIC_ERROR', + self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', + ); + + public $message = 'Unsupported card type or invalid card number.'; + public $schemes; + + public function getDefaultOption() + { + return 'schemes'; + } + + public function getRequiredOptions() + { + return array('schemes'); + } +} diff --git a/core/vendor/symfony/validator/Constraints/CardSchemeValidator.php b/core/vendor/symfony/validator/Constraints/CardSchemeValidator.php new file mode 100644 index 0000000..708ae09 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/CardSchemeValidator.php @@ -0,0 +1,137 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Validates that a card number belongs to a specified scheme. + * + * @author Tim Nagel + * @author Bernhard Schussek + * + * @see http://en.wikipedia.org/wiki/Bank_card_number + * @see http://www.regular-expressions.info/creditcard.html + */ +class CardSchemeValidator extends ConstraintValidator +{ + protected $schemes = array( + // American Express card numbers start with 34 or 37 and have 15 digits. + 'AMEX' => array( + '/^3[47][0-9]{13}$/', + ), + // China UnionPay cards start with 62 and have between 16 and 19 digits. + // Please note that these cards do not follow Luhn Algorithm as a checksum. + 'CHINA_UNIONPAY' => array( + '/^62[0-9]{14,17}$/', + ), + // Diners Club card numbers begin with 300 through 305, 36 or 38. All have 14 digits. + // There are Diners Club cards that begin with 5 and have 16 digits. + // These are a joint venture between Diners Club and MasterCard, and should be processed like a MasterCard. + 'DINERS' => array( + '/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/', + ), + // Discover card numbers begin with 6011, 622126 through 622925, 644 through 649 or 65. + // All have 16 digits. + 'DISCOVER' => array( + '/^6011[0-9]{12}$/', + '/^64[4-9][0-9]{13}$/', + '/^65[0-9]{14}$/', + '/^622(12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|91[0-9]|92[0-5])[0-9]{10}$/', + ), + // InstaPayment cards begin with 637 through 639 and have 16 digits. + 'INSTAPAYMENT' => array( + '/^63[7-9][0-9]{13}$/', + ), + // JCB cards beginning with 2131 or 1800 have 15 digits. + // JCB cards beginning with 35 have 16 digits. + 'JCB' => array( + '/^(?:2131|1800|35[0-9]{3})[0-9]{11}$/', + ), + // Laser cards begin with either 6304, 6706, 6709 or 6771 and have between 16 and 19 digits. + 'LASER' => array( + '/^(6304|670[69]|6771)[0-9]{12,15}$/', + ), + // Maestro cards begin with either 5018, 5020, 5038, 5893, 6304, 6759, 6761, 6762, 6763 or 0604 + // They have between 12 and 19 digits. + 'MAESTRO' => array( + '/^(5018|5020|5038|6304|6759|6761|676[23]|0604)[0-9]{8,15}$/', + ), + // All MasterCard numbers start with the numbers 51 through 55. All have 16 digits. + 'MASTERCARD' => array( + '/^5[1-5][0-9]{14}$/', + ), + // All Visa card numbers start with a 4. New cards have 16 digits. Old cards have 13. + 'VISA' => array( + '/^4([0-9]{12}|[0-9]{15})$/', + ), + ); + + /** + * Validates a creditcard belongs to a specified scheme. + * + * @param mixed $value + * @param Constraint $constraint + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof CardScheme) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\CardScheme'); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_numeric($value)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(CardScheme::NOT_NUMERIC_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(CardScheme::NOT_NUMERIC_ERROR) + ->addViolation(); + } + + return; + } + + $schemes = array_flip((array) $constraint->schemes); + $schemeRegexes = array_intersect_key($this->schemes, $schemes); + + foreach ($schemeRegexes as $regexes) { + foreach ($regexes as $regex) { + if (preg_match($regex, $value)) { + return; + } + } + } + + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(CardScheme::INVALID_FORMAT_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(CardScheme::INVALID_FORMAT_ERROR) + ->addViolation(); + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Choice.php b/core/vendor/symfony/validator/Constraints/Choice.php new file mode 100644 index 0000000..39a6457 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Choice.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class Choice extends Constraint +{ + const NO_SUCH_CHOICE_ERROR = 1; + const TOO_FEW_ERROR = 2; + const TOO_MANY_ERROR = 3; + + protected static $errorNames = array( + self::NO_SUCH_CHOICE_ERROR => 'NO_SUCH_CHOICE_ERROR', + self::TOO_FEW_ERROR => 'TOO_FEW_ERROR', + self::TOO_MANY_ERROR => 'TOO_MANY_ERROR', + ); + + public $choices; + public $callback; + public $multiple = false; + public $strict = false; + public $min; + public $max; + public $message = 'The value you selected is not a valid choice.'; + public $multipleMessage = 'One or more of the given values is invalid.'; + public $minMessage = 'You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.'; + public $maxMessage = 'You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.'; + + /** + * {@inheritdoc} + */ + public function getDefaultOption() + { + return 'choices'; + } +} diff --git a/core/vendor/symfony/validator/Constraints/ChoiceValidator.php b/core/vendor/symfony/validator/Constraints/ChoiceValidator.php new file mode 100644 index 0000000..1afc22b --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/ChoiceValidator.php @@ -0,0 +1,135 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * ChoiceValidator validates that the value is one of the expected values. + * + * @author Fabien Potencier + * @author Florian Eckerstorfer + * @author Bernhard Schussek + * + * @api + */ +class ChoiceValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Choice) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Choice'); + } + + if (!$constraint->choices && !$constraint->callback) { + throw new ConstraintDefinitionException('Either "choices" or "callback" must be specified on constraint Choice'); + } + + if (null === $value) { + return; + } + + if ($constraint->multiple && !is_array($value)) { + throw new UnexpectedTypeException($value, 'array'); + } + + if ($constraint->callback) { + if (!is_callable($choices = array($this->context->getClassName(), $constraint->callback)) + && !is_callable($choices = $constraint->callback) + ) { + throw new ConstraintDefinitionException('The Choice constraint expects a valid callback'); + } + $choices = call_user_func($choices); + } else { + $choices = $constraint->choices; + } + + if ($constraint->multiple) { + foreach ($value as $_value) { + if (!in_array($_value, $choices, $constraint->strict)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->multipleMessage) + ->setParameter('{{ value }}', $this->formatValue($_value)) + ->setCode(Choice::NO_SUCH_CHOICE_ERROR) + ->setInvalidValue($_value) + ->addViolation(); + } else { + $this->buildViolation($constraint->multipleMessage) + ->setParameter('{{ value }}', $this->formatValue($_value)) + ->setCode(Choice::NO_SUCH_CHOICE_ERROR) + ->setInvalidValue($_value) + ->addViolation(); + } + + return; + } + } + + $count = count($value); + + if ($constraint->min !== null && $count < $constraint->min) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->minMessage) + ->setParameter('{{ limit }}', $constraint->min) + ->setPlural((int) $constraint->min) + ->setCode(Choice::TOO_FEW_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->minMessage) + ->setParameter('{{ limit }}', $constraint->min) + ->setPlural((int) $constraint->min) + ->setCode(Choice::TOO_FEW_ERROR) + ->addViolation(); + } + + return; + } + + if ($constraint->max !== null && $count > $constraint->max) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->maxMessage) + ->setParameter('{{ limit }}', $constraint->max) + ->setPlural((int) $constraint->max) + ->setCode(Choice::TOO_MANY_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->maxMessage) + ->setParameter('{{ limit }}', $constraint->max) + ->setPlural((int) $constraint->max) + ->setCode(Choice::TOO_MANY_ERROR) + ->addViolation(); + } + + return; + } + } elseif (!in_array($value, $choices, $constraint->strict)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Choice::NO_SUCH_CHOICE_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Choice::NO_SUCH_CHOICE_ERROR) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Collection.php b/core/vendor/symfony/validator/Constraints/Collection.php new file mode 100644 index 0000000..708c8ed --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Collection.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class Collection extends Composite +{ + const MISSING_FIELD_ERROR = 1; + const NO_SUCH_FIELD_ERROR = 2; + + protected static $errorNames = array( + self::MISSING_FIELD_ERROR => 'MISSING_FIELD_ERROR', + self::NO_SUCH_FIELD_ERROR => 'NO_SUCH_FIELD_ERROR', + ); + + public $fields = array(); + public $allowExtraFields = false; + public $allowMissingFields = false; + public $extraFieldsMessage = 'This field was not expected.'; + public $missingFieldsMessage = 'This field is missing.'; + + /** + * {@inheritdoc} + */ + public function __construct($options = null) + { + // no known options set? $options is the fields array + if (is_array($options) + && !array_intersect(array_keys($options), array('groups', 'fields', 'allowExtraFields', 'allowMissingFields', 'extraFieldsMessage', 'missingFieldsMessage'))) { + $options = array('fields' => $options); + } + + parent::__construct($options); + } + + /** + * {@inheritdoc} + */ + protected function initializeNestedConstraints() + { + parent::initializeNestedConstraints(); + + if (!is_array($this->fields)) { + throw new ConstraintDefinitionException(sprintf('The option "fields" is expected to be an array in constraint %s', __CLASS__)); + } + + foreach ($this->fields as $fieldName => $field) { + // the XmlFileLoader and YamlFileLoader pass the field Optional + // and Required constraint as an array with exactly one element + if (is_array($field) && count($field) == 1) { + $this->fields[$fieldName] = $field = $field[0]; + } + + if (!$field instanceof Optional && !$field instanceof Required) { + $this->fields[$fieldName] = $field = new Required($field); + } + } + } + + public function getRequiredOptions() + { + return array('fields'); + } + + protected function getCompositeOption() + { + return 'fields'; + } +} diff --git a/core/vendor/symfony/validator/Constraints/Collection/Optional.php b/core/vendor/symfony/validator/Constraints/Collection/Optional.php new file mode 100644 index 0000000..cd9af50 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Collection/Optional.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints\Collection; + +trigger_error('The '.__NAMESPACE__.'\Optional class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Validator\Constraints\Optional class instead.', E_USER_DEPRECATED); + +use Symfony\Component\Validator\Constraints\Optional as BaseOptional; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @deprecated since version 2.3, to be removed in 3.0. + * Use {@link \Symfony\Component\Validator\Constraints\Optional} instead. + */ +class Optional extends BaseOptional +{ +} diff --git a/core/vendor/symfony/validator/Constraints/Collection/Required.php b/core/vendor/symfony/validator/Constraints/Collection/Required.php new file mode 100644 index 0000000..5504102 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Collection/Required.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints\Collection; + +trigger_error('The '.__NAMESPACE__.'\Required class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Validator\Constraints\Required class instead.', E_USER_DEPRECATED); + +use Symfony\Component\Validator\Constraints\Required as BaseRequired; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @deprecated since version 2.3, to be removed in 3.0. + * Use {@link \Symfony\Component\Validator\Constraints\Required} instead. + */ +class Required extends BaseRequired +{ +} diff --git a/core/vendor/symfony/validator/Constraints/CollectionValidator.php b/core/vendor/symfony/validator/Constraints/CollectionValidator.php new file mode 100644 index 0000000..e70a79b --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/CollectionValidator.php @@ -0,0 +1,112 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + * + * @api + */ +class CollectionValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Collection) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Collection'); + } + + if (null === $value) { + return; + } + + if (!is_array($value) && !($value instanceof \Traversable && $value instanceof \ArrayAccess)) { + throw new UnexpectedTypeException($value, 'array or Traversable and ArrayAccess'); + } + + // We need to keep the initialized context when CollectionValidator + // calls itself recursively (Collection constraints can be nested). + // Since the context of the validator is overwritten when initialize() + // is called for the nested constraint, the outer validator is + // acting on the wrong context when the nested validation terminates. + // + // A better solution - which should be approached in Symfony 3.0 - is to + // remove the initialize() method and pass the context as last argument + // to validate() instead. + $context = $this->context; + + foreach ($constraint->fields as $field => $fieldConstraint) { + // bug fix issue #2779 + $existsInArray = is_array($value) && array_key_exists($field, $value); + $existsInArrayAccess = $value instanceof \ArrayAccess && $value->offsetExists($field); + + if ($existsInArray || $existsInArrayAccess) { + if (count($fieldConstraint->constraints) > 0) { + if ($context instanceof ExecutionContextInterface) { + $context->getValidator() + ->inContext($context) + ->atPath('['.$field.']') + ->validate($value[$field], $fieldConstraint->constraints); + } else { + // 2.4 API + $context->validateValue($value[$field], $fieldConstraint->constraints, '['.$field.']'); + } + } + } elseif (!$fieldConstraint instanceof Optional && !$constraint->allowMissingFields) { + if ($context instanceof ExecutionContextInterface) { + $context->buildViolation($constraint->missingFieldsMessage) + ->atPath('['.$field.']') + ->setParameter('{{ field }}', $this->formatValue($field)) + ->setInvalidValue(null) + ->setCode(Collection::MISSING_FIELD_ERROR) + ->addViolation(); + } else { + $this->buildViolationInContext($context, $constraint->missingFieldsMessage) + ->atPath('['.$field.']') + ->setParameter('{{ field }}', $this->formatValue($field)) + ->setInvalidValue(null) + ->setCode(Collection::MISSING_FIELD_ERROR) + ->addViolation(); + } + } + } + + if (!$constraint->allowExtraFields) { + foreach ($value as $field => $fieldValue) { + if (!isset($constraint->fields[$field])) { + if ($context instanceof ExecutionContextInterface) { + $context->buildViolation($constraint->extraFieldsMessage) + ->atPath('['.$field.']') + ->setParameter('{{ field }}', $this->formatValue($field)) + ->setInvalidValue($fieldValue) + ->setCode(Collection::NO_SUCH_FIELD_ERROR) + ->addViolation(); + } else { + $this->buildViolationInContext($context, $constraint->extraFieldsMessage) + ->atPath('['.$field.']') + ->setParameter('{{ field }}', $this->formatValue($field)) + ->setInvalidValue($fieldValue) + ->setCode(Collection::NO_SUCH_FIELD_ERROR) + ->addViolation(); + } + } + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Composite.php b/core/vendor/symfony/validator/Constraints/Composite.php new file mode 100644 index 0000000..22a748c --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Composite.php @@ -0,0 +1,152 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * A constraint that is composed of other constraints. + * + * You should never use the nested constraint instances anywhere else, because + * their groups are adapted when passed to the constructor of this class. + * + * If you want to create your own composite constraint, extend this class and + * let {@link getCompositeOption()} return the name of the property which + * contains the nested constraints. + * + * @since 2.6 + * @author Bernhard Schussek + */ +abstract class Composite extends Constraint +{ + /** + * {@inheritdoc} + * + * The groups of the composite and its nested constraints are made + * consistent using the following strategy: + * + * - If groups are passed explicitly to the composite constraint, but + * not to the nested constraints, the options of the composite + * constraint are copied to the nested constraints; + * + * - If groups are passed explicitly to the nested constraints, but not + * to the composite constraint, the groups of all nested constraints + * are merged and used as groups for the composite constraint; + * + * - If groups are passed explicitly to both the composite and its nested + * constraints, the groups of the nested constraints must be a subset + * of the groups of the composite constraint. If not, a + * {@link ConstraintDefinitionException} is thrown. + * + * All this is done in the constructor, because constraints can then be + * cached. When constraints are loaded from the cache, no more group + * checks need to be done. + */ + public function __construct($options = null) + { + parent::__construct($options); + + $this->initializeNestedConstraints(); + + /** @var Constraint[] $nestedConstraints */ + $compositeOption = $this->getCompositeOption(); + $nestedConstraints = $this->$compositeOption; + + if (!is_array($nestedConstraints)) { + $nestedConstraints = array($nestedConstraints); + } + + foreach ($nestedConstraints as $constraint) { + if (!$constraint instanceof Constraint) { + throw new ConstraintDefinitionException(sprintf('The value %s is not an instance of Constraint in constraint %s', $constraint, get_class($this))); + } + + if ($constraint instanceof Valid) { + throw new ConstraintDefinitionException(sprintf('The constraint Valid cannot be nested inside constraint %s. You can only declare the Valid constraint directly on a field or method.', get_class($this))); + } + } + + if (!property_exists($this, 'groups')) { + $mergedGroups = array(); + + foreach ($nestedConstraints as $constraint) { + foreach ($constraint->groups as $group) { + $mergedGroups[$group] = true; + } + } + + $this->groups = array_keys($mergedGroups); + $this->$compositeOption = $nestedConstraints; + + return; + } + + foreach ($nestedConstraints as $constraint) { + if (property_exists($constraint, 'groups')) { + $excessGroups = array_diff($constraint->groups, $this->groups); + + if (count($excessGroups) > 0) { + throw new ConstraintDefinitionException(sprintf( + 'The group(s) "%s" passed to the constraint %s '. + 'should also be passed to its containing constraint %s', + implode('", "', $excessGroups), + get_class($constraint), + get_class($this) + )); + } + } else { + $constraint->groups = $this->groups; + } + } + + $this->$compositeOption = $nestedConstraints; + } + + /** + * {@inheritdoc} + * + * Implicit group names are forwarded to nested constraints. + * + * @param string $group + */ + public function addImplicitGroupName($group) + { + parent::addImplicitGroupName($group); + + /** @var Constraint[] $nestedConstraints */ + $nestedConstraints = $this->{$this->getCompositeOption()}; + + foreach ($nestedConstraints as $constraint) { + $constraint->addImplicitGroupName($group); + } + } + + /** + * Returns the name of the property that contains the nested constraints. + * + * @return string The property name + */ + abstract protected function getCompositeOption(); + + /** + * Initializes the nested constraints. + * + * This method can be overwritten in subclasses to clean up the nested + * constraints passed to the constructor. + * + * @see Collection::initializeNestedConstraints() + */ + protected function initializeNestedConstraints() + { + } +} diff --git a/core/vendor/symfony/validator/Constraints/Count.php b/core/vendor/symfony/validator/Constraints/Count.php new file mode 100644 index 0000000..a3e12fe --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Count.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\MissingOptionsException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class Count extends Constraint +{ + const TOO_FEW_ERROR = 1; + const TOO_MANY_ERROR = 2; + + protected static $errorNames = array( + self::TOO_FEW_ERROR => 'TOO_FEW_ERROR', + self::TOO_MANY_ERROR => 'TOO_MANY_ERROR', + ); + + public $minMessage = 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.'; + public $maxMessage = 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.'; + public $exactMessage = 'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.'; + public $min; + public $max; + + public function __construct($options = null) + { + if (null !== $options && !is_array($options)) { + $options = array( + 'min' => $options, + 'max' => $options, + ); + } + + parent::__construct($options); + + if (null === $this->min && null === $this->max) { + throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), array('min', 'max')); + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/CountValidator.php b/core/vendor/symfony/validator/Constraints/CountValidator.php new file mode 100644 index 0000000..cbe90e0 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/CountValidator.php @@ -0,0 +1,81 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + */ +class CountValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (null === $value) { + return; + } + + if (!is_array($value) && !$value instanceof \Countable) { + throw new UnexpectedTypeException($value, 'array or \Countable'); + } + + $count = count($value); + + if (null !== $constraint->max && $count > $constraint->max) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->min == $constraint->max ? $constraint->exactMessage : $constraint->maxMessage) + ->setParameter('{{ count }}', $count) + ->setParameter('{{ limit }}', $constraint->max) + ->setInvalidValue($value) + ->setPlural((int) $constraint->max) + ->setCode(Count::TOO_MANY_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->min == $constraint->max ? $constraint->exactMessage : $constraint->maxMessage) + ->setParameter('{{ count }}', $count) + ->setParameter('{{ limit }}', $constraint->max) + ->setInvalidValue($value) + ->setPlural((int) $constraint->max) + ->setCode(Count::TOO_MANY_ERROR) + ->addViolation(); + } + + return; + } + + if (null !== $constraint->min && $count < $constraint->min) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->min == $constraint->max ? $constraint->exactMessage : $constraint->minMessage) + ->setParameter('{{ count }}', $count) + ->setParameter('{{ limit }}', $constraint->min) + ->setInvalidValue($value) + ->setPlural((int) $constraint->min) + ->setCode(Count::TOO_FEW_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->min == $constraint->max ? $constraint->exactMessage : $constraint->minMessage) + ->setParameter('{{ count }}', $count) + ->setParameter('{{ limit }}', $constraint->min) + ->setInvalidValue($value) + ->setPlural((int) $constraint->min) + ->setCode(Count::TOO_FEW_ERROR) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Country.php b/core/vendor/symfony/validator/Constraints/Country.php new file mode 100644 index 0000000..ff6f3d0 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Country.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class Country extends Constraint +{ + public $message = 'This value is not a valid country.'; +} diff --git a/core/vendor/symfony/validator/Constraints/CountryValidator.php b/core/vendor/symfony/validator/Constraints/CountryValidator.php new file mode 100644 index 0000000..8139adf --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/CountryValidator.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Intl\Intl; +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Validates whether a value is a valid country code. + * + * @author Bernhard Schussek + * + * @api + */ +class CountryValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Country) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Country'); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $value = (string) $value; + $countries = Intl::getRegionBundle()->getCountryNames(); + + if (!isset($countries[$value])) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Currency.php b/core/vendor/symfony/validator/Constraints/Currency.php new file mode 100644 index 0000000..c09fe88 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Currency.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Miha Vrhovnik + * + * @api + */ +class Currency extends Constraint +{ + public $message = 'This value is not a valid currency.'; +} diff --git a/core/vendor/symfony/validator/Constraints/CurrencyValidator.php b/core/vendor/symfony/validator/Constraints/CurrencyValidator.php new file mode 100644 index 0000000..9c41dc4 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/CurrencyValidator.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Intl\Intl; +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Validates whether a value is a valid currency. + * + * @author Miha Vrhovnik + * + * @api + */ +class CurrencyValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Currency) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Currency'); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $value = (string) $value; + $currencies = Intl::getCurrencyBundle()->getCurrencyNames(); + + if (!isset($currencies[$value])) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Date.php b/core/vendor/symfony/validator/Constraints/Date.php new file mode 100644 index 0000000..2bc444f --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Date.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class Date extends Constraint +{ + const INVALID_FORMAT_ERROR = 1; + const INVALID_DATE_ERROR = 2; + + protected static $errorNames = array( + self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', + self::INVALID_DATE_ERROR => 'INVALID_DATE_ERROR', + ); + + public $message = 'This value is not a valid date.'; +} diff --git a/core/vendor/symfony/validator/Constraints/DateTime.php b/core/vendor/symfony/validator/Constraints/DateTime.php new file mode 100644 index 0000000..ae67ff3 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/DateTime.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class DateTime extends Constraint +{ + const INVALID_FORMAT_ERROR = 1; + const INVALID_DATE_ERROR = 2; + const INVALID_TIME_ERROR = 3; + + protected static $errorNames = array( + self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', + self::INVALID_DATE_ERROR => 'INVALID_DATE_ERROR', + self::INVALID_TIME_ERROR => 'INVALID_TIME_ERROR', + ); + + public $message = 'This value is not a valid datetime.'; +} diff --git a/core/vendor/symfony/validator/Constraints/DateTimeValidator.php b/core/vendor/symfony/validator/Constraints/DateTimeValidator.php new file mode 100644 index 0000000..a53c463 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/DateTimeValidator.php @@ -0,0 +1,90 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + * + * @api + */ +class DateTimeValidator extends DateValidator +{ + const PATTERN = '/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/'; + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof DateTime) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\DateTime'); + } + + if (null === $value || '' === $value || $value instanceof \DateTime) { + return; + } + + if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $value = (string) $value; + + if (!preg_match(static::PATTERN, $value, $matches)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(DateTime::INVALID_FORMAT_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(DateTime::INVALID_FORMAT_ERROR) + ->addViolation(); + } + + return; + } + + if (!DateValidator::checkDate($matches[1], $matches[2], $matches[3])) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(DateTime::INVALID_DATE_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(DateTime::INVALID_DATE_ERROR) + ->addViolation(); + } + } + + if (!TimeValidator::checkTime($matches[4], $matches[5], $matches[6])) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(DateTime::INVALID_TIME_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(DateTime::INVALID_TIME_ERROR) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/DateValidator.php b/core/vendor/symfony/validator/Constraints/DateValidator.php new file mode 100644 index 0000000..0a5dfd4 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/DateValidator.php @@ -0,0 +1,93 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + * + * @api + */ +class DateValidator extends ConstraintValidator +{ + const PATTERN = '/^(\d{4})-(\d{2})-(\d{2})$/'; + + /** + * Checks whether a date is valid. + * + * @param int $year The year + * @param int $month The month + * @param int $day The day + * + * @return bool Whether the date is valid + * + * @internal + */ + public static function checkDate($year, $month, $day) + { + return checkdate($month, $day, $year); + } + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Date) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Date'); + } + + if (null === $value || '' === $value || $value instanceof \DateTime) { + return; + } + + if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $value = (string) $value; + + if (!preg_match(static::PATTERN, $value, $matches)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Date::INVALID_FORMAT_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Date::INVALID_FORMAT_ERROR) + ->addViolation(); + } + + return; + } + + if (!self::checkDate($matches[1], $matches[2], $matches[3])) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Date::INVALID_DATE_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Date::INVALID_DATE_ERROR) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Email.php b/core/vendor/symfony/validator/Constraints/Email.php new file mode 100644 index 0000000..3697717 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Email.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class Email extends Constraint +{ + const INVALID_FORMAT_ERROR = 1; + const MX_CHECK_FAILED_ERROR = 2; + const HOST_CHECK_FAILED_ERROR = 3; + + protected static $errorNames = array( + self::INVALID_FORMAT_ERROR => 'STRICT_CHECK_FAILED_ERROR', + self::MX_CHECK_FAILED_ERROR => 'MX_CHECK_FAILED_ERROR', + self::HOST_CHECK_FAILED_ERROR => 'HOST_CHECK_FAILED_ERROR', + ); + + public $message = 'This value is not a valid email address.'; + public $checkMX = false; + public $checkHost = false; + public $strict; +} diff --git a/core/vendor/symfony/validator/Constraints/EmailValidator.php b/core/vendor/symfony/validator/Constraints/EmailValidator.php new file mode 100644 index 0000000..95f9aa1 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/EmailValidator.php @@ -0,0 +1,159 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\RuntimeException; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + * + * @api + */ +class EmailValidator extends ConstraintValidator +{ + /** + * isStrict + * + * @var bool + */ + private $isStrict; + + public function __construct($strict = false) + { + $this->isStrict = $strict; + } + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Email) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Email'); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $value = (string) $value; + + if (null === $constraint->strict) { + $constraint->strict = $this->isStrict; + } + + if ($constraint->strict) { + if (!class_exists('\Egulias\EmailValidator\EmailValidator')) { + throw new RuntimeException('Strict email validation requires egulias/email-validator'); + } + + $strictValidator = new \Egulias\EmailValidator\EmailValidator(); + + if (!$strictValidator->isValid($value, false, true)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Email::INVALID_FORMAT_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Email::INVALID_FORMAT_ERROR) + ->addViolation(); + } + + return; + } + } elseif (!preg_match('/.+\@.+\..+/', $value)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Email::INVALID_FORMAT_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Email::INVALID_FORMAT_ERROR) + ->addViolation(); + } + + return; + } + + $host = substr($value, strpos($value, '@') + 1); + + // Check for host DNS resource records + if ($constraint->checkMX) { + if (!$this->checkMX($host)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Email::MX_CHECK_FAILED_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Email::MX_CHECK_FAILED_ERROR) + ->addViolation(); + } + } + + return; + } + + if ($constraint->checkHost && !$this->checkHost($host)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Email::HOST_CHECK_FAILED_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Email::HOST_CHECK_FAILED_ERROR) + ->addViolation(); + } + } + } + + /** + * Check DNS Records for MX type. + * + * @param string $host Host + * + * @return bool + */ + private function checkMX($host) + { + return checkdnsrr($host, 'MX'); + } + + /** + * Check if one of MX, A or AAAA DNS RR exists. + * + * @param string $host Host + * + * @return bool + */ + private function checkHost($host) + { + return $this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA')); + } +} diff --git a/core/vendor/symfony/validator/Constraints/EqualTo.php b/core/vendor/symfony/validator/Constraints/EqualTo.php new file mode 100644 index 0000000..8d3d752 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/EqualTo.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Daniel Holmes + */ +class EqualTo extends AbstractComparison +{ + public $message = 'This value should be equal to {{ compared_value }}.'; +} diff --git a/core/vendor/symfony/validator/Constraints/EqualToValidator.php b/core/vendor/symfony/validator/Constraints/EqualToValidator.php new file mode 100644 index 0000000..3739dbe --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/EqualToValidator.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Validates values are equal (==). + * + * @author Daniel Holmes + */ +class EqualToValidator extends AbstractComparisonValidator +{ + /** + * {@inheritdoc} + */ + protected function compareValues($value1, $value2) + { + return $value1 == $value2; + } +} diff --git a/core/vendor/symfony/validator/Constraints/Existence.php b/core/vendor/symfony/validator/Constraints/Existence.php new file mode 100644 index 0000000..5ea6ffe --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Existence.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @author Bernhard Schussek + */ +abstract class Existence extends Composite +{ + public $constraints = array(); + + public function getDefaultOption() + { + return 'constraints'; + } + + protected function getCompositeOption() + { + return 'constraints'; + } +} diff --git a/core/vendor/symfony/validator/Constraints/Expression.php b/core/vendor/symfony/validator/Constraints/Expression.php new file mode 100644 index 0000000..dfa242c --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Expression.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Fabien Potencier + * @author Bernhard Schussek + */ +class Expression extends Constraint +{ + public $message = 'This value is not valid.'; + public $expression; + + /** + * {@inheritdoc} + */ + public function getDefaultOption() + { + return 'expression'; + } + + /** + * {@inheritdoc} + */ + public function getRequiredOptions() + { + return array('expression'); + } + + /** + * {@inheritdoc} + */ + public function getTargets() + { + return array(self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT); + } + + /** + * {@inheritdoc} + */ + public function validatedBy() + { + return 'validator.expression'; + } +} diff --git a/core/vendor/symfony/validator/Constraints/ExpressionValidator.php b/core/vendor/symfony/validator/Constraints/ExpressionValidator.php new file mode 100644 index 0000000..15d51f9 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/ExpressionValidator.php @@ -0,0 +1,123 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\ExpressionLanguage\ExpressionLanguage; +use Symfony\Component\PropertyAccess\PropertyAccess; +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; +use Symfony\Component\PropertyAccess\PropertyPath; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Exception\RuntimeException; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Fabien Potencier + * @author Bernhard Schussek + */ +class ExpressionValidator extends ConstraintValidator +{ + /** + * @var PropertyAccessorInterface + */ + private $propertyAccessor; + + /** + * @var ExpressionLanguage + */ + private $expressionLanguage; + + /** + * @param PropertyAccessorInterface|null $propertyAccessor Optional as of Symfony 2.5 + * + * @throws UnexpectedTypeException If the property accessor is invalid + */ + public function __construct($propertyAccessor = null) + { + if (null !== $propertyAccessor && !$propertyAccessor instanceof PropertyAccessorInterface) { + throw new UnexpectedTypeException($propertyAccessor, 'null or \Symfony\Component\PropertyAccess\PropertyAccessorInterface'); + } + + $this->propertyAccessor = $propertyAccessor; + } + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Expression) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Expression'); + } + + $variables = array(); + + // Symfony 2.5+ + if ($this->context instanceof ExecutionContextInterface) { + $variables['value'] = $value; + $variables['this'] = $this->context->getObject(); + } elseif (null === $this->context->getPropertyName()) { + $variables['value'] = $value; + $variables['this'] = $value; + } else { + $root = $this->context->getRoot(); + $variables['value'] = $value; + + if (is_object($root)) { + // Extract the object that the property belongs to from the object + // graph + $path = new PropertyPath($this->context->getPropertyPath()); + $parentPath = $path->getParent(); + $variables['this'] = $parentPath ? $this->getPropertyAccessor()->getValue($root, $parentPath) : $root; + } else { + $variables['this'] = null; + } + } + + if (!$this->getExpressionLanguage()->evaluate($constraint->expression, $variables)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } + } + } + + private function getExpressionLanguage() + { + if (null === $this->expressionLanguage) { + if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) { + throw new RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); + } + $this->expressionLanguage = new ExpressionLanguage(); + } + + return $this->expressionLanguage; + } + + private function getPropertyAccessor() + { + if (null === $this->propertyAccessor) { + if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccess')) { + throw new RuntimeException('Unable to use expressions as the Symfony PropertyAccess component is not installed.'); + } + $this->propertyAccessor = PropertyAccess::createPropertyAccessor(); + } + + return $this->propertyAccessor; + } +} diff --git a/core/vendor/symfony/validator/Constraints/False.php b/core/vendor/symfony/validator/Constraints/False.php new file mode 100644 index 0000000..fc2e3e4 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/False.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class False extends Constraint +{ + public $message = 'This value should be false.'; +} diff --git a/core/vendor/symfony/validator/Constraints/FalseValidator.php b/core/vendor/symfony/validator/Constraints/FalseValidator.php new file mode 100644 index 0000000..52f5ed3 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/FalseValidator.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + * + * @api + */ +class FalseValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof False) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\False'); + } + + if (null === $value || false === $value || 0 === $value || '0' === $value) { + return; + } + + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/File.php b/core/vendor/symfony/validator/Constraints/File.php new file mode 100644 index 0000000..ae0ad67 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/File.php @@ -0,0 +1,86 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class File extends Constraint +{ + // Check the Image constraint for clashes if adding new constants here + + const NOT_FOUND_ERROR = 1; + const NOT_READABLE_ERROR = 2; + const EMPTY_ERROR = 3; + const TOO_LARGE_ERROR = 4; + const INVALID_MIME_TYPE_ERROR = 5; + + protected static $errorNames = array( + self::NOT_FOUND_ERROR => 'NOT_FOUND_ERROR', + self::NOT_READABLE_ERROR => 'NOT_READABLE_ERROR', + self::EMPTY_ERROR => 'EMPTY_ERROR', + self::TOO_LARGE_ERROR => 'TOO_LARGE_ERROR', + self::INVALID_MIME_TYPE_ERROR => 'INVALID_MIME_TYPE_ERROR', + ); + + public $maxSize; + public $binaryFormat; + public $mimeTypes = array(); + public $notFoundMessage = 'The file could not be found.'; + public $notReadableMessage = 'The file is not readable.'; + public $maxSizeMessage = 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.'; + public $mimeTypesMessage = 'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.'; + public $disallowEmptyMessage = 'An empty file is not allowed.'; + + public $uploadIniSizeErrorMessage = 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.'; + public $uploadFormSizeErrorMessage = 'The file is too large.'; + public $uploadPartialErrorMessage = 'The file was only partially uploaded.'; + public $uploadNoFileErrorMessage = 'No file was uploaded.'; + public $uploadNoTmpDirErrorMessage = 'No temporary folder was configured in php.ini.'; + public $uploadCantWriteErrorMessage = 'Cannot write temporary file to disk.'; + public $uploadExtensionErrorMessage = 'A PHP extension caused the upload to fail.'; + public $uploadErrorMessage = 'The file could not be uploaded.'; + + public function __construct($options = null) + { + parent::__construct($options); + + if ($this->maxSize) { + if (ctype_digit((string) $this->maxSize)) { + $this->maxSize = (int) $this->maxSize; + $this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat; + } elseif (preg_match('/^\d++k$/i', $this->maxSize)) { + $this->maxSize = $this->maxSize * 1000; + $this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat; + } elseif (preg_match('/^\d++M$/i', $this->maxSize)) { + $this->maxSize = $this->maxSize * 1000000; + $this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat; + } elseif (preg_match('/^\d++Ki$/i', $this->maxSize)) { + $this->maxSize = $this->maxSize << 10; + $this->binaryFormat = null === $this->binaryFormat ? true : $this->binaryFormat; + } elseif (preg_match('/^\d++Mi$/i', $this->maxSize)) { + $this->maxSize = $this->maxSize << 20; + $this->binaryFormat = null === $this->binaryFormat ? true : $this->binaryFormat; + } else { + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum size', $this->maxSize)); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/FileValidator.php b/core/vendor/symfony/validator/Constraints/FileValidator.php new file mode 100644 index 0000000..5125a32 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/FileValidator.php @@ -0,0 +1,331 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\HttpFoundation\File\File as FileObject; +use Symfony\Component\HttpFoundation\File\UploadedFile; +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + * + * @api + */ +class FileValidator extends ConstraintValidator +{ + const KB_BYTES = 1000; + const MB_BYTES = 1000000; + const KIB_BYTES = 1024; + const MIB_BYTES = 1048576; + + private static $suffices = array( + 1 => 'bytes', + self::KB_BYTES => 'kB', + self::MB_BYTES => 'MB', + self::KIB_BYTES => 'KiB', + self::MIB_BYTES => 'MiB', + ); + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof File) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\File'); + } + + if (null === $value || '' === $value) { + return; + } + + if ($value instanceof UploadedFile && !$value->isValid()) { + switch ($value->getError()) { + case UPLOAD_ERR_INI_SIZE: + $iniLimitSize = UploadedFile::getMaxFilesize(); + if ($constraint->maxSize && $constraint->maxSize < $iniLimitSize) { + $limitInBytes = $constraint->maxSize; + $binaryFormat = $constraint->binaryFormat; + } else { + $limitInBytes = $iniLimitSize; + $binaryFormat = true; + } + + list($sizeAsString, $limitAsString, $suffix) = $this->factorizeSizes(0, $limitInBytes, $binaryFormat); + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->uploadIniSizeErrorMessage) + ->setParameter('{{ limit }}', $limitAsString) + ->setParameter('{{ suffix }}', $suffix) + ->setCode(UPLOAD_ERR_INI_SIZE) + ->addViolation(); + } else { + $this->buildViolation($constraint->uploadIniSizeErrorMessage) + ->setParameter('{{ limit }}', $limitAsString) + ->setParameter('{{ suffix }}', $suffix) + ->setCode(UPLOAD_ERR_INI_SIZE) + ->addViolation(); + } + + return; + case UPLOAD_ERR_FORM_SIZE: + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->uploadFormSizeErrorMessage) + ->setCode(UPLOAD_ERR_FORM_SIZE) + ->addViolation(); + } else { + $this->buildViolation($constraint->uploadFormSizeErrorMessage) + ->setCode(UPLOAD_ERR_FORM_SIZE) + ->addViolation(); + } + + return; + case UPLOAD_ERR_PARTIAL: + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->uploadPartialErrorMessage) + ->setCode(UPLOAD_ERR_PARTIAL) + ->addViolation(); + } else { + $this->buildViolation($constraint->uploadPartialErrorMessage) + ->setCode(UPLOAD_ERR_PARTIAL) + ->addViolation(); + } + + return; + case UPLOAD_ERR_NO_FILE: + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->uploadNoFileErrorMessage) + ->setCode(UPLOAD_ERR_NO_FILE) + ->addViolation(); + } else { + $this->buildViolation($constraint->uploadNoFileErrorMessage) + ->setCode(UPLOAD_ERR_NO_FILE) + ->addViolation(); + } + + return; + case UPLOAD_ERR_NO_TMP_DIR: + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->uploadNoTmpDirErrorMessage) + ->setCode(UPLOAD_ERR_NO_TMP_DIR) + ->addViolation(); + } else { + $this->buildViolation($constraint->uploadNoTmpDirErrorMessage) + ->setCode(UPLOAD_ERR_NO_TMP_DIR) + ->addViolation(); + } + + return; + case UPLOAD_ERR_CANT_WRITE: + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->uploadCantWriteErrorMessage) + ->setCode(UPLOAD_ERR_CANT_WRITE) + ->addViolation(); + } else { + $this->buildViolation($constraint->uploadCantWriteErrorMessage) + ->setCode(UPLOAD_ERR_CANT_WRITE) + ->addViolation(); + } + + return; + case UPLOAD_ERR_EXTENSION: + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->uploadExtensionErrorMessage) + ->setCode(UPLOAD_ERR_EXTENSION) + ->addViolation(); + } else { + $this->buildViolation($constraint->uploadExtensionErrorMessage) + ->setCode(UPLOAD_ERR_EXTENSION) + ->addViolation(); + } + + return; + default: + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->uploadErrorMessage) + ->setCode($value->getError()) + ->addViolation(); + } else { + $this->buildViolation($constraint->uploadErrorMessage) + ->setCode($value->getError()) + ->addViolation(); + } + + return; + } + } + + if (!is_scalar($value) && !$value instanceof FileObject && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $path = $value instanceof FileObject ? $value->getPathname() : (string) $value; + + if (!is_file($path)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->notFoundMessage) + ->setParameter('{{ file }}', $this->formatValue($path)) + ->setCode(File::NOT_FOUND_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->notFoundMessage) + ->setParameter('{{ file }}', $this->formatValue($path)) + ->setCode(File::NOT_FOUND_ERROR) + ->addViolation(); + } + + return; + } + + if (!is_readable($path)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->notReadableMessage) + ->setParameter('{{ file }}', $this->formatValue($path)) + ->setCode(File::NOT_READABLE_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->notReadableMessage) + ->setParameter('{{ file }}', $this->formatValue($path)) + ->setCode(File::NOT_READABLE_ERROR) + ->addViolation(); + } + + return; + } + + $sizeInBytes = filesize($path); + + if (0 === $sizeInBytes) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->disallowEmptyMessage) + ->setParameter('{{ file }}', $this->formatValue($path)) + ->setCode(File::EMPTY_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->disallowEmptyMessage) + ->setParameter('{{ file }}', $this->formatValue($path)) + ->setCode(File::EMPTY_ERROR) + ->addViolation(); + } + + return; + } + + if ($constraint->maxSize) { + $limitInBytes = $constraint->maxSize; + + if ($sizeInBytes > $limitInBytes) { + list($sizeAsString, $limitAsString, $suffix) = $this->factorizeSizes($sizeInBytes, $limitInBytes, $constraint->binaryFormat); + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->maxSizeMessage) + ->setParameter('{{ file }}', $this->formatValue($path)) + ->setParameter('{{ size }}', $sizeAsString) + ->setParameter('{{ limit }}', $limitAsString) + ->setParameter('{{ suffix }}', $suffix) + ->setCode(File::TOO_LARGE_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->maxSizeMessage) + ->setParameter('{{ file }}', $this->formatValue($path)) + ->setParameter('{{ size }}', $sizeAsString) + ->setParameter('{{ limit }}', $limitAsString) + ->setParameter('{{ suffix }}', $suffix) + ->setCode(File::TOO_LARGE_ERROR) + ->addViolation(); + } + + return; + } + } + + if ($constraint->mimeTypes) { + if (!$value instanceof FileObject) { + $value = new FileObject($value); + } + + $mimeTypes = (array) $constraint->mimeTypes; + $mime = $value->getMimeType(); + + foreach ($mimeTypes as $mimeType) { + if ($mimeType === $mime) { + return; + } + + if ($discrete = strstr($mimeType, '/*', true)) { + if (strstr($mime, '/', true) === $discrete) { + return; + } + } + } + + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->mimeTypesMessage) + ->setParameter('{{ file }}', $this->formatValue($path)) + ->setParameter('{{ type }}', $this->formatValue($mime)) + ->setParameter('{{ types }}', $this->formatValues($mimeTypes)) + ->setCode(File::INVALID_MIME_TYPE_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->mimeTypesMessage) + ->setParameter('{{ file }}', $this->formatValue($path)) + ->setParameter('{{ type }}', $this->formatValue($mime)) + ->setParameter('{{ types }}', $this->formatValues($mimeTypes)) + ->setCode(File::INVALID_MIME_TYPE_ERROR) + ->addViolation(); + } + } + } + + private static function moreDecimalsThan($double, $numberOfDecimals) + { + return strlen((string) $double) > strlen(round($double, $numberOfDecimals)); + } + + /** + * Convert the limit to the smallest possible number + * (i.e. try "MB", then "kB", then "bytes") + */ + private function factorizeSizes($size, $limit, $binaryFormat) + { + if ($binaryFormat) { + $coef = self::MIB_BYTES; + $coefFactor = self::KIB_BYTES; + } else { + $coef = self::MB_BYTES; + $coefFactor = self::KB_BYTES; + } + + $limitAsString = (string) ($limit / $coef); + + // Restrict the limit to 2 decimals (without rounding! we + // need the precise value) + while (self::moreDecimalsThan($limitAsString, 2)) { + $coef /= $coefFactor; + $limitAsString = (string) ($limit / $coef); + } + + // Convert size to the same measure, but round to 2 decimals + $sizeAsString = (string) round($size / $coef, 2); + + // If the size and limit produce the same string output + // (due to rounding), reduce the coefficient + while ($sizeAsString === $limitAsString) { + $coef /= $coefFactor; + $limitAsString = (string) ($limit / $coef); + $sizeAsString = (string) round($size / $coef, 2); + } + + return array($sizeAsString, $limitAsString, self::$suffices[$coef]); + } +} diff --git a/core/vendor/symfony/validator/Constraints/GreaterThan.php b/core/vendor/symfony/validator/Constraints/GreaterThan.php new file mode 100644 index 0000000..ec7fafb --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/GreaterThan.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Daniel Holmes + */ +class GreaterThan extends AbstractComparison +{ + public $message = 'This value should be greater than {{ compared_value }}.'; +} diff --git a/core/vendor/symfony/validator/Constraints/GreaterThanOrEqual.php b/core/vendor/symfony/validator/Constraints/GreaterThanOrEqual.php new file mode 100644 index 0000000..36fdd9c --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/GreaterThanOrEqual.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Daniel Holmes + */ +class GreaterThanOrEqual extends AbstractComparison +{ + public $message = 'This value should be greater than or equal to {{ compared_value }}.'; +} diff --git a/core/vendor/symfony/validator/Constraints/GreaterThanOrEqualValidator.php b/core/vendor/symfony/validator/Constraints/GreaterThanOrEqualValidator.php new file mode 100644 index 0000000..2363204 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/GreaterThanOrEqualValidator.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Validates values are greater than or equal to the previous (>=). + * + * @author Daniel Holmes + */ +class GreaterThanOrEqualValidator extends AbstractComparisonValidator +{ + /** + * {@inheritdoc} + */ + protected function compareValues($value1, $value2) + { + return $value1 >= $value2; + } +} diff --git a/core/vendor/symfony/validator/Constraints/GreaterThanValidator.php b/core/vendor/symfony/validator/Constraints/GreaterThanValidator.php new file mode 100644 index 0000000..fdcf0c1 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/GreaterThanValidator.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Validates values are greater than the previous (>). + * + * @author Daniel Holmes + */ +class GreaterThanValidator extends AbstractComparisonValidator +{ + /** + * {@inheritdoc} + */ + protected function compareValues($value1, $value2) + { + return $value1 > $value2; + } +} diff --git a/core/vendor/symfony/validator/Constraints/GroupSequence.php b/core/vendor/symfony/validator/Constraints/GroupSequence.php new file mode 100644 index 0000000..52d7539 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/GroupSequence.php @@ -0,0 +1,214 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Exception\OutOfBoundsException; + +/** + * A sequence of validation groups. + * + * When validating a group sequence, each group will only be validated if all + * of the previous groups in the sequence succeeded. For example: + * + * $validator->validate($address, null, new GroupSequence('Basic', 'Strict')); + * + * In the first step, all constraints that belong to the group "Basic" will be + * validated. If none of the constraints fail, the validator will then validate + * the constraints in group "Strict". This is useful, for example, if "Strict" + * contains expensive checks that require a lot of CPU or slow, external + * services. You usually don't want to run expensive checks if any of the cheap + * checks fail. + * + * When adding metadata to a class, you can override the "Default" group of + * that class with a group sequence: + * + * /** + * * @GroupSequence({"Address", "Strict"}) + * *\/ + * class Address + * { + * // ... + * } + * + * Whenever you validate that object in the "Default" group, the group sequence + * will be validated: + * + * $validator->validate($address); + * + * If you want to execute the constraints of the "Default" group for a class + * with an overridden default group, pass the class name as group name instead: + * + * $validator->validate($address, null, "Address") + * + * @Annotation + * @Target({"CLASS", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + * + * Implementing \ArrayAccess, \IteratorAggregate and \Countable is @deprecated since 2.5 and will be removed in 3.0. + */ +class GroupSequence implements \ArrayAccess, \IteratorAggregate, \Countable +{ + /** + * The groups in the sequence. + * + * @var string[]|GroupSequence[] + */ + public $groups; + + /** + * The group in which cascaded objects are validated when validating + * this sequence. + * + * By default, cascaded objects are validated in each of the groups of + * the sequence. + * + * If a class has a group sequence attached, that sequence replaces the + * "Default" group. When validating that class in the "Default" group, the + * group sequence is used instead, but still the "Default" group should be + * cascaded to other objects. + * + * @var string|GroupSequence + */ + public $cascadedGroup; + + /** + * Creates a new group sequence. + * + * @param string[] $groups The groups in the sequence + */ + public function __construct(array $groups) + { + // Support for Doctrine annotations + $this->groups = isset($groups['value']) ? $groups['value'] : $groups; + } + + /** + * Returns an iterator for this group. + * + * Implemented for backwards compatibility with Symfony < 2.5. + * + * @return \Traversable The iterator + * + * @see \IteratorAggregate::getIterator() + * + * @deprecated since version 2.5, to be removed in 3.0. + */ + public function getIterator() + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); + + return new \ArrayIterator($this->groups); + } + + /** + * Returns whether the given offset exists in the sequence. + * + * Implemented for backwards compatibility with Symfony < 2.5. + * + * @param int $offset The offset + * + * @return bool Whether the offset exists + * + * @deprecated since version 2.5, to be removed in 3.0. + */ + public function offsetExists($offset) + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); + + return isset($this->groups[$offset]); + } + + /** + * Returns the group at the given offset. + * + * Implemented for backwards compatibility with Symfony < 2.5. + * + * @param int $offset The offset + * + * @return string The group a the given offset + * + * @throws OutOfBoundsException If the object does not exist + * + * @deprecated since version 2.5, to be removed in 3.0. + */ + public function offsetGet($offset) + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); + + if (!isset($this->groups[$offset])) { + throw new OutOfBoundsException(sprintf( + 'The offset "%s" does not exist.', + $offset + )); + } + + return $this->groups[$offset]; + } + + /** + * Sets the group at the given offset. + * + * Implemented for backwards compatibility with Symfony < 2.5. + * + * @param int $offset The offset + * @param string $value The group name + * + * @deprecated since version 2.5, to be removed in 3.0. + */ + public function offsetSet($offset, $value) + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); + + if (null !== $offset) { + $this->groups[$offset] = $value; + + return; + } + + $this->groups[] = $value; + } + + /** + * Removes the group at the given offset. + * + * Implemented for backwards compatibility with Symfony < 2.5. + * + * @param int $offset The offset + * + * @deprecated since version 2.5, to be removed in 3.0. + */ + public function offsetUnset($offset) + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); + + unset($this->groups[$offset]); + } + + /** + * Returns the number of groups in the sequence. + * + * Implemented for backwards compatibility with Symfony < 2.5. + * + * @return int The number of groups + * + * @deprecated since version 2.5, to be removed in 3.0. + */ + public function count() + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); + + return count($this->groups); + } +} diff --git a/core/vendor/symfony/validator/Constraints/GroupSequenceProvider.php b/core/vendor/symfony/validator/Constraints/GroupSequenceProvider.php new file mode 100644 index 0000000..3904473 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/GroupSequenceProvider.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Annotation to define a group sequence provider. + * + * @Annotation + * @Target({"CLASS", "ANNOTATION"}) + */ +class GroupSequenceProvider +{ +} diff --git a/core/vendor/symfony/validator/Constraints/Iban.php b/core/vendor/symfony/validator/Constraints/Iban.php new file mode 100644 index 0000000..66ce09a --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Iban.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Manuel Reinhard + * @author Michael Schummel + * @author Bernhard Schussek + */ +class Iban extends Constraint +{ + const TOO_SHORT_ERROR = 1; + const INVALID_COUNTRY_CODE_ERROR = 2; + const INVALID_CHARACTERS_ERROR = 3; + const INVALID_CASE_ERROR = 4; + const CHECKSUM_FAILED_ERROR = 5; + + protected static $errorNames = array( + self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', + self::INVALID_COUNTRY_CODE_ERROR => 'INVALID_COUNTRY_CODE_ERROR', + self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', + self::INVALID_CASE_ERROR => 'INVALID_CASE_ERROR', + self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR', + ); + + public $message = 'This is not a valid International Bank Account Number (IBAN).'; +} diff --git a/core/vendor/symfony/validator/Constraints/IbanValidator.php b/core/vendor/symfony/validator/Constraints/IbanValidator.php new file mode 100644 index 0000000..65c22ff --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/IbanValidator.php @@ -0,0 +1,179 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Manuel Reinhard + * @author Michael Schummel + * @author Bernhard Schussek + * + * @link http://www.michael-schummel.de/2007/10/05/iban-prufung-mit-php/ + */ +class IbanValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Iban) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Iban'); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $value = (string) $value; + + // Remove spaces + $canonicalized = str_replace(' ', '', $value); + + // The IBAN must have at least 4 characters... + if (strlen($canonicalized) < 4) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Iban::TOO_SHORT_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Iban::TOO_SHORT_ERROR) + ->addViolation(); + } + + return; + } + + // ...start with a country code... + if (!ctype_alpha($canonicalized{0}) || !ctype_alpha($canonicalized{1})) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Iban::INVALID_COUNTRY_CODE_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Iban::INVALID_COUNTRY_CODE_ERROR) + ->addViolation(); + } + + return; + } + + // ...contain only digits and characters... + if (!ctype_alnum($canonicalized)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Iban::INVALID_CHARACTERS_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Iban::INVALID_CHARACTERS_ERROR) + ->addViolation(); + } + + return; + } + + // ...and contain uppercase characters only + if ($canonicalized !== strtoupper($canonicalized)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Iban::INVALID_CASE_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Iban::INVALID_CASE_ERROR) + ->addViolation(); + } + + return; + } + + // Move the first four characters to the end + // e.g. CH93 0076 2011 6238 5295 7 + // -> 0076 2011 6238 5295 7 CH93 + $canonicalized = substr($canonicalized, 4).substr($canonicalized, 0, 4); + + // Convert all remaining letters to their ordinals + // The result is an integer, which is too large for PHP's int + // data type, so we store it in a string instead. + // e.g. 0076 2011 6238 5295 7 CH93 + // -> 0076 2011 6238 5295 7 121893 + $checkSum = $this->toBigInt($canonicalized); + + // Do a modulo-97 operation on the large integer + // We cannot use PHP's modulo operator, so we calculate the + // modulo step-wisely instead + if (1 !== $this->bigModulo97($checkSum)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Iban::CHECKSUM_FAILED_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Iban::CHECKSUM_FAILED_ERROR) + ->addViolation(); + } + } + } + + private function toBigInt($string) + { + $chars = str_split($string); + $bigInt = ''; + + foreach ($chars as $char) { + // Convert uppercase characters to ordinals, starting with 10 for "A" + if (ctype_upper($char)) { + $bigInt .= (ord($char) - 55); + + continue; + } + + // Simply append digits + $bigInt .= $char; + } + + return $bigInt; + } + + private function bigModulo97($bigInt) + { + $parts = str_split($bigInt, 7); + $rest = 0; + + foreach ($parts as $part) { + $rest = ($rest.$part) % 97; + } + + return $rest; + } +} diff --git a/core/vendor/symfony/validator/Constraints/IdenticalTo.php b/core/vendor/symfony/validator/Constraints/IdenticalTo.php new file mode 100644 index 0000000..6d00286 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/IdenticalTo.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Daniel Holmes + */ +class IdenticalTo extends AbstractComparison +{ + public $message = 'This value should be identical to {{ compared_value_type }} {{ compared_value }}.'; +} diff --git a/core/vendor/symfony/validator/Constraints/IdenticalToValidator.php b/core/vendor/symfony/validator/Constraints/IdenticalToValidator.php new file mode 100644 index 0000000..a186726 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/IdenticalToValidator.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Validates values are identical (===). + * + * @author Daniel Holmes + */ +class IdenticalToValidator extends AbstractComparisonValidator +{ + /** + * {@inheritdoc} + */ + protected function compareValues($value1, $value2) + { + return $value1 === $value2; + } +} diff --git a/core/vendor/symfony/validator/Constraints/Image.php b/core/vendor/symfony/validator/Constraints/Image.php new file mode 100644 index 0000000..904ef97 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Image.php @@ -0,0 +1,81 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Benjamin Dulau + * @author Bernhard Schussek + * + * @api + */ +class Image extends File +{ + // Don't reuse values used in File + + const SIZE_NOT_DETECTED_ERROR = 10; + const TOO_WIDE_ERROR = 11; + const TOO_NARROW_ERROR = 12; + const TOO_HIGH_ERROR = 13; + const TOO_LOW_ERROR = 14; + const RATIO_TOO_BIG_ERROR = 15; + const RATIO_TOO_SMALL_ERROR = 16; + const SQUARE_NOT_ALLOWED_ERROR = 17; + const LANDSCAPE_NOT_ALLOWED_ERROR = 18; + const PORTRAIT_NOT_ALLOWED_ERROR = 19; + + // Include the mapping from the base class + + protected static $errorNames = array( + self::NOT_FOUND_ERROR => 'NOT_FOUND_ERROR', + self::NOT_READABLE_ERROR => 'NOT_READABLE_ERROR', + self::EMPTY_ERROR => 'EMPTY_ERROR', + self::TOO_LARGE_ERROR => 'TOO_LARGE_ERROR', + self::INVALID_MIME_TYPE_ERROR => 'INVALID_MIME_TYPE_ERROR', + self::SIZE_NOT_DETECTED_ERROR => 'SIZE_NOT_DETECTED_ERROR', + self::TOO_WIDE_ERROR => 'TOO_WIDE_ERROR', + self::TOO_NARROW_ERROR => 'TOO_NARROW_ERROR', + self::TOO_HIGH_ERROR => 'TOO_HIGH_ERROR', + self::TOO_LOW_ERROR => 'TOO_LOW_ERROR', + self::RATIO_TOO_BIG_ERROR => 'RATIO_TOO_BIG_ERROR', + self::RATIO_TOO_SMALL_ERROR => 'RATIO_TOO_SMALL_ERROR', + self::SQUARE_NOT_ALLOWED_ERROR => 'SQUARE_NOT_ALLOWED_ERROR', + self::LANDSCAPE_NOT_ALLOWED_ERROR => 'LANDSCAPE_NOT_ALLOWED_ERROR', + self::PORTRAIT_NOT_ALLOWED_ERROR => 'PORTRAIT_NOT_ALLOWED_ERROR', + ); + + public $mimeTypes = 'image/*'; + public $minWidth; + public $maxWidth; + public $maxHeight; + public $minHeight; + public $maxRatio; + public $minRatio; + public $allowSquare = true; + public $allowLandscape = true; + public $allowPortrait = true; + + // The constant for a wrong MIME type is taken from the parent class. + public $mimeTypesMessage = 'This file is not a valid image.'; + public $sizeNotDetectedMessage = 'The size of the image could not be detected.'; + public $maxWidthMessage = 'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.'; + public $minWidthMessage = 'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.'; + public $maxHeightMessage = 'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.'; + public $minHeightMessage = 'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.'; + public $maxRatioMessage = 'The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.'; + public $minRatioMessage = 'The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.'; + public $allowSquareMessage = 'The image is square ({{ width }}x{{ height }}px). Square images are not allowed.'; + public $allowLandscapeMessage = 'The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.'; + public $allowPortraitMessage = 'The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.'; +} diff --git a/core/vendor/symfony/validator/Constraints/ImageValidator.php b/core/vendor/symfony/validator/Constraints/ImageValidator.php new file mode 100644 index 0000000..a5165e2 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/ImageValidator.php @@ -0,0 +1,261 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Validates whether a value is a valid image file and is valid + * against minWidth, maxWidth, minHeight and maxHeight constraints. + * + * @author Benjamin Dulau + * @author Bernhard Schussek + */ +class ImageValidator extends FileValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Image) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Image'); + } + + $violations = count($this->context->getViolations()); + + parent::validate($value, $constraint); + + $failed = count($this->context->getViolations()) !== $violations; + + if ($failed || null === $value || '' === $value) { + return; + } + + if (null === $constraint->minWidth && null === $constraint->maxWidth + && null === $constraint->minHeight && null === $constraint->maxHeight + && null === $constraint->minRatio && null === $constraint->maxRatio + && $constraint->allowSquare && $constraint->allowLandscape && $constraint->allowPortrait) { + return; + } + + $size = @getimagesize($value); + + if (empty($size) || ($size[0] === 0) || ($size[1] === 0)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->sizeNotDetectedMessage) + ->setCode(Image::SIZE_NOT_DETECTED_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->sizeNotDetectedMessage) + ->setCode(Image::SIZE_NOT_DETECTED_ERROR) + ->addViolation(); + } + + return; + } + + $width = $size[0]; + $height = $size[1]; + + if ($constraint->minWidth) { + if (!ctype_digit((string) $constraint->minWidth)) { + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum width', $constraint->minWidth)); + } + + if ($width < $constraint->minWidth) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->minWidthMessage) + ->setParameter('{{ width }}', $width) + ->setParameter('{{ min_width }}', $constraint->minWidth) + ->setCode(Image::TOO_NARROW_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->minWidthMessage) + ->setParameter('{{ width }}', $width) + ->setParameter('{{ min_width }}', $constraint->minWidth) + ->setCode(Image::TOO_NARROW_ERROR) + ->addViolation(); + } + + return; + } + } + + if ($constraint->maxWidth) { + if (!ctype_digit((string) $constraint->maxWidth)) { + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum width', $constraint->maxWidth)); + } + + if ($width > $constraint->maxWidth) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->maxWidthMessage) + ->setParameter('{{ width }}', $width) + ->setParameter('{{ max_width }}', $constraint->maxWidth) + ->setCode(Image::TOO_WIDE_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->maxWidthMessage) + ->setParameter('{{ width }}', $width) + ->setParameter('{{ max_width }}', $constraint->maxWidth) + ->setCode(Image::TOO_WIDE_ERROR) + ->addViolation(); + } + + return; + } + } + + if ($constraint->minHeight) { + if (!ctype_digit((string) $constraint->minHeight)) { + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum height', $constraint->minHeight)); + } + + if ($height < $constraint->minHeight) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->minHeightMessage) + ->setParameter('{{ height }}', $height) + ->setParameter('{{ min_height }}', $constraint->minHeight) + ->setCode(Image::TOO_LOW_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->minHeightMessage) + ->setParameter('{{ height }}', $height) + ->setParameter('{{ min_height }}', $constraint->minHeight) + ->setCode(Image::TOO_LOW_ERROR) + ->addViolation(); + } + + return; + } + } + + if ($constraint->maxHeight) { + if (!ctype_digit((string) $constraint->maxHeight)) { + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum height', $constraint->maxHeight)); + } + + if ($height > $constraint->maxHeight) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->maxHeightMessage) + ->setParameter('{{ height }}', $height) + ->setParameter('{{ max_height }}', $constraint->maxHeight) + ->setCode(Image::TOO_HIGH_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->maxHeightMessage) + ->setParameter('{{ height }}', $height) + ->setParameter('{{ max_height }}', $constraint->maxHeight) + ->setCode(Image::TOO_HIGH_ERROR) + ->addViolation(); + } + } + } + + $ratio = round($width / $height, 2); + + if (null !== $constraint->minRatio) { + if (!is_numeric((string) $constraint->minRatio)) { + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum ratio', $constraint->minRatio)); + } + + if ($ratio < $constraint->minRatio) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->minRatioMessage) + ->setParameter('{{ ratio }}', $ratio) + ->setParameter('{{ min_ratio }}', $constraint->minRatio) + ->setCode(Image::RATIO_TOO_SMALL_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->minRatioMessage) + ->setParameter('{{ ratio }}', $ratio) + ->setParameter('{{ min_ratio }}', $constraint->minRatio) + ->setCode(Image::RATIO_TOO_SMALL_ERROR) + ->addViolation(); + } + } + } + + if (null !== $constraint->maxRatio) { + if (!is_numeric((string) $constraint->maxRatio)) { + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum ratio', $constraint->maxRatio)); + } + + if ($ratio > $constraint->maxRatio) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->maxRatioMessage) + ->setParameter('{{ ratio }}', $ratio) + ->setParameter('{{ max_ratio }}', $constraint->maxRatio) + ->setCode(Image::RATIO_TOO_BIG_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->maxRatioMessage) + ->setParameter('{{ ratio }}', $ratio) + ->setParameter('{{ max_ratio }}', $constraint->maxRatio) + ->setCode(Image::RATIO_TOO_BIG_ERROR) + ->addViolation(); + } + } + } + + if (!$constraint->allowSquare && $width == $height) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->allowSquareMessage) + ->setParameter('{{ width }}', $width) + ->setParameter('{{ height }}', $height) + ->setCode(Image::SQUARE_NOT_ALLOWED_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->allowSquareMessage) + ->setParameter('{{ width }}', $width) + ->setParameter('{{ height }}', $height) + ->setCode(Image::SQUARE_NOT_ALLOWED_ERROR) + ->addViolation(); + } + } + + if (!$constraint->allowLandscape && $width > $height) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->allowLandscapeMessage) + ->setParameter('{{ width }}', $width) + ->setParameter('{{ height }}', $height) + ->setCode(Image::LANDSCAPE_NOT_ALLOWED_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->allowLandscapeMessage) + ->setParameter('{{ width }}', $width) + ->setParameter('{{ height }}', $height) + ->setCode(Image::LANDSCAPE_NOT_ALLOWED_ERROR) + ->addViolation(); + } + } + + if (!$constraint->allowPortrait && $width < $height) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->allowPortraitMessage) + ->setParameter('{{ width }}', $width) + ->setParameter('{{ height }}', $height) + ->setCode(Image::PORTRAIT_NOT_ALLOWED_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->allowPortraitMessage) + ->setParameter('{{ width }}', $width) + ->setParameter('{{ height }}', $height) + ->setCode(Image::PORTRAIT_NOT_ALLOWED_ERROR) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Ip.php b/core/vendor/symfony/validator/Constraints/Ip.php new file mode 100644 index 0000000..27f0b2d --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Ip.php @@ -0,0 +1,82 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * Validates that a value is a valid IP address. + * + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * @author Joseph Bielawski + * + * @api + */ +class Ip extends Constraint +{ + const V4 = '4'; + const V6 = '6'; + const ALL = 'all'; + + // adds FILTER_FLAG_NO_PRIV_RANGE flag (skip private ranges) + const V4_NO_PRIV = '4_no_priv'; + const V6_NO_PRIV = '6_no_priv'; + const ALL_NO_PRIV = 'all_no_priv'; + + // adds FILTER_FLAG_NO_RES_RANGE flag (skip reserved ranges) + const V4_NO_RES = '4_no_res'; + const V6_NO_RES = '6_no_res'; + const ALL_NO_RES = 'all_no_res'; + + // adds FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE flags (skip both) + const V4_ONLY_PUBLIC = '4_public'; + const V6_ONLY_PUBLIC = '6_public'; + const ALL_ONLY_PUBLIC = 'all_public'; + + protected static $versions = array( + self::V4, + self::V6, + self::ALL, + + self::V4_NO_PRIV, + self::V6_NO_PRIV, + self::ALL_NO_PRIV, + + self::V4_NO_RES, + self::V6_NO_RES, + self::ALL_NO_RES, + + self::V4_ONLY_PUBLIC, + self::V6_ONLY_PUBLIC, + self::ALL_ONLY_PUBLIC, + ); + + public $version = self::V4; + + public $message = 'This is not a valid IP address.'; + + /** + * {@inheritdoc} + */ + public function __construct($options = null) + { + parent::__construct($options); + + if (!in_array($this->version, self::$versions)) { + throw new ConstraintDefinitionException(sprintf('The option "version" must be one of "%s"', implode('", "', self::$versions))); + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/IpValidator.php b/core/vendor/symfony/validator/Constraints/IpValidator.php new file mode 100644 index 0000000..15e5720 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/IpValidator.php @@ -0,0 +1,111 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Validates whether a value is a valid IP address. + * + * @author Bernhard Schussek + * @author Joseph Bielawski + * + * @api + */ +class IpValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Ip) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Ip'); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $value = (string) $value; + + switch ($constraint->version) { + case Ip::V4: + $flag = FILTER_FLAG_IPV4; + break; + + case Ip::V6: + $flag = FILTER_FLAG_IPV6; + break; + + case Ip::V4_NO_PRIV: + $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE; + break; + + case Ip::V6_NO_PRIV: + $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE; + break; + + case Ip::ALL_NO_PRIV: + $flag = FILTER_FLAG_NO_PRIV_RANGE; + break; + + case Ip::V4_NO_RES: + $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE; + break; + + case Ip::V6_NO_RES: + $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE; + break; + + case Ip::ALL_NO_RES: + $flag = FILTER_FLAG_NO_RES_RANGE; + break; + + case Ip::V4_ONLY_PUBLIC: + $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; + break; + + case Ip::V6_ONLY_PUBLIC: + $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; + break; + + case Ip::ALL_ONLY_PUBLIC: + $flag = FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; + break; + + default: + $flag = null; + break; + } + + if (!filter_var($value, FILTER_VALIDATE_IP, $flag)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } + } + } +} + diff --git a/core/vendor/symfony/validator/Constraints/Isbn.php b/core/vendor/symfony/validator/Constraints/Isbn.php new file mode 100644 index 0000000..35cb822 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Isbn.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author The Whole Life To Learn + * @author Manuel Reinhard + * @author Bernhard Schussek + */ +class Isbn extends Constraint +{ + const TOO_SHORT_ERROR = 1; + const TOO_LONG_ERROR = 2; + const INVALID_CHARACTERS_ERROR = 3; + const CHECKSUM_FAILED_ERROR = 4; + const TYPE_NOT_RECOGNIZED_ERROR = 5; + + protected static $errorNames = array( + self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', + self::TOO_LONG_ERROR => 'TOO_LONG_ERROR', + self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', + self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR', + self::TYPE_NOT_RECOGNIZED_ERROR => 'TYPE_NOT_RECOGNIZED_ERROR', + ); + + public $isbn10Message = 'This value is not a valid ISBN-10.'; + public $isbn13Message = 'This value is not a valid ISBN-13.'; + public $bothIsbnMessage = 'This value is neither a valid ISBN-10 nor a valid ISBN-13.'; + public $type; + public $message; + + /** + * @deprecated since version 2.5, to be removed in 3.0. Use option "type" instead. + * @var bool + */ + public $isbn10 = false; + + /** + * @deprecated since version 2.5, to be removed in 3.0. Use option "type" instead. + * @var bool + */ + public $isbn13 = false; + + /** + * {@inheritdoc} + */ + public function getDefaultOption() + { + return 'type'; + } +} diff --git a/core/vendor/symfony/validator/Constraints/IsbnValidator.php b/core/vendor/symfony/validator/Constraints/IsbnValidator.php new file mode 100644 index 0000000..ccdf4e8 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/IsbnValidator.php @@ -0,0 +1,216 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Validates whether the value is a valid ISBN-10 or ISBN-13 + * + * @author The Whole Life To Learn + * @author Manuel Reinhard + * @author Bernhard Schussek + * + * @see https://en.wikipedia.org/wiki/Isbn + */ +class IsbnValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Isbn) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Isbn'); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $value = (string) $value; + $canonical = str_replace('-', '', $value); + + if (null === $constraint->type) { + if ($constraint->isbn10 && !$constraint->isbn13) { + trigger_error('The "isbn10" option of the Isbn constraint is deprecated since version 2.5 and will be removed in 3.0. Use the "type" option instead.', E_USER_DEPRECATED); + $constraint->type = 'isbn10'; + } elseif ($constraint->isbn13 && !$constraint->isbn10) { + trigger_error('The "isbn13" option of the Isbn constraint is deprecated since version 2.5 and will be removed in 3.0. Use the "type" option instead.', E_USER_DEPRECATED); + $constraint->type = 'isbn13'; + } + } + + // Explicitly validate against ISBN-10 + if ('isbn10' === $constraint->type) { + if (true !== ($code = $this->validateIsbn10($canonical))) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($this->getMessage($constraint, $constraint->type)) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode($code) + ->addViolation(); + } else { + $this->buildViolation($this->getMessage($constraint, $constraint->type)) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode($code) + ->addViolation(); + } + } + + return; + } + + // Explicitly validate against ISBN-13 + if ('isbn13' === $constraint->type) { + if (true !== ($code = $this->validateIsbn13($canonical))) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($this->getMessage($constraint, $constraint->type)) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode($code) + ->addViolation(); + } else { + $this->buildViolation($this->getMessage($constraint, $constraint->type)) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode($code) + ->addViolation(); + } + } + + return; + } + + // Try both ISBNs + + // First, try ISBN-10 + $code = $this->validateIsbn10($canonical); + + // The ISBN can only be an ISBN-13 if the value was too long for ISBN-10 + if (Isbn::TOO_LONG_ERROR === $code) { + // Try ISBN-13 now + $code = $this->validateIsbn13($canonical); + + // If too short, this means we have 11 or 12 digits + if (Isbn::TOO_SHORT_ERROR === $code) { + $code = Isbn::TYPE_NOT_RECOGNIZED_ERROR; + } + } + + if (true !== $code) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($this->getMessage($constraint)) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode($code) + ->addViolation(); + } else { + $this->buildViolation($this->getMessage($constraint)) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode($code) + ->addViolation(); + } + } + } + + protected function validateIsbn10($isbn) + { + // Choose an algorithm so that ERROR_INVALID_CHARACTERS is preferred + // over ERROR_TOO_SHORT/ERROR_TOO_LONG + // Otherwise "0-45122-5244" passes, but "0-45122_5244" reports + // "too long" + + // Error priority: + // 1. ERROR_INVALID_CHARACTERS + // 2. ERROR_TOO_SHORT/ERROR_TOO_LONG + // 3. ERROR_CHECKSUM_FAILED + + $checkSum = 0; + + for ($i = 0; $i < 10; ++$i) { + // If we test the length before the loop, we get an ERROR_TOO_SHORT + // when actually an ERROR_INVALID_CHARACTERS is wanted, e.g. for + // "0-45122_5244" (typo) + if (!isset($isbn{$i})) { + return Isbn::TOO_SHORT_ERROR; + } + + if ('X' === $isbn{$i}) { + $digit = 10; + } elseif (ctype_digit($isbn{$i})) { + $digit = $isbn{$i}; + } else { + return Isbn::INVALID_CHARACTERS_ERROR; + } + + $checkSum += $digit * (10 - $i); + } + + if (isset($isbn{$i})) { + return Isbn::TOO_LONG_ERROR; + } + + return 0 === $checkSum % 11 ? true : Isbn::CHECKSUM_FAILED_ERROR; + } + + protected function validateIsbn13($isbn) + { + // Error priority: + // 1. ERROR_INVALID_CHARACTERS + // 2. ERROR_TOO_SHORT/ERROR_TOO_LONG + // 3. ERROR_CHECKSUM_FAILED + + if (!ctype_digit($isbn)) { + return Isbn::INVALID_CHARACTERS_ERROR; + } + + $length = strlen($isbn); + + if ($length < 13) { + return Isbn::TOO_SHORT_ERROR; + } + + if ($length > 13) { + return Isbn::TOO_LONG_ERROR; + } + + $checkSum = 0; + + for ($i = 0; $i < 13; $i += 2) { + $checkSum += $isbn{$i}; + } + + for ($i = 1; $i < 12; $i += 2) { + $checkSum += $isbn{$i} + * 3; + } + + return 0 === $checkSum % 10 ? true : Isbn::CHECKSUM_FAILED_ERROR; + } + + protected function getMessage($constraint, $type = null) + { + if (null !== $constraint->message) { + return $constraint->message; + } elseif ('isbn10' === $type) { + return $constraint->isbn10Message; + } elseif ('isbn13' === $type) { + return $constraint->isbn13Message; + } + + return $constraint->bothIsbnMessage; + } +} diff --git a/core/vendor/symfony/validator/Constraints/Issn.php b/core/vendor/symfony/validator/Constraints/Issn.php new file mode 100644 index 0000000..39716a2 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Issn.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Antonio J. García Lagar + * @author Bernhard Schussek + */ +class Issn extends Constraint +{ + const TOO_SHORT_ERROR = 1; + const TOO_LONG_ERROR = 2; + const MISSING_HYPHEN_ERROR = 3; + const INVALID_CHARACTERS_ERROR = 4; + const INVALID_CASE_ERROR = 5; + const CHECKSUM_FAILED_ERROR = 6; + + protected static $errorNames = array( + self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', + self::TOO_LONG_ERROR => 'TOO_LONG_ERROR', + self::MISSING_HYPHEN_ERROR => 'MISSING_HYPHEN_ERROR', + self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', + self::INVALID_CASE_ERROR => 'INVALID_CASE_ERROR', + self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR', + ); + + public $message = 'This value is not a valid ISSN.'; + public $caseSensitive = false; + public $requireHyphen = false; +} diff --git a/core/vendor/symfony/validator/Constraints/IssnValidator.php b/core/vendor/symfony/validator/Constraints/IssnValidator.php new file mode 100644 index 0000000..87bf83c --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/IssnValidator.php @@ -0,0 +1,182 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Validates whether the value is a valid ISSN. + * + * @author Antonio J. García Lagar + * @author Bernhard Schussek + * + * @see https://en.wikipedia.org/wiki/Issn + */ +class IssnValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Issn) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Issn'); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $value = (string) $value; + $canonical = $value; + + // 1234-567X + // ^ + if (isset($canonical{4}) && '-' === $canonical{4}) { + // remove hyphen + $canonical = substr($canonical, 0, 4).substr($canonical, 5); + } elseif ($constraint->requireHyphen) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::MISSING_HYPHEN_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::MISSING_HYPHEN_ERROR) + ->addViolation(); + } + + return; + } + + $length = strlen($canonical); + + if ($length < 8) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::TOO_SHORT_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::TOO_SHORT_ERROR) + ->addViolation(); + } + + return; + } + + if ($length > 8) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::TOO_LONG_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::TOO_LONG_ERROR) + ->addViolation(); + } + + return; + } + + // 1234567X + // ^^^^^^^ digits only + if (!ctype_digit(substr($canonical, 0, 7))) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::INVALID_CHARACTERS_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::INVALID_CHARACTERS_ERROR) + ->addViolation(); + } + + return; + } + + // 1234567X + // ^ digit, x or X + if (!ctype_digit($canonical{7}) && 'x' !== $canonical{7} && 'X' !== $canonical{7}) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::INVALID_CHARACTERS_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::INVALID_CHARACTERS_ERROR) + ->addViolation(); + } + + return; + } + + // 1234567X + // ^ case-sensitive? + if ($constraint->caseSensitive && 'x' === $canonical{7}) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::INVALID_CASE_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::INVALID_CASE_ERROR) + ->addViolation(); + } + + return; + } + + // Calculate a checksum. "X" equals 10. + $checkSum = 'X' === $canonical{7} || 'x' === $canonical{7} + ? 10 + : $canonical{7}; + + for ($i = 0; $i < 7; ++$i) { + // Multiply the first digit by 8, the second by 7, etc. + $checkSum += (8 - $i) * $canonical{$i}; + } + + if (0 !== $checkSum % 11) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::CHECKSUM_FAILED_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::CHECKSUM_FAILED_ERROR) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Language.php b/core/vendor/symfony/validator/Constraints/Language.php new file mode 100644 index 0000000..e7c29dc --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Language.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class Language extends Constraint +{ + public $message = 'This value is not a valid language.'; +} diff --git a/core/vendor/symfony/validator/Constraints/LanguageValidator.php b/core/vendor/symfony/validator/Constraints/LanguageValidator.php new file mode 100644 index 0000000..cc8581f --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/LanguageValidator.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Intl\Intl; +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Validates whether a value is a valid language code. + * + * @author Bernhard Schussek + * + * @api + */ +class LanguageValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Language) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Language'); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $value = (string) $value; + $languages = Intl::getLanguageBundle()->getLanguageNames(); + + if (!isset($languages[$value])) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Length.php b/core/vendor/symfony/validator/Constraints/Length.php new file mode 100644 index 0000000..8d00480 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Length.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\MissingOptionsException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class Length extends Constraint +{ + const TOO_SHORT_ERROR = 1; + const TOO_LONG_ERROR = 2; + + protected static $errorNames = array( + self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', + self::TOO_LONG_ERROR => 'TOO_LONG_ERROR', + ); + + public $maxMessage = 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.'; + public $minMessage = 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.'; + public $exactMessage = 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.'; + public $charsetMessage = 'This value does not match the expected {{ charset }} charset.'; + public $max; + public $min; + public $charset = 'UTF-8'; + + public function __construct($options = null) + { + if (null !== $options && !is_array($options)) { + $options = array( + 'min' => $options, + 'max' => $options, + ); + } + + parent::__construct($options); + + if (null === $this->min && null === $this->max) { + throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), array('min', 'max')); + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/LengthValidator.php b/core/vendor/symfony/validator/Constraints/LengthValidator.php new file mode 100644 index 0000000..bfa7b19 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/LengthValidator.php @@ -0,0 +1,127 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + */ +class LengthValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Length) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Length'); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $stringValue = (string) $value; + $invalidCharset = false; + + if ('UTF8' === $charset = strtoupper($constraint->charset)) { + $charset = 'UTF-8'; + } + + if (function_exists('iconv_strlen')) { + $length = @iconv_strlen($stringValue, $constraint->charset); + $invalidCharset = false === $length; + } elseif (function_exists('mb_strlen')) { + if (mb_check_encoding($stringValue, $constraint->charset)) { + $length = mb_strlen($stringValue, $constraint->charset); + } else { + $invalidCharset = true; + } + } elseif ('UTF-8' !== $charset) { + $length = strlen($stringValue); + } elseif (!preg_match('//u', $stringValue)) { + $invalidCharset = true; + } elseif (function_exists('utf8_decode')) { + $length = strlen(utf8_decode($stringValue)); + } else { + preg_replace('/./u', '', $stringValue, -1, $length); + } + + if ($invalidCharset) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->charsetMessage) + ->setParameter('{{ value }}', $this->formatValue($stringValue)) + ->setParameter('{{ charset }}', $constraint->charset) + ->setInvalidValue($value) + ->addViolation(); + } else { + $this->buildViolation($constraint->charsetMessage) + ->setParameter('{{ value }}', $this->formatValue($stringValue)) + ->setParameter('{{ charset }}', $constraint->charset) + ->setInvalidValue($value) + ->addViolation(); + } + + return; + } + + if (null !== $constraint->max && $length > $constraint->max) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->min == $constraint->max ? $constraint->exactMessage : $constraint->maxMessage) + ->setParameter('{{ value }}', $this->formatValue($stringValue)) + ->setParameter('{{ limit }}', $constraint->max) + ->setInvalidValue($value) + ->setPlural((int) $constraint->max) + ->setCode(Length::TOO_LONG_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->min == $constraint->max ? $constraint->exactMessage : $constraint->maxMessage) + ->setParameter('{{ value }}', $this->formatValue($stringValue)) + ->setParameter('{{ limit }}', $constraint->max) + ->setInvalidValue($value) + ->setPlural((int) $constraint->max) + ->setCode(Length::TOO_LONG_ERROR) + ->addViolation(); + } + + return; + } + + if (null !== $constraint->min && $length < $constraint->min) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->min == $constraint->max ? $constraint->exactMessage : $constraint->minMessage) + ->setParameter('{{ value }}', $this->formatValue($stringValue)) + ->setParameter('{{ limit }}', $constraint->min) + ->setInvalidValue($value) + ->setPlural((int) $constraint->min) + ->setCode(Length::TOO_SHORT_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->min == $constraint->max ? $constraint->exactMessage : $constraint->minMessage) + ->setParameter('{{ value }}', $this->formatValue($stringValue)) + ->setParameter('{{ limit }}', $constraint->min) + ->setInvalidValue($value) + ->setPlural((int) $constraint->min) + ->setCode(Length::TOO_SHORT_ERROR) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/LessThan.php b/core/vendor/symfony/validator/Constraints/LessThan.php new file mode 100644 index 0000000..b116320 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/LessThan.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Daniel Holmes + */ +class LessThan extends AbstractComparison +{ + public $message = 'This value should be less than {{ compared_value }}.'; +} diff --git a/core/vendor/symfony/validator/Constraints/LessThanOrEqual.php b/core/vendor/symfony/validator/Constraints/LessThanOrEqual.php new file mode 100644 index 0000000..7faca84 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/LessThanOrEqual.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Daniel Holmes + */ +class LessThanOrEqual extends AbstractComparison +{ + public $message = 'This value should be less than or equal to {{ compared_value }}.'; +} diff --git a/core/vendor/symfony/validator/Constraints/LessThanOrEqualValidator.php b/core/vendor/symfony/validator/Constraints/LessThanOrEqualValidator.php new file mode 100644 index 0000000..dcc93b2 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/LessThanOrEqualValidator.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Validates values are less than or equal to the previous (<=). + * + * @author Daniel Holmes + */ +class LessThanOrEqualValidator extends AbstractComparisonValidator +{ + /** + * {@inheritdoc} + */ + protected function compareValues($value1, $value2) + { + return $value1 <= $value2; + } +} diff --git a/core/vendor/symfony/validator/Constraints/LessThanValidator.php b/core/vendor/symfony/validator/Constraints/LessThanValidator.php new file mode 100644 index 0000000..081316a --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/LessThanValidator.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Validates values are less than the previous (<). + * + * @author Daniel Holmes + */ +class LessThanValidator extends AbstractComparisonValidator +{ + /** + * {@inheritdoc} + */ + protected function compareValues($value1, $value2) + { + return $value1 < $value2; + } +} diff --git a/core/vendor/symfony/validator/Constraints/Locale.php b/core/vendor/symfony/validator/Constraints/Locale.php new file mode 100644 index 0000000..12a5546 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Locale.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class Locale extends Constraint +{ + public $message = 'This value is not a valid locale.'; +} diff --git a/core/vendor/symfony/validator/Constraints/LocaleValidator.php b/core/vendor/symfony/validator/Constraints/LocaleValidator.php new file mode 100644 index 0000000..a5f6927 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/LocaleValidator.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Intl\Intl; +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Validates whether a value is a valid locale code. + * + * @author Bernhard Schussek + * + * @api + */ +class LocaleValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Locale) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Locale'); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $value = (string) $value; + $locales = Intl::getLocaleBundle()->getLocaleNames(); + + if (!isset($locales[$value])) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Luhn.php b/core/vendor/symfony/validator/Constraints/Luhn.php new file mode 100644 index 0000000..24f5bc7 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Luhn.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * Metadata for the LuhnValidator. + * + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Tim Nagel + * @author Greg Knapp http://gregk.me/2011/php-implementation-of-bank-card-luhn-algorithm/ + * @author Bernhard Schussek + */ +class Luhn extends Constraint +{ + const INVALID_CHARACTERS_ERROR = 1; + const CHECKSUM_FAILED_ERROR = 2; + + protected static $errorNames = array( + self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', + self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR', + ); + + public $message = 'Invalid card number.'; +} diff --git a/core/vendor/symfony/validator/Constraints/LuhnValidator.php b/core/vendor/symfony/validator/Constraints/LuhnValidator.php new file mode 100644 index 0000000..31d4497 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/LuhnValidator.php @@ -0,0 +1,111 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Validates a PAN using the LUHN Algorithm. + * + * For a list of example card numbers that are used to test this + * class, please see the LuhnValidatorTest class. + * + * @see http://en.wikipedia.org/wiki/Luhn_algorithm + * + * @author Tim Nagel + * @author Greg Knapp http://gregk.me/2011/php-implementation-of-bank-card-luhn-algorithm/ + * @author Bernhard Schussek + */ +class LuhnValidator extends ConstraintValidator +{ + /** + * Validates a credit card number with the Luhn algorithm. + * + * @param mixed $value + * @param Constraint $constraint + * + * @throws UnexpectedTypeException when the given credit card number is no string + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Luhn) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Luhn'); + } + + if (null === $value || '' === $value) { + return; + } + + // Work with strings only, because long numbers are represented as floats + // internally and don't work with strlen() + if (!is_string($value) && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $value = (string) $value; + + if (!ctype_digit($value)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Luhn::INVALID_CHARACTERS_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Luhn::INVALID_CHARACTERS_ERROR) + ->addViolation(); + } + + return; + } + + $checkSum = 0; + $length = strlen($value); + + // Starting with the last digit and walking left, add every second + // digit to the check sum + // e.g. 7 9 9 2 7 3 9 8 7 1 3 + // ^ ^ ^ ^ ^ ^ + // = 7 + 9 + 7 + 9 + 7 + 3 + for ($i = $length - 1; $i >= 0; $i -= 2) { + $checkSum += $value{$i}; + } + + // Starting with the second last digit and walking left, double every + // second digit and add it to the check sum + // For doubles greater than 9, sum the individual digits + // e.g. 7 9 9 2 7 3 9 8 7 1 3 + // ^ ^ ^ ^ ^ + // = 1+8 + 4 + 6 + 1+6 + 2 + for ($i = $length - 2; $i >= 0; $i -= 2) { + $checkSum += array_sum(str_split($value{$i} * 2)); + } + + if (0 === $checkSum || 0 !== $checkSum % 10) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Luhn::CHECKSUM_FAILED_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Luhn::CHECKSUM_FAILED_ERROR) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/NotBlank.php b/core/vendor/symfony/validator/Constraints/NotBlank.php new file mode 100644 index 0000000..c578c6d --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/NotBlank.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class NotBlank extends Constraint +{ + public $message = 'This value should not be blank.'; +} diff --git a/core/vendor/symfony/validator/Constraints/NotBlankValidator.php b/core/vendor/symfony/validator/Constraints/NotBlankValidator.php new file mode 100644 index 0000000..a435701 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/NotBlankValidator.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + * + * @api + */ +class NotBlankValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof NotBlank) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\NotBlank'); + } + + if (false === $value || (empty($value) && '0' != $value)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/NotEqualTo.php b/core/vendor/symfony/validator/Constraints/NotEqualTo.php new file mode 100644 index 0000000..abd8092 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/NotEqualTo.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Daniel Holmes + */ +class NotEqualTo extends AbstractComparison +{ + public $message = 'This value should not be equal to {{ compared_value }}.'; +} diff --git a/core/vendor/symfony/validator/Constraints/NotEqualToValidator.php b/core/vendor/symfony/validator/Constraints/NotEqualToValidator.php new file mode 100644 index 0000000..5710a85 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/NotEqualToValidator.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Validates values are all unequal (!=). + * + * @author Daniel Holmes + */ +class NotEqualToValidator extends AbstractComparisonValidator +{ + /** + * {@inheritdoc} + */ + protected function compareValues($value1, $value2) + { + return $value1 != $value2; + } +} diff --git a/core/vendor/symfony/validator/Constraints/NotIdenticalTo.php b/core/vendor/symfony/validator/Constraints/NotIdenticalTo.php new file mode 100644 index 0000000..fb4ef3f --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/NotIdenticalTo.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Daniel Holmes + */ +class NotIdenticalTo extends AbstractComparison +{ + public $message = 'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.'; +} diff --git a/core/vendor/symfony/validator/Constraints/NotIdenticalToValidator.php b/core/vendor/symfony/validator/Constraints/NotIdenticalToValidator.php new file mode 100644 index 0000000..ed8dc1c --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/NotIdenticalToValidator.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Validates values aren't identical (!==). + * + * @author Daniel Holmes + */ +class NotIdenticalToValidator extends AbstractComparisonValidator +{ + /** + * {@inheritdoc} + */ + protected function compareValues($value1, $value2) + { + return $value1 !== $value2; + } +} diff --git a/core/vendor/symfony/validator/Constraints/NotNull.php b/core/vendor/symfony/validator/Constraints/NotNull.php new file mode 100644 index 0000000..60416c7 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/NotNull.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class NotNull extends Constraint +{ + public $message = 'This value should not be null.'; +} diff --git a/core/vendor/symfony/validator/Constraints/NotNullValidator.php b/core/vendor/symfony/validator/Constraints/NotNullValidator.php new file mode 100644 index 0000000..a7a905a --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/NotNullValidator.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + * + * @api + */ +class NotNullValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof NotNull) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\NotNull'); + } + + if (null === $value) { + $this->context->addViolation($constraint->message); + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Null.php b/core/vendor/symfony/validator/Constraints/Null.php new file mode 100644 index 0000000..3104550 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Null.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class Null extends Constraint +{ + public $message = 'This value should be null.'; +} diff --git a/core/vendor/symfony/validator/Constraints/NullValidator.php b/core/vendor/symfony/validator/Constraints/NullValidator.php new file mode 100644 index 0000000..5093331 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/NullValidator.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + * + * @api + */ +class NullValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Null) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Null'); + } + + if (null !== $value) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Optional.php b/core/vendor/symfony/validator/Constraints/Optional.php new file mode 100644 index 0000000..dab8b43 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Optional.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"ANNOTATION"}) + * + * @author Bernhard Schussek + */ +class Optional extends Existence +{ +} diff --git a/core/vendor/symfony/validator/Constraints/Range.php b/core/vendor/symfony/validator/Constraints/Range.php new file mode 100644 index 0000000..a12afff --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Range.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\MissingOptionsException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class Range extends Constraint +{ + const INVALID_VALUE_ERROR = 1; + const BEYOND_RANGE_ERROR = 2; + const BELOW_RANGE_ERROR = 3; + + protected static $errorNames = array( + self::INVALID_VALUE_ERROR => 'INVALID_VALUE_ERROR', + self::BEYOND_RANGE_ERROR => 'BEYOND_RANGE_ERROR', + self::BELOW_RANGE_ERROR => 'BELOW_RANGE_ERROR', + ); + + public $minMessage = 'This value should be {{ limit }} or more.'; + public $maxMessage = 'This value should be {{ limit }} or less.'; + public $invalidMessage = 'This value should be a valid number.'; + public $min; + public $max; + + public function __construct($options = null) + { + parent::__construct($options); + + if (null === $this->min && null === $this->max) { + throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), array('min', 'max')); + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/RangeValidator.php b/core/vendor/symfony/validator/Constraints/RangeValidator.php new file mode 100644 index 0000000..8f5fdda --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/RangeValidator.php @@ -0,0 +1,104 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + */ +class RangeValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Range) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Range'); + } + + if (null === $value) { + return; + } + + if (!is_numeric($value) && !$value instanceof \DateTime && !$value instanceof \DateTimeInterface) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->invalidMessage) + ->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE)) + ->setCode(Range::INVALID_VALUE_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->invalidMessage) + ->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE)) + ->setCode(Range::INVALID_VALUE_ERROR) + ->addViolation(); + } + + return; + } + + $min = $constraint->min; + $max = $constraint->max; + + // Convert strings to DateTimes if comparing another DateTime + // This allows to compare with any date/time value supported by + // the DateTime constructor: + // http://php.net/manual/en/datetime.formats.php + if ($value instanceof \DateTime || $value instanceof \DateTimeInterface) { + if (is_string($min)) { + $min = new \DateTime($min); + } + + if (is_string($max)) { + $max = new \DateTime($max); + } + } + + if (null !== $constraint->max && $value > $max) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->maxMessage) + ->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE)) + ->setParameter('{{ limit }}', $this->formatValue($max, self::PRETTY_DATE)) + ->setCode(Range::BEYOND_RANGE_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->maxMessage) + ->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE)) + ->setParameter('{{ limit }}', $this->formatValue($max, self::PRETTY_DATE)) + ->setCode(Range::BEYOND_RANGE_ERROR) + ->addViolation(); + } + + return; + } + + if (null !== $constraint->min && $value < $min) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->minMessage) + ->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE)) + ->setParameter('{{ limit }}', $this->formatValue($min, self::PRETTY_DATE)) + ->setCode(Range::BELOW_RANGE_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->minMessage) + ->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE)) + ->setParameter('{{ limit }}', $this->formatValue($min, self::PRETTY_DATE)) + ->setCode(Range::BELOW_RANGE_ERROR) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Regex.php b/core/vendor/symfony/validator/Constraints/Regex.php new file mode 100644 index 0000000..3cdf514 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Regex.php @@ -0,0 +1,98 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class Regex extends Constraint +{ + public $message = 'This value is not valid.'; + public $pattern; + public $htmlPattern; + public $match = true; + + /** + * {@inheritdoc} + */ + public function getDefaultOption() + { + return 'pattern'; + } + + /** + * {@inheritdoc} + */ + public function getRequiredOptions() + { + return array('pattern'); + } + + /** + * Converts the htmlPattern to a suitable format for HTML5 pattern. + * Example: /^[a-z]+$/ would be converted to [a-z]+ + * However, if options are specified, it cannot be converted. + * + * Pattern is also ignored if match=false since the pattern should + * then be reversed before application. + * + * @link http://dev.w3.org/html5/spec/single-page.html#the-pattern-attribute + * + * @return string|null + */ + public function getHtmlPattern() + { + // If htmlPattern is specified, use it + if (null !== $this->htmlPattern) { + return empty($this->htmlPattern) + ? null + : $this->htmlPattern; + } + + // Quit if delimiters not at very beginning/end (e.g. when options are passed) + if ($this->pattern[0] !== $this->pattern[strlen($this->pattern) - 1]) { + return; + } + + $delimiter = $this->pattern[0]; + + // Unescape the delimiter + $pattern = str_replace('\\'.$delimiter, $delimiter, substr($this->pattern, 1, -1)); + + // If the pattern is inverted, we can simply wrap it in + // ((?!pattern).)* + if (!$this->match) { + return '((?!'.$pattern.').)*'; + } + + // If the pattern contains an or statement, wrap the pattern in + // .*(pattern).* and quit. Otherwise we'd need to parse the pattern + if (false !== strpos($pattern, '|')) { + return '.*('.$pattern.').*'; + } + + // Trim leading ^, otherwise prepend .* + $pattern = '^' === $pattern[0] ? substr($pattern, 1) : '.*'.$pattern; + + // Trim trailing $, otherwise append .* + $pattern = '$' === $pattern[strlen($pattern) - 1] ? substr($pattern, 0, -1) : $pattern.'.*'; + + return $pattern; + } +} diff --git a/core/vendor/symfony/validator/Constraints/RegexValidator.php b/core/vendor/symfony/validator/Constraints/RegexValidator.php new file mode 100644 index 0000000..45ba979 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/RegexValidator.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Validates whether a value match or not given regexp pattern. + * + * @author Bernhard Schussek + * @author Joseph Bielawski + * + * @api + */ +class RegexValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Regex) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Regex'); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $value = (string) $value; + + if ($constraint->match xor preg_match($constraint->pattern, $value)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Required.php b/core/vendor/symfony/validator/Constraints/Required.php new file mode 100644 index 0000000..bd77a90 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Required.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"ANNOTATION"}) + * + * @author Bernhard Schussek + */ +class Required extends Existence +{ +} diff --git a/core/vendor/symfony/validator/Constraints/Time.php b/core/vendor/symfony/validator/Constraints/Time.php new file mode 100644 index 0000000..7998c6f --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Time.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class Time extends Constraint +{ + const INVALID_FORMAT_ERROR = 1; + const INVALID_TIME_ERROR = 2; + + protected static $errorNames = array( + self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', + self::INVALID_TIME_ERROR => 'INVALID_TIME_ERROR', + ); + + public $message = 'This value is not a valid time.'; +} diff --git a/core/vendor/symfony/validator/Constraints/TimeValidator.php b/core/vendor/symfony/validator/Constraints/TimeValidator.php new file mode 100644 index 0000000..1a173a1 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/TimeValidator.php @@ -0,0 +1,93 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + * + * @api + */ +class TimeValidator extends ConstraintValidator +{ + const PATTERN = '/^(\d{2}):(\d{2}):(\d{2})$/'; + + /** + * Checks whether a time is valid. + * + * @param int $hour The hour + * @param int $minute The minute + * @param int $second The second + * + * @return bool Whether the time is valid + * + * @internal + */ + public static function checkTime($hour, $minute, $second) + { + return $hour >= 0 && $hour < 24 && $minute >= 0 && $minute < 60 && $second >= 0 && $second < 60; + } + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Time) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Time'); + } + + if (null === $value || '' === $value || $value instanceof \DateTime) { + return; + } + + if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $value = (string) $value; + + if (!preg_match(static::PATTERN, $value, $matches)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Time::INVALID_FORMAT_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Time::INVALID_FORMAT_ERROR) + ->addViolation(); + } + + return; + } + + if (!self::checkTime($matches[1], $matches[2], $matches[3])) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Time::INVALID_TIME_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Time::INVALID_TIME_ERROR) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Traverse.php b/core/vendor/symfony/validator/Constraints/Traverse.php new file mode 100644 index 0000000..4abae6c --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Traverse.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * @Annotation + * + * @since 2.5 + * @author Bernhard Schussek + */ +class Traverse extends Constraint +{ + public $traverse = true; + + public function __construct($options = null) + { + if (is_array($options) && array_key_exists('groups', $options)) { + throw new ConstraintDefinitionException(sprintf( + 'The option "groups" is not supported by the constraint %s', + __CLASS__ + )); + } + + parent::__construct($options); + } + + /** + * {@inheritdoc} + */ + public function getDefaultOption() + { + return 'traverse'; + } + + /** + * {@inheritdoc} + */ + public function getTargets() + { + return self::CLASS_CONSTRAINT; + } +} diff --git a/core/vendor/symfony/validator/Constraints/True.php b/core/vendor/symfony/validator/Constraints/True.php new file mode 100644 index 0000000..788e36a --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/True.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class True extends Constraint +{ + public $message = 'This value should be true.'; +} diff --git a/core/vendor/symfony/validator/Constraints/TrueValidator.php b/core/vendor/symfony/validator/Constraints/TrueValidator.php new file mode 100644 index 0000000..2c0340c --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/TrueValidator.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + * + * @api + */ +class TrueValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof True) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\True'); + } + + if (null === $value) { + return; + } + + if (true !== $value && 1 !== $value && '1' !== $value) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Type.php b/core/vendor/symfony/validator/Constraints/Type.php new file mode 100644 index 0000000..fc4cc72 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Type.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class Type extends Constraint +{ + public $message = 'This value should be of type {{ type }}.'; + public $type; + + /** + * {@inheritdoc} + */ + public function getDefaultOption() + { + return 'type'; + } + + /** + * {@inheritdoc} + */ + public function getRequiredOptions() + { + return array('type'); + } +} diff --git a/core/vendor/symfony/validator/Constraints/TypeValidator.php b/core/vendor/symfony/validator/Constraints/TypeValidator.php new file mode 100644 index 0000000..30ad278 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/TypeValidator.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + * + * @api + */ +class TypeValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Type) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Type'); + } + + if (null === $value) { + return; + } + + $type = strtolower($constraint->type); + $type = $type == 'boolean' ? 'bool' : $constraint->type; + $isFunction = 'is_'.$type; + $ctypeFunction = 'ctype_'.$type; + + if (function_exists($isFunction) && $isFunction($value)) { + return; + } elseif (function_exists($ctypeFunction) && $ctypeFunction($value)) { + return; + } elseif ($value instanceof $constraint->type) { + return; + } + + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setParameter('{{ type }}', $constraint->type) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setParameter('{{ type }}', $constraint->type) + ->addViolation(); + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Url.php b/core/vendor/symfony/validator/Constraints/Url.php new file mode 100644 index 0000000..7b8ef3f --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Url.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class Url extends Constraint +{ + public $message = 'This value is not a valid URL.'; + public $dnsMessage = 'The host could not be resolved.'; + public $protocols = array('http', 'https'); + public $checkDNS = false; +} diff --git a/core/vendor/symfony/validator/Constraints/UrlValidator.php b/core/vendor/symfony/validator/Constraints/UrlValidator.php new file mode 100644 index 0000000..b38f8da --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/UrlValidator.php @@ -0,0 +1,92 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + * + * @api + */ +class UrlValidator extends ConstraintValidator +{ + const PATTERN = '~^ + (%s):// # protocol + (([\pL\pN-]+:)?([\pL\pN-]+)@)? # basic auth + ( + ([\pL\pN\pS-\.])+(\.?([\pL]|xn\-\-[\pL\pN-]+)+\.?) # a domain name + | # or + \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # a IP address + | # or + \[ + (?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,1}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,2}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,3}(?:(?:[0-9a-f]{1,4})))?::(?:(?:[0-9a-f]{1,4})):)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,4}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::)))) + \] # a IPv6 address + ) + (:[0-9]+)? # a port (optional) + (/?|/\S+) # a /, nothing or a / with something + $~ixu'; + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Url) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Url'); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $value = (string) $value; + $pattern = sprintf(static::PATTERN, implode('|', $constraint->protocols)); + + if (!preg_match($pattern, $value)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->addViolation(); + } + + return; + } + + if ($constraint->checkDNS) { + $host = parse_url($value, PHP_URL_HOST); + + if (!checkdnsrr($host, 'ANY')) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->dnsMessage) + ->setParameter('{{ value }}', $this->formatValue($host)) + ->addViolation(); + } else { + $this->buildViolation($constraint->dnsMessage) + ->setParameter('{{ value }}', $this->formatValue($host)) + ->addViolation(); + } + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Uuid.php b/core/vendor/symfony/validator/Constraints/Uuid.php new file mode 100644 index 0000000..3c67a3a --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Uuid.php @@ -0,0 +1,77 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * + * @author Colin O'Dell + * @author Bernhard Schussek + */ +class Uuid extends Constraint +{ + const TOO_SHORT_ERROR = 1; + const TOO_LONG_ERROR = 2; + const INVALID_CHARACTERS_ERROR = 3; + const INVALID_HYPHEN_PLACEMENT_ERROR = 4; + const INVALID_VERSION_ERROR = 5; + const INVALID_VARIANT_ERROR = 6; + + protected static $errorNames = array( + self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', + self::TOO_LONG_ERROR => 'TOO_LONG_ERROR', + self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', + self::INVALID_HYPHEN_PLACEMENT_ERROR => 'INVALID_HYPHEN_PLACEMENT_ERROR', + self::INVALID_VERSION_ERROR => 'INVALID_VERSION_ERROR', + self::INVALID_VARIANT_ERROR => 'INVALID_VARIANT_ERROR', + ); + + // Possible versions defined by RFC 4122 + const V1_MAC = 1; + const V2_DCE = 2; + const V3_MD5 = 3; + const V4_RANDOM = 4; + const V5_SHA1 = 5; + + /** + * Message to display when validation fails + * + * @var string + */ + public $message = 'This is not a valid UUID.'; + + /** + * Strict mode only allows UUIDs that meet the formal definition and formatting per RFC 4122 + * + * Set this to `false` to allow legacy formats with different dash positioning or wrapping characters + * + * @var bool + */ + public $strict = true; + + /** + * Array of allowed versions (see version constants above) + * + * All UUID versions are allowed by default + * + * @var int[] + */ + public $versions = array( + self::V1_MAC, + self::V2_DCE, + self::V3_MD5, + self::V4_RANDOM, + self::V5_SHA1, + ); +} diff --git a/core/vendor/symfony/validator/Constraints/UuidValidator.php b/core/vendor/symfony/validator/Constraints/UuidValidator.php new file mode 100644 index 0000000..d64e6a4 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/UuidValidator.php @@ -0,0 +1,346 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Constraints\Deprecated\UuidValidator as Deprecated; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Validates whether the value is a valid UUID per RFC 4122. + * + * @author Colin O'Dell + * @author Bernhard Schussek + * + * @see http://tools.ietf.org/html/rfc4122 + * @see https://en.wikipedia.org/wiki/Universally_unique_identifier + */ +class UuidValidator extends ConstraintValidator +{ + // The strict pattern matches UUIDs like this: + // xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx + + // Roughly speaking: + // x = any hexadecimal character + // M = any allowed version {1..5} + // N = any allowed variant {8, 9, a, b} + + const STRICT_LENGTH = 36; + const STRICT_FIRST_HYPHEN_POSITION = 8; + const STRICT_LAST_HYPHEN_POSITION = 23; + const STRICT_VERSION_POSITION = 14; + const STRICT_VARIANT_POSITION = 19; + + // The loose pattern validates similar yet non-compliant UUIDs. + // Hyphens are completely optional. If present, they should only appear + // between every fourth character: + // xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx + // xxxxxxxxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx + // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + + // The value can also be wrapped with characters like []{}: + // {xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx} + + // Neither the version nor the variant is validated by this pattern. + + const LOOSE_MAX_LENGTH = 39; + const LOOSE_FIRST_HYPHEN_POSITION = 4; + + /** + * @deprecated since version 2.6, to be removed in 3.0 + */ + const STRICT_PATTERN = '/^[a-f0-9]{8}-[a-f0-9]{4}-[%s][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i'; + + /** + * @deprecated since version 2.6, to be removed in 3.0 + */ + const LOOSE_PATTERN = '/^[a-f0-9]{4}(?:-?[a-f0-9]{4}){7}$/i'; + + /** + * @deprecated since version 2.6, to be removed in 3.0 + */ + const STRICT_UUID_LENGTH = 36; + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $value = (string) $value; + + if ($constraint->strict) { + $this->validateStrict($value, $constraint); + + return; + } + + $this->validateLoose($value, $constraint); + } + + private function validateLoose($value, Uuid $constraint) + { + // Error priority: + // 1. ERROR_INVALID_CHARACTERS + // 2. ERROR_INVALID_HYPHEN_PLACEMENT + // 3. ERROR_TOO_SHORT/ERROR_TOO_LONG + + // Trim any wrapping characters like [] or {} used by some legacy systems + $trimmed = trim($value, '[]{}'); + + // Position of the next expected hyphen + $h = self::LOOSE_FIRST_HYPHEN_POSITION; + + // Expected length + $l = self::LOOSE_MAX_LENGTH; + + for ($i = 0; $i < $l; ++$i) { + // Check length + if (!isset($trimmed{$i})) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::TOO_SHORT_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::TOO_SHORT_ERROR) + ->addViolation(); + } + + return; + } + + // Hyphens must occur every fifth position + // xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx + // ^ ^ ^ ^ ^ ^ ^ + if ('-' === $trimmed{$i}) { + if ($i !== $h) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) + ->addViolation(); + } + + return; + } + + $h += 5; + + continue; + } + + // Missing hyphens are ignored + if ($i === $h) { + $h += 4; + --$l; + } + + // Check characters + if (!ctype_xdigit($trimmed{$i})) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_CHARACTERS_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_CHARACTERS_ERROR) + ->addViolation(); + } + + return; + } + } + + // Check length again + if (isset($trimmed{$i})) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::TOO_LONG_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::TOO_LONG_ERROR) + ->addViolation(); + } + } + } + + private function validateStrict($value, Uuid $constraint) + { + // Error priority: + // 1. ERROR_INVALID_CHARACTERS + // 2. ERROR_INVALID_HYPHEN_PLACEMENT + // 3. ERROR_TOO_SHORT/ERROR_TOO_LONG + // 4. ERROR_INVALID_VERSION + // 5. ERROR_INVALID_VARIANT + + // Position of the next expected hyphen + $h = self::STRICT_FIRST_HYPHEN_POSITION; + + for ($i = 0; $i < self::STRICT_LENGTH; ++$i) { + // Check length + if (!isset($value{$i})) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::TOO_SHORT_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::TOO_SHORT_ERROR) + ->addViolation(); + } + + return; + } + + // Check hyphen placement + // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + // ^ ^ ^ ^ + if ('-' === $value{$i}) { + if ($i !== $h) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter( + '{{ value }}', + $this->formatValue($value) + ) + ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter( + '{{ value }}', + $this->formatValue($value) + ) + ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) + ->addViolation(); + } + + return; + } + + // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + // ^ + if ($h < self::STRICT_LAST_HYPHEN_POSITION) { + $h += 5; + } + + continue; + } + + // Check characters + if (!ctype_xdigit($value{$i})) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_CHARACTERS_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_CHARACTERS_ERROR) + ->addViolation(); + } + + return; + } + + // Missing hyphen + if ($i === $h) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) + ->addViolation(); + } + + return; + } + } + + // Check length again + if (isset($value{$i})) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::TOO_LONG_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::TOO_LONG_ERROR) + ->addViolation(); + } + } + + // Check version + if (!in_array($value{self::STRICT_VERSION_POSITION}, $constraint->versions)) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_VERSION_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_VERSION_ERROR) + ->addViolation(); + } + } + + // Check variant - first two bits must equal "10" + // 0b10xx + // & 0b1100 (12) + // = 0b1000 (8) + if ((hexdec($value{self::STRICT_VARIANT_POSITION}) & 12) !== 8) { + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_VARIANT_ERROR) + ->addViolation(); + } else { + $this->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_VARIANT_ERROR) + ->addViolation(); + } + } + } +} diff --git a/core/vendor/symfony/validator/Constraints/Valid.php b/core/vendor/symfony/validator/Constraints/Valid.php new file mode 100644 index 0000000..cb520c9 --- /dev/null +++ b/core/vendor/symfony/validator/Constraints/Valid.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * + * @api + */ +class Valid extends Constraint +{ + public $traverse = true; + + /** + * @deprecated since version 2.5, to be removed in Symfony 3.0. + */ + public $deep = true; + + public function __construct($options = null) + { + if (is_array($options) && array_key_exists('groups', $options)) { + throw new ConstraintDefinitionException(sprintf( + 'The option "groups" is not supported by the constraint %s', + __CLASS__ + )); + } + + if (is_array($options) && array_key_exists('deep', $options)) { + trigger_error('The "deep" option for the Valid constraint is deprecated since version 2.5 and will be removed in 3.0. When traversing arrays, nested arrays are always traversed. When traversing nested objects, their traversal strategy is used.', E_USER_DEPRECATED); + } + + parent::__construct($options); + } +} diff --git a/core/vendor/symfony/validator/Context/ExecutionContext.php b/core/vendor/symfony/validator/Context/ExecutionContext.php new file mode 100644 index 0000000..39f7d15 --- /dev/null +++ b/core/vendor/symfony/validator/Context/ExecutionContext.php @@ -0,0 +1,463 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Context; + +use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Component\Validator\ClassBasedInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\Valid; +use Symfony\Component\Validator\ConstraintViolation; +use Symfony\Component\Validator\ConstraintViolationList; +use Symfony\Component\Validator\Mapping\MetadataInterface; +use Symfony\Component\Validator\Mapping\PropertyMetadataInterface; +use Symfony\Component\Validator\Util\PropertyPath; +use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface; +use Symfony\Component\Validator\Violation\ConstraintViolationBuilder; + +/** + * The context used and created by {@link ExecutionContextFactory}. + * + * @since 2.5 + * @author Bernhard Schussek + * + * @see ExecutionContextInterface + * + * @internal You should not instantiate or use this class. Code against + * {@link ExecutionContextInterface} instead. + */ +class ExecutionContext implements ExecutionContextInterface +{ + /** + * @var ValidatorInterface + */ + private $validator; + + /** + * The root value of the validated object graph. + * + * @var mixed + */ + private $root; + + /** + * @var TranslatorInterface + */ + private $translator; + + /** + * @var string + */ + private $translationDomain; + + /** + * The violations generated in the current context. + * + * @var ConstraintViolationList + */ + private $violations; + + /** + * The currently validated value. + * + * @var mixed + */ + private $value; + + /** + * The currently validated object. + * + * @var object|null + */ + private $object; + + /** + * The property path leading to the current value. + * + * @var string + */ + private $propertyPath = ''; + + /** + * The current validation metadata. + * + * @var MetadataInterface|null + */ + private $metadata; + + /** + * The currently validated group. + * + * @var string|null + */ + private $group; + + /** + * The currently validated constraint. + * + * @var Constraint|null + */ + private $constraint; + + /** + * Stores which objects have been validated in which group. + * + * @var array + */ + private $validatedObjects = array(); + + /** + * Stores which class constraint has been validated for which object. + * + * @var array + */ + private $validatedConstraints = array(); + + /** + * Stores which objects have been initialized. + * + * @var array + */ + private $initializedObjects; + + /** + * Creates a new execution context. + * + * @param ValidatorInterface $validator The validator + * @param mixed $root The root value of the + * validated object graph + * @param TranslatorInterface $translator The translator + * @param string|null $translationDomain The translation domain to + * use for translating + * violation messages + * + * @internal Called by {@link ExecutionContextFactory}. Should not be used + * in user code. + */ + public function __construct(ValidatorInterface $validator, $root, TranslatorInterface $translator, $translationDomain = null) + { + $this->validator = $validator; + $this->root = $root; + $this->translator = $translator; + $this->translationDomain = $translationDomain; + $this->violations = new ConstraintViolationList(); + } + + /** + * {@inheritdoc} + */ + public function setNode($value, $object, MetadataInterface $metadata = null, $propertyPath) + { + $this->value = $value; + $this->object = $object; + $this->metadata = $metadata; + $this->propertyPath = (string) $propertyPath; + } + + /** + * {@inheritdoc} + */ + public function setGroup($group) + { + $this->group = $group; + } + + /** + * {@inheritdoc} + */ + public function setConstraint(Constraint $constraint) + { + $this->constraint = $constraint; + } + + /** + * {@inheritdoc} + */ + public function addViolation($message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null) + { + // The parameters $invalidValue and following are ignored by the new + // API, as they are not present in the new interface anymore. + // You should use buildViolation() instead. + if (func_num_args() > 2) { + trigger_error('The parameters $invalidValue, $plural and $code in method '.__METHOD__.' are deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::buildViolation method instead.', E_USER_DEPRECATED); + + $this + ->buildViolation($message, $parameters) + ->setInvalidValue($invalidValue) + ->setPlural($plural) + ->setCode($code) + ->addViolation() + ; + + return; + } + + $this->violations->add(new ConstraintViolation( + $this->translator->trans($message, $parameters, $this->translationDomain), + $message, + $parameters, + $this->root, + $this->propertyPath, + $this->value, + null, + null, + $this->constraint + )); + } + + /** + * {@inheritdoc} + */ + public function buildViolation($message, array $parameters = array()) + { + return new ConstraintViolationBuilder( + $this->violations, + $this->constraint, + $message, + $parameters, + $this->root, + $this->propertyPath, + $this->value, + $this->translator, + $this->translationDomain + ); + } + + /** + * {@inheritdoc} + */ + public function getViolations() + { + return $this->violations; + } + + /** + * {@inheritdoc} + */ + public function getValidator() + { + return $this->validator; + } + + /** + * {@inheritdoc} + */ + public function getRoot() + { + return $this->root; + } + + /** + * {@inheritdoc} + */ + public function getValue() + { + return $this->value; + } + + /** + * {@inheritdoc} + */ + public function getObject() + { + return $this->object; + } + + /** + * {@inheritdoc} + */ + public function getMetadata() + { + return $this->metadata; + } + + /** + * {@inheritdoc} + */ + public function getGroup() + { + return $this->group; + } + + /** + * {@inheritdoc} + */ + public function getClassName() + { + return $this->metadata instanceof ClassBasedInterface ? $this->metadata->getClassName() : null; + } + + /** + * {@inheritdoc} + */ + public function getPropertyName() + { + return $this->metadata instanceof PropertyMetadataInterface ? $this->metadata->getPropertyName() : null; + } + + /** + * {@inheritdoc} + */ + public function getPropertyPath($subPath = '') + { + return PropertyPath::append($this->propertyPath, $subPath); + } + + /** + * {@inheritdoc} + */ + public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null) + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::buildViolation method instead.', E_USER_DEPRECATED); + + if (func_num_args() > 2) { + $this + ->buildViolation($message, $parameters) + ->atPath($subPath) + ->setInvalidValue($invalidValue) + ->setPlural($plural) + ->setCode($code) + ->addViolation() + ; + + return; + } + + $this + ->buildViolation($message, $parameters) + ->atPath($subPath) + ->addViolation() + ; + } + + /** + * {@inheritdoc} + */ + public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false) + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::getValidator() method instead.', E_USER_DEPRECATED); + + if (is_array($value)) { + // The $traverse flag is ignored for arrays + $constraint = new Valid(array('traverse' => true, 'deep' => $deep)); + + return $this + ->getValidator() + ->inContext($this) + ->atPath($subPath) + ->validate($value, $constraint, $groups) + ; + } + + if ($traverse && $value instanceof \Traversable) { + $constraint = new Valid(array('traverse' => true, 'deep' => $deep)); + + return $this + ->getValidator() + ->inContext($this) + ->atPath($subPath) + ->validate($value, $constraint, $groups) + ; + } + + return $this + ->getValidator() + ->inContext($this) + ->atPath($subPath) + ->validate($value, null, $groups) + ; + } + + /** + * {@inheritdoc} + */ + public function validateValue($value, $constraints, $subPath = '', $groups = null) + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::getValidator() method instead.', E_USER_DEPRECATED); + + return $this + ->getValidator() + ->inContext($this) + ->atPath($subPath) + ->validate($value, $constraints, $groups) + ; + } + + /** + * {@inheritdoc} + */ + public function getMetadataFactory() + { + trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0. Use the new Symfony\Component\Validator\Context\ExecutionContext::getValidator method in combination with Symfony\Component\Validator\Validator\ValidatorInterface::getMetadataFor or Symfony\Component\Validator\Validator\ValidatorInterface::hasMetadataFor method instead.', E_USER_DEPRECATED); + + $validator = $this->getValidator(); + + if ($validator instanceof LegacyValidatorInterface) { + return $validator->getMetadataFactory(); + } + + // The ValidatorInterface extends from the deprecated MetadataFactoryInterface, so return it when we don't have the factory instance itself + return $validator; + } + + /** + * {@inheritdoc} + */ + public function markGroupAsValidated($cacheKey, $groupHash) + { + if (!isset($this->validatedObjects[$cacheKey])) { + $this->validatedObjects[$cacheKey] = array(); + } + + $this->validatedObjects[$cacheKey][$groupHash] = true; + } + + /** + * {@inheritdoc} + */ + public function isGroupValidated($cacheKey, $groupHash) + { + return isset($this->validatedObjects[$cacheKey][$groupHash]); + } + + /** + * {@inheritdoc} + */ + public function markConstraintAsValidated($cacheKey, $constraintHash) + { + $this->validatedConstraints[$cacheKey.':'.$constraintHash] = true; + } + + /** + * {@inheritdoc} + */ + public function isConstraintValidated($cacheKey, $constraintHash) + { + return isset($this->validatedConstraints[$cacheKey.':'.$constraintHash]); + } + + /** + * {@inheritdoc} + */ + public function markObjectAsInitialized($cacheKey) + { + $this->initializedObjects[$cacheKey] = true; + } + + /** + * {@inheritdoc} + */ + public function isObjectInitialized($cacheKey) + { + return isset($this->initializedObjects[$cacheKey]); + } +} diff --git a/core/vendor/symfony/validator/Context/ExecutionContextFactory.php b/core/vendor/symfony/validator/Context/ExecutionContextFactory.php new file mode 100644 index 0000000..d94a806 --- /dev/null +++ b/core/vendor/symfony/validator/Context/ExecutionContextFactory.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Context; + +use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Component\Validator\Validator\ValidatorInterface; + +/** + * Creates new {@link ExecutionContext} instances. + * + * @since 2.5 + * @author Bernhard Schussek + * + * @internal You should not instantiate or use this class. Code against + * {@link ExecutionContextFactoryInterface} instead. + */ +class ExecutionContextFactory implements ExecutionContextFactoryInterface +{ + /** + * @var TranslatorInterface + */ + private $translator; + + /** + * @var string|null + */ + private $translationDomain; + + /** + * Creates a new context factory. + * + * @param TranslatorInterface $translator The translator + * @param string|null $translationDomain The translation domain to + * use for translating + * violation messages + */ + public function __construct(TranslatorInterface $translator, $translationDomain = null) + { + $this->translator = $translator; + $this->translationDomain = $translationDomain; + } + + /** + * {@inheritdoc} + */ + public function createContext(ValidatorInterface $validator, $root) + { + return new ExecutionContext( + $validator, + $root, + $this->translator, + $this->translationDomain + ); + } +} diff --git a/core/vendor/symfony/validator/Context/ExecutionContextFactoryInterface.php b/core/vendor/symfony/validator/Context/ExecutionContextFactoryInterface.php new file mode 100644 index 0000000..f0ee001 --- /dev/null +++ b/core/vendor/symfony/validator/Context/ExecutionContextFactoryInterface.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Context; + +use Symfony\Component\Validator\Validator\ValidatorInterface; + +/** + * Creates instances of {@link ExecutionContextInterface}. + * + * You can use a custom factory if you want to customize the execution context + * that is passed through the validation run. + * + * @since 2.5 + * @author Bernhard Schussek + */ +interface ExecutionContextFactoryInterface +{ + /** + * Creates a new execution context. + * + * @param ValidatorInterface $validator The validator + * @param mixed $root The root value of the validated + * object graph + * + * @return ExecutionContextInterface The new execution context + */ + public function createContext(ValidatorInterface $validator, $root); +} diff --git a/core/vendor/symfony/validator/Context/ExecutionContextInterface.php b/core/vendor/symfony/validator/Context/ExecutionContextInterface.php new file mode 100644 index 0000000..4865204 --- /dev/null +++ b/core/vendor/symfony/validator/Context/ExecutionContextInterface.php @@ -0,0 +1,226 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Context; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ExecutionContextInterface as LegacyExecutionContextInterface; +use Symfony\Component\Validator\Mapping\MetadataInterface; +use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface; + +/** + * The context of a validation run. + * + * The context collects all violations generated during the validation. By + * default, validators execute all validations in a new context: + * + * $violations = $validator->validate($object); + * + * When you make another call to the validator, while the validation is in + * progress, the violations will be isolated from each other: + * + * public function validate($value, Constraint $constraint) + * { + * $validator = $this->context->getValidator(); + * + * // The violations are not added to $this->context + * $violations = $validator->validate($value); + * } + * + * However, if you want to add the violations to the current context, use the + * {@link ValidatorInterface::inContext()} method: + * + * public function validate($value, Constraint $constraint) + * { + * $validator = $this->context->getValidator(); + * + * // The violations are added to $this->context + * $validator + * ->inContext($this->context) + * ->validate($value) + * ; + * } + * + * Additionally, the context provides information about the current state of + * the validator, such as the currently validated class, the name of the + * currently validated property and more. These values change over time, so you + * cannot store a context and expect that the methods still return the same + * results later on. + * + * @since 2.5 + * @author Bernhard Schussek + */ +interface ExecutionContextInterface extends LegacyExecutionContextInterface +{ + /** + * Returns a builder for adding a violation with extended information. + * + * Call {@link ConstraintViolationBuilderInterface::addViolation()} to + * add the violation when you're done with the configuration: + * + * $context->buildViolation('Please enter a number between %min% and %max%.') + * ->setParameter('%min%', 3) + * ->setParameter('%max%', 10) + * ->setTranslationDomain('number_validation') + * ->addViolation(); + * + * @param string $message The error message + * @param array $parameters The parameters substituted in the error message + * + * @return ConstraintViolationBuilderInterface The violation builder + */ + public function buildViolation($message, array $parameters = array()); + + /** + * Returns the validator. + * + * Useful if you want to validate additional constraints: + * + * public function validate($value, Constraint $constraint) + * { + * $validator = $this->context->getValidator(); + * + * $violations = $validator->validateValue($value, new Length(array('min' => 3))); + * + * if (count($violations) > 0) { + * // ... + * } + * } + * + * @return ValidatorInterface + */ + public function getValidator(); + + /** + * Returns the currently validated object. + * + * If the validator is currently validating a class constraint, the + * object of that class is returned. If it is a validating a property or + * getter constraint, the object that the property/getter belongs to is + * returned. + * + * In other cases, null is returned. + * + * @return object|null The currently validated object or null. + */ + public function getObject(); + + /** + * Sets the currently validated value. + * + * @param mixed $value The validated value + * @param object|null $object The currently validated object + * @param MetadataInterface|null $metadata The validation metadata + * @param string $propertyPath The property path to the current value + * + * @internal Used by the validator engine. Should not be called by user + * code. + */ + public function setNode($value, $object, MetadataInterface $metadata = null, $propertyPath); + + /** + * Sets the currently validated group. + * + * @param string|null $group The validated group + * + * @internal Used by the validator engine. Should not be called by user + * code. + */ + public function setGroup($group); + + /** + * Sets the currently validated constraint. + * + * @param Constraint $constraint The validated constraint + * + * @internal Used by the validator engine. Should not be called by user + * code. + */ + public function setConstraint(Constraint $constraint); + + /** + * Marks an object as validated in a specific validation group. + * + * @param string $cacheKey The hash of the object + * @param string $groupHash The group's name or hash, if it is group + * sequence + * + * @internal Used by the validator engine. Should not be called by user + * code. + */ + public function markGroupAsValidated($cacheKey, $groupHash); + + /** + * Returns whether an object was validated in a specific validation group. + * + * @param string $cacheKey The hash of the object + * @param string $groupHash The group's name or hash, if it is group + * sequence + * + * @return bool Whether the object was already validated for that + * group + * + * @internal Used by the validator engine. Should not be called by user + * code. + */ + public function isGroupValidated($cacheKey, $groupHash); + + /** + * Marks a constraint as validated for an object. + * + * @param string $cacheKey The hash of the object + * @param string $constraintHash The hash of the constraint + * + * @internal Used by the validator engine. Should not be called by user + * code. + */ + public function markConstraintAsValidated($cacheKey, $constraintHash); + + /** + * Returns whether a constraint was validated for an object. + * + * @param string $cacheKey The hash of the object + * @param string $constraintHash The hash of the constraint + * + * @return bool Whether the constraint was already validated + * + * @internal Used by the validator engine. Should not be called by user + * code. + */ + public function isConstraintValidated($cacheKey, $constraintHash); + + /** + * Marks that an object was initialized. + * + * @param string $cacheKey The hash of the object + * + * @internal Used by the validator engine. Should not be called by user + * code. + * + * @see ObjectInitializerInterface + */ + public function markObjectAsInitialized($cacheKey); + + /** + * Returns whether an object was initialized. + * + * @param string $cacheKey The hash of the object + * + * @return bool Whether the object was already initialized + * + * @internal Used by the validator engine. Should not be called by user + * code. + * + * @see ObjectInitializerInterface + */ + public function isObjectInitialized($cacheKey); +} diff --git a/core/vendor/symfony/validator/Context/LegacyExecutionContext.php b/core/vendor/symfony/validator/Context/LegacyExecutionContext.php new file mode 100644 index 0000000..5ee7a22 --- /dev/null +++ b/core/vendor/symfony/validator/Context/LegacyExecutionContext.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Context; + +trigger_error('The '.__NAMESPACE__.'\LegacyExecutionContext class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); + +use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Component\Validator\MetadataFactoryInterface; +use Symfony\Component\Validator\Validator\ValidatorInterface; + +/** + * An execution context that is compatible with the legacy API (< 2.5). + * + * @since 2.5 + * @author Bernhard Schussek + * + * @deprecated since version 2.5, to be removed in 3.0. + */ +class LegacyExecutionContext extends ExecutionContext +{ + /** + * @var MetadataFactoryInterface + */ + private $metadataFactory; + + /** + * Creates a new context. + * + * @see ExecutionContext::__construct() + * + * @internal Called by {@link LegacyExecutionContextFactory}. Should not be used + * in user code. + */ + public function __construct(ValidatorInterface $validator, $root, MetadataFactoryInterface $metadataFactory, TranslatorInterface $translator, $translationDomain = null) + { + parent::__construct( + $validator, + $root, + $translator, + $translationDomain + ); + + $this->metadataFactory = $metadataFactory; + } +} diff --git a/core/vendor/symfony/validator/Context/LegacyExecutionContextFactory.php b/core/vendor/symfony/validator/Context/LegacyExecutionContextFactory.php new file mode 100644 index 0000000..31fb4cb --- /dev/null +++ b/core/vendor/symfony/validator/Context/LegacyExecutionContextFactory.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Context; + +trigger_error('The '.__NAMESPACE__.'\LegacyExecutionContextFactory class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); + +use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Component\Validator\MetadataFactoryInterface; +use Symfony\Component\Validator\Validator\ValidatorInterface; + +/** + * Creates new {@link LegacyExecutionContext} instances. + * + * Implemented for backward compatibility with Symfony < 2.5. + * + * @since 2.5 + * @author Bernhard Schussek + * + * @deprecated since version 2.5, to be removed in 3.0. + */ +class LegacyExecutionContextFactory implements ExecutionContextFactoryInterface +{ + /** + * @var MetadataFactoryInterface + */ + private $metadataFactory; + + /** + * @var TranslatorInterface + */ + private $translator; + + /** + * @var string|null + */ + private $translationDomain; + + /** + * Creates a new context factory. + * + * @param MetadataFactoryInterface $metadataFactory The metadata factory + * @param TranslatorInterface $translator The translator + * @param string|null $translationDomain The translation domain + * to use for translating + * violation messages + */ + public function __construct(MetadataFactoryInterface $metadataFactory, TranslatorInterface $translator, $translationDomain = null) + { + $this->metadataFactory = $metadataFactory; + $this->translator = $translator; + $this->translationDomain = $translationDomain; + } + + /** + * {@inheritdoc} + */ + public function createContext(ValidatorInterface $validator, $root) + { + return new LegacyExecutionContext( + $validator, + $root, + $this->metadataFactory, + $this->translator, + $this->translationDomain + ); + } +} diff --git a/core/vendor/symfony/validator/DefaultTranslator.php b/core/vendor/symfony/validator/DefaultTranslator.php new file mode 100644 index 0000000..37c9c17 --- /dev/null +++ b/core/vendor/symfony/validator/DefaultTranslator.php @@ -0,0 +1,171 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +trigger_error('The class '.__NAMESPACE__.'\DefaultTranslator is deprecated since version 2.7 and will be removed in 3.0. Use Symfony\Component\Translation\IdentityTranslator instead.', E_USER_DEPRECATED); + +use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Component\Validator\Exception\BadMethodCallException; +use Symfony\Component\Validator\Exception\InvalidArgumentException; + +/** + * Simple translator implementation that simply replaces the parameters in + * the message IDs. + * + * Example usage: + * + * $translator = new DefaultTranslator(); + * + * echo $translator->trans( + * 'This is a {{ var }}.', + * array('{{ var }}' => 'donkey') + * ); + * + * // -> This is a donkey. + * + * echo $translator->transChoice( + * 'This is {{ count }} donkey.|These are {{ count }} donkeys.', + * 3, + * array('{{ count }}' => 'three') + * ); + * + * // -> These are three donkeys. + * + * This translator does not support message catalogs, translation domains or + * locales. Instead, it implements a subset of the capabilities of + * {@link \Symfony\Component\Translation\Translator} and can be used in places + * where translation is not required by default but should be optional. + * + * @deprecated since version 2.7, to be removed in 3.0. Use Symfony\Component\Translation\IdentityTranslator instead. + * + * @author Bernhard Schussek + */ +class DefaultTranslator implements TranslatorInterface +{ + /** + * Interpolates the given message. + * + * Parameters are replaced in the message in the same manner that + * {@link strtr()} uses. + * + * Example usage: + * + * $translator = new DefaultTranslator(); + * + * echo $translator->trans( + * 'This is a {{ var }}.', + * array('{{ var }}' => 'donkey') + * ); + * + * // -> This is a donkey. + * + * @param string $id The message id + * @param array $parameters An array of parameters for the message + * @param string $domain Ignored + * @param string $locale Ignored + * + * @return string The interpolated string + */ + public function trans($id, array $parameters = array(), $domain = null, $locale = null) + { + return strtr($id, $parameters); + } + + /** + * Interpolates the given choice message by choosing a variant according to a number. + * + * The variants are passed in the message ID using the format + * "|". "" is chosen if the passed $number is + * exactly 1. "" is chosen otherwise. + * + * This format is consistent with the format supported by + * {@link \Symfony\Component\Translation\Translator}, but it does not + * have the same expressiveness. While Translator supports intervals in + * message translations, which are needed for languages other than English, + * this translator does not. You should use Translator or a custom + * implementation of {@link \Symfony\Component\Translation\TranslatorInterface} if you need this or similar + * functionality. + * + * Example usage: + * + * echo $translator->transChoice( + * 'This is {{ count }} donkey.|These are {{ count }} donkeys.', + * 0, + * array('{{ count }}' => 0) + * ); + * + * // -> These are 0 donkeys. + * + * echo $translator->transChoice( + * 'This is {{ count }} donkey.|These are {{ count }} donkeys.', + * 1, + * array('{{ count }}' => 1) + * ); + * + * // -> This is 1 donkey. + * + * echo $translator->transChoice( + * 'This is {{ count }} donkey.|These are {{ count }} donkeys.', + * 3, + * array('{{ count }}' => 3) + * ); + * + * // -> These are 3 donkeys. + * + * @param string $id The message id + * @param int $number The number to use to find the index of the message + * @param array $parameters An array of parameters for the message + * @param string $domain Ignored + * @param string $locale Ignored + * + * @return string The translated string + * + * @throws InvalidArgumentException If the message id does not have the format + * "singular|plural". + */ + public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null) + { + $ids = explode('|', $id); + + if (1 == $number) { + return strtr($ids[0], $parameters); + } + + if (!isset($ids[1])) { + throw new InvalidArgumentException(sprintf('The message "%s" cannot be pluralized, because it is missing a plural (e.g. "There is one apple|There are %%count%% apples").', $id)); + } + + return strtr($ids[1], $parameters); + } + + /** + * Not supported. + * + * @param string $locale The locale + * + * @throws BadMethodCallException + */ + public function setLocale($locale) + { + throw new BadMethodCallException('Unsupported method.'); + } + + /** + * Returns the locale of the translator. + * + * @return string Always returns 'en' + */ + public function getLocale() + { + return 'en'; + } +} diff --git a/core/vendor/symfony/validator/Exception/BadMethodCallException.php b/core/vendor/symfony/validator/Exception/BadMethodCallException.php new file mode 100644 index 0000000..939161b --- /dev/null +++ b/core/vendor/symfony/validator/Exception/BadMethodCallException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +/** + * Base BadMethodCallException for the Validator component. + * + * @author Bernhard Schussek + */ +class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface +{ +} diff --git a/core/vendor/symfony/validator/Exception/ConstraintDefinitionException.php b/core/vendor/symfony/validator/Exception/ConstraintDefinitionException.php new file mode 100644 index 0000000..b24fdd6 --- /dev/null +++ b/core/vendor/symfony/validator/Exception/ConstraintDefinitionException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +class ConstraintDefinitionException extends ValidatorException +{ +} diff --git a/core/vendor/symfony/validator/Exception/ExceptionInterface.php b/core/vendor/symfony/validator/Exception/ExceptionInterface.php new file mode 100644 index 0000000..77d09b9 --- /dev/null +++ b/core/vendor/symfony/validator/Exception/ExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +/** + * Base ExceptionInterface for the Validator component. + * + * @author Bernhard Schussek + */ +interface ExceptionInterface +{ +} diff --git a/core/vendor/symfony/validator/Exception/GroupDefinitionException.php b/core/vendor/symfony/validator/Exception/GroupDefinitionException.php new file mode 100644 index 0000000..ab7e91d --- /dev/null +++ b/core/vendor/symfony/validator/Exception/GroupDefinitionException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +class GroupDefinitionException extends ValidatorException +{ +} diff --git a/core/vendor/symfony/validator/Exception/InvalidArgumentException.php b/core/vendor/symfony/validator/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..22da39b --- /dev/null +++ b/core/vendor/symfony/validator/Exception/InvalidArgumentException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +/** + * Base InvalidArgumentException for the Validator component. + * + * @author Bernhard Schussek + */ +class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface +{ +} diff --git a/core/vendor/symfony/validator/Exception/InvalidOptionsException.php b/core/vendor/symfony/validator/Exception/InvalidOptionsException.php new file mode 100644 index 0000000..ce87c42 --- /dev/null +++ b/core/vendor/symfony/validator/Exception/InvalidOptionsException.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +class InvalidOptionsException extends ValidatorException +{ + private $options; + + public function __construct($message, array $options) + { + parent::__construct($message); + + $this->options = $options; + } + + public function getOptions() + { + return $this->options; + } +} diff --git a/core/vendor/symfony/validator/Exception/MappingException.php b/core/vendor/symfony/validator/Exception/MappingException.php new file mode 100644 index 0000000..4c8c057 --- /dev/null +++ b/core/vendor/symfony/validator/Exception/MappingException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +class MappingException extends ValidatorException +{ +} diff --git a/core/vendor/symfony/validator/Exception/MissingOptionsException.php b/core/vendor/symfony/validator/Exception/MissingOptionsException.php new file mode 100644 index 0000000..07c5d9e --- /dev/null +++ b/core/vendor/symfony/validator/Exception/MissingOptionsException.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +class MissingOptionsException extends ValidatorException +{ + private $options; + + public function __construct($message, array $options) + { + parent::__construct($message); + + $this->options = $options; + } + + public function getOptions() + { + return $this->options; + } +} diff --git a/core/vendor/symfony/validator/Exception/NoSuchMetadataException.php b/core/vendor/symfony/validator/Exception/NoSuchMetadataException.php new file mode 100644 index 0000000..4cac74c --- /dev/null +++ b/core/vendor/symfony/validator/Exception/NoSuchMetadataException.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +/** + * @author Bernhard Schussek + */ +class NoSuchMetadataException extends ValidatorException +{ +} diff --git a/core/vendor/symfony/validator/Exception/OutOfBoundsException.php b/core/vendor/symfony/validator/Exception/OutOfBoundsException.php new file mode 100644 index 0000000..30906e8 --- /dev/null +++ b/core/vendor/symfony/validator/Exception/OutOfBoundsException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +/** + * Base OutOfBoundsException for the Validator component. + * + * @author Bernhard Schussek + */ +class OutOfBoundsException extends \OutOfBoundsException implements ExceptionInterface +{ +} diff --git a/core/vendor/symfony/validator/Exception/RuntimeException.php b/core/vendor/symfony/validator/Exception/RuntimeException.php new file mode 100644 index 0000000..df4a50c --- /dev/null +++ b/core/vendor/symfony/validator/Exception/RuntimeException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +/** + * Base RuntimeException for the Validator component. + * + * @author Bernhard Schussek + */ +class RuntimeException extends \RuntimeException implements ExceptionInterface +{ +} diff --git a/core/vendor/symfony/validator/Exception/UnexpectedTypeException.php b/core/vendor/symfony/validator/Exception/UnexpectedTypeException.php new file mode 100644 index 0000000..49d8cc2 --- /dev/null +++ b/core/vendor/symfony/validator/Exception/UnexpectedTypeException.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +class UnexpectedTypeException extends ValidatorException +{ + public function __construct($value, $expectedType) + { + parent::__construct(sprintf('Expected argument of type "%s", "%s" given', $expectedType, is_object($value) ? get_class($value) : gettype($value))); + } +} diff --git a/core/vendor/symfony/validator/Exception/UnsupportedMetadataException.php b/core/vendor/symfony/validator/Exception/UnsupportedMetadataException.php new file mode 100644 index 0000000..c6ece50 --- /dev/null +++ b/core/vendor/symfony/validator/Exception/UnsupportedMetadataException.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +/** + * @since 2.5 + * @author Bernhard Schussek + */ +class UnsupportedMetadataException extends InvalidArgumentException +{ +} diff --git a/core/vendor/symfony/validator/Exception/ValidatorException.php b/core/vendor/symfony/validator/Exception/ValidatorException.php new file mode 100644 index 0000000..28bd470 --- /dev/null +++ b/core/vendor/symfony/validator/Exception/ValidatorException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +class ValidatorException extends RuntimeException +{ +} diff --git a/core/vendor/symfony/validator/ExecutionContext.php b/core/vendor/symfony/validator/ExecutionContext.php new file mode 100644 index 0000000..d21dd78 --- /dev/null +++ b/core/vendor/symfony/validator/ExecutionContext.php @@ -0,0 +1,295 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +trigger_error('The '.__NAMESPACE__.'\ExecutionContext class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Validator\Context\ExecutionContext class instead.', E_USER_DEPRECATED); + +use Symfony\Component\Translation\TranslatorInterface; + +/** + * Default implementation of {@link ExecutionContextInterface}. + * + * This class is immutable by design. + * + * @author Fabien Potencier + * @author Bernhard Schussek + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link Context\ExecutionContext} instead. + */ +class ExecutionContext implements ExecutionContextInterface +{ + /** + * @var GlobalExecutionContextInterface + */ + private $globalContext; + + /** + * @var TranslatorInterface + */ + private $translator; + + /** + * @var null|string + */ + private $translationDomain; + + /** + * @var MetadataInterface + */ + private $metadata; + + /** + * @var mixed + */ + private $value; + + /** + * @var string + */ + private $group; + + /** + * @var string + */ + private $propertyPath; + + /** + * Creates a new execution context. + * + * @param GlobalExecutionContextInterface $globalContext The global context storing node-independent state. + * @param TranslatorInterface $translator The translator for translating violation messages. + * @param null|string $translationDomain The domain of the validation messages. + * @param MetadataInterface $metadata The metadata of the validated node. + * @param mixed $value The value of the validated node. + * @param string $group The current validation group. + * @param string $propertyPath The property path to the current node. + */ + public function __construct(GlobalExecutionContextInterface $globalContext, TranslatorInterface $translator, $translationDomain = null, MetadataInterface $metadata = null, $value = null, $group = null, $propertyPath = '') + { + if (null === $group) { + $group = Constraint::DEFAULT_GROUP; + } + + $this->globalContext = $globalContext; + $this->translator = $translator; + $this->translationDomain = $translationDomain; + $this->metadata = $metadata; + $this->value = $value; + $this->propertyPath = $propertyPath; + $this->group = $group; + } + + /** + * {@inheritdoc} + */ + public function addViolation($message, array $params = array(), $invalidValue = null, $plural = null, $code = null) + { + if (null === $plural) { + $translatedMessage = $this->translator->trans($message, $params, $this->translationDomain); + } else { + try { + $translatedMessage = $this->translator->transChoice($message, $plural, $params, $this->translationDomain); + } catch (\InvalidArgumentException $e) { + $translatedMessage = $this->translator->trans($message, $params, $this->translationDomain); + } + } + + $this->globalContext->getViolations()->add(new ConstraintViolation( + $translatedMessage, + $message, + $params, + $this->globalContext->getRoot(), + $this->propertyPath, + // check using func_num_args() to allow passing null values + func_num_args() >= 3 ? $invalidValue : $this->value, + $plural, + $code + )); + } + + /** + * {@inheritdoc} + */ + public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null) + { + $this->globalContext->getViolations()->add(new ConstraintViolation( + null === $plural + ? $this->translator->trans($message, $parameters, $this->translationDomain) + : $this->translator->transChoice($message, $plural, $parameters, $this->translationDomain), + $message, + $parameters, + $this->globalContext->getRoot(), + $this->getPropertyPath($subPath), + // check using func_num_args() to allow passing null values + func_num_args() >= 4 ? $invalidValue : $this->value, + $plural, + $code + )); + } + + /** + * {@inheritdoc} + */ + public function getViolations() + { + return $this->globalContext->getViolations(); + } + + /** + * {@inheritdoc} + */ + public function getRoot() + { + return $this->globalContext->getRoot(); + } + + /** + * {@inheritdoc} + */ + public function getPropertyPath($subPath = '') + { + if ('' != $subPath && '' !== $this->propertyPath && '[' !== $subPath[0]) { + return $this->propertyPath.'.'.$subPath; + } + + return $this->propertyPath.$subPath; + } + + /** + * {@inheritdoc} + */ + public function getClassName() + { + if ($this->metadata instanceof ClassBasedInterface) { + return $this->metadata->getClassName(); + } + } + + /** + * {@inheritdoc} + */ + public function getPropertyName() + { + if ($this->metadata instanceof PropertyMetadataInterface) { + return $this->metadata->getPropertyName(); + } + } + + /** + * {@inheritdoc} + */ + public function getValue() + { + return $this->value; + } + + /** + * {@inheritdoc} + */ + public function getGroup() + { + return $this->group; + } + + /** + * {@inheritdoc} + */ + public function getMetadata() + { + return $this->metadata; + } + + /** + * {@inheritdoc} + */ + public function getMetadataFor($value) + { + return $this->globalContext->getMetadataFactory()->getMetadataFor($value); + } + + /** + * {@inheritdoc} + */ + public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false) + { + $propertyPath = $this->getPropertyPath($subPath); + + foreach ($this->resolveGroups($groups) as $group) { + $this->globalContext->getVisitor()->validate($value, $group, $propertyPath, $traverse, $deep); + } + } + + /** + * {@inheritdoc} + */ + public function validateValue($value, $constraints, $subPath = '', $groups = null) + { + $constraints = is_array($constraints) ? $constraints : array($constraints); + + if (null === $groups && '' === $subPath) { + $context = clone $this; + $context->value = $value; + $context->executeConstraintValidators($value, $constraints); + + return; + } + + $propertyPath = $this->getPropertyPath($subPath); + + foreach ($this->resolveGroups($groups) as $group) { + $context = clone $this; + $context->value = $value; + $context->group = $group; + $context->propertyPath = $propertyPath; + $context->executeConstraintValidators($value, $constraints); + } + } + + /** + * {@inheritdoc} + */ + public function getMetadataFactory() + { + return $this->globalContext->getMetadataFactory(); + } + + /** + * Executes the validators of the given constraints for the given value. + * + * @param mixed $value The value to validate. + * @param Constraint[] $constraints The constraints to match against. + */ + private function executeConstraintValidators($value, array $constraints) + { + foreach ($constraints as $constraint) { + $validator = $this->globalContext->getValidatorFactory()->getInstance($constraint); + $validator->initialize($this); + $validator->validate($value, $constraint); + } + } + + /** + * Returns an array of group names. + * + * @param null|string|string[] $groups The groups to resolve. If a single string is + * passed, it is converted to an array. If null + * is passed, an array containing the current + * group of the context is returned. + * + * @return array An array of validation groups. + */ + private function resolveGroups($groups) + { + return $groups ? (array) $groups : (array) $this->group; + } +} diff --git a/core/vendor/symfony/validator/ExecutionContextInterface.php b/core/vendor/symfony/validator/ExecutionContextInterface.php new file mode 100644 index 0000000..3fedfe1 --- /dev/null +++ b/core/vendor/symfony/validator/ExecutionContextInterface.php @@ -0,0 +1,327 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * Stores the validator's state during validation. + * + * For example, let's validate the following object graph: + * + *
+ * (Person)---($firstName: string)
+ *      \
+ *   ($address: Address)---($street: string)
+ * 
+ * + * We validate the Person instance, which becomes the "root" of the + * validation run (see {@link getRoot}). The state of the context after the + * first step will be like this: + * + *
+ * (Person)---($firstName: string)
+ *    ^ \
+ *   ($address: Address)---($street: string)
+ * 
+ * + * The validator is stopped at the Person node, both the root and the + * value (see {@link getValue}) of the context point to the Person + * instance. The property path is empty at this point (see {@link getPropertyPath}). + * The metadata of the context is the metadata of the Person node + * (see {@link getMetadata}). + * + * After advancing to the property $firstName of the Person + * instance, the state of the context looks like this: + * + *
+ * (Person)---($firstName: string)
+ *      \              ^
+ *   ($address: Address)---($street: string)
+ * 
+ * + * The validator is stopped at the property $firstName. The root still + * points to the Person instance, because this is where the validation + * started. The property path is now "firstName" and the current value is the + * value of that property. + * + * After advancing to the $address property and then to the + * $street property of the Address instance, the context state + * looks like this: + * + *
+ * (Person)---($firstName: string)
+ *      \
+ *   ($address: Address)---($street: string)
+ *                               ^
+ * 
+ * + * The validator is stopped at the property $street. The root still + * points to the Person instance, but the property path is now + * "address.street" and the validated value is the value of that property. + * + * Apart from the root, the property path and the currently validated value, + * the execution context also knows the metadata of the current node (see + * {@link getMetadata}) which for example returns a {@link Mapping\PropertyMetadata} + * or a {@link Mapping\ClassMetadata} object. he context also contains the + * validation group that is currently being validated (see {@link getGroup}) and + * the violations that happened up until now (see {@link getViolations}). + * + * Apart from reading the execution context, you can also use + * {@link addViolation} or {@link addViolationAt} to add new violations and + * {@link validate} or {@link validateValue} to validate values that the + * validator otherwise would not reach. + * + * @author Bernhard Schussek + * + * @api + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link Context\ExecutionContextInterface} instead. + */ +interface ExecutionContextInterface +{ + /** + * Adds a violation at the current node of the validation graph. + * + * @param string $message The error message + * @param array $params The parameters substituted in the error message + * @param mixed $invalidValue The invalid, validated value + * @param int|null $plural The number to use to pluralize of the message + * @param int|null $code The violation code + * + * @api + * + * @deprecated the parameters $invalidValue, $plural and $code are deprecated since version 2.5 and will be removed in 3.0. + */ + public function addViolation($message, array $params = array(), $invalidValue = null, $plural = null, $code = null); + + /** + * Adds a violation at the validation graph node with the given property + * path relative to the current property path. + * + * @param string $subPath The relative property path for the violation + * @param string $message The error message + * @param array $parameters The parameters substituted in the error message + * @param mixed $invalidValue The invalid, validated value + * @param int|null $plural The number to use to pluralize of the message + * @param int|null $code The violation code + * + * @api + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link Context\ExecutionContextInterface::buildViolation()} + * instead. + */ + public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null); + + /** + * Validates the given value within the scope of the current validation. + * + * The value may be any value recognized by the used metadata factory + * (see {@link MetadataFactoryInterface::getMetadata}), or an array or a + * traversable object of such values. + * + * Usually you validate a value that is not the current node of the + * execution context. For this case, you can pass the {@link $subPath} + * argument which is appended to the current property path when a violation + * is created. For example, take the following object graph: + * + *
+     * (Person)---($address: Address)---($phoneNumber: PhoneNumber)
+     *                     ^
+     * 
+ * + * When the execution context stops at the Person instance, the + * property path is "address". When you validate the PhoneNumber + * instance now, pass "phoneNumber" as sub path to correct the property path + * to "address.phoneNumber": + * + *
+     * $context->validate($address->phoneNumber, 'phoneNumber');
+     * 
+ * + * Any violations generated during the validation will be added to the + * violation list that you can access with {@link getViolations}. + * + * @param mixed $value The value to validate. + * @param string $subPath The path to append to the context's property path. + * @param null|string|string[] $groups The groups to validate in. If you don't pass any + * groups here, the current group of the context + * will be used. + * @param bool $traverse Whether to traverse the value if it is an array + * or an instance of \Traversable. + * @param bool $deep Whether to traverse the value recursively if + * it is a collection of collections. + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link Context\ExecutionContextInterface::getValidator()} + * instead. + */ + public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false); + + /** + * Validates a value against a constraint. + * + * Use the parameter $subPath to adapt the property path for the + * validated value. For example, take the following object graph: + * + *
+     * (Person)---($address: Address)---($street: string)
+     *                     ^
+     * 
+ * + * When the validator validates the Address instance, the + * property path stored in the execution context is "address". When you + * manually validate the property $street now, pass the sub path + * "street" to adapt the full property path to "address.street": + * + *
+     * $context->validate($address->street, new NotNull(), 'street');
+     * 
+ * + * @param mixed $value The value to validate. + * @param Constraint|Constraint[] $constraints The constraint(s) to validate against. + * @param string $subPath The path to append to the context's property path. + * @param null|string|string[] $groups The groups to validate in. If you don't pass any + * groups here, the current group of the context + * will be used. + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link Context\ExecutionContextInterface::getValidator()} + * instead. + */ + public function validateValue($value, $constraints, $subPath = '', $groups = null); + + /** + * Returns the violations generated by the validator so far. + * + * @return ConstraintViolationListInterface The constraint violation list. + * + * @api + */ + public function getViolations(); + + /** + * Returns the value at which validation was started in the object graph. + * + * The validator, when given an object, traverses the properties and + * related objects and their properties. The root of the validation is the + * object from which the traversal started. + * + * The current value is returned by {@link getValue}. + * + * @return mixed The root value of the validation. + */ + public function getRoot(); + + /** + * Returns the value that the validator is currently validating. + * + * If you want to retrieve the object that was originally passed to the + * validator, use {@link getRoot}. + * + * @return mixed The currently validated value. + */ + public function getValue(); + + /** + * Returns the metadata for the currently validated value. + * + * With the core implementation, this method returns a + * {@link Mapping\ClassMetadata} instance if the current value is an object, + * a {@link Mapping\PropertyMetadata} instance if the current value is + * the value of a property and a {@link Mapping\GetterMetadata} instance if + * the validated value is the result of a getter method. + * + * If the validated value is neither of these, for example if the validator + * has been called with a plain value and constraint, this method returns + * null. + * + * @return MetadataInterface|null The metadata of the currently validated + * value. + */ + public function getMetadata(); + + /** + * Returns the used metadata factory. + * + * @return MetadataFactoryInterface The metadata factory. + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link Context\ExecutionContextInterface::getValidator()} + * instead and call + * {@link Validator\ValidatorInterface::getMetadataFor()} or + * {@link Validator\ValidatorInterface::hasMetadataFor()} there. + */ + public function getMetadataFactory(); + + /** + * Returns the validation group that is currently being validated. + * + * @return string The current validation group. + */ + public function getGroup(); + + /** + * Returns the class name of the current node. + * + * If the metadata of the current node does not implement + * {@link ClassBasedInterface} or if no metadata is available for the + * current node, this method returns null. + * + * @return string|null The class name or null, if no class name could be found. + */ + public function getClassName(); + + /** + * Returns the property name of the current node. + * + * If the metadata of the current node does not implement + * {@link PropertyMetadataInterface} or if no metadata is available for the + * current node, this method returns null. + * + * @return string|null The property name or null, if no property name could be found. + */ + public function getPropertyName(); + + /** + * Returns the property path to the value that the validator is currently + * validating. + * + * For example, take the following object graph: + * + *
+     * (Person)---($address: Address)---($street: string)
+     * 
+ * + * When the Person instance is passed to the validator, the + * property path is initially empty. When the $address property + * of that person is validated, the property path is "address". When + * the $street property of the related Address instance + * is validated, the property path is "address.street". + * + * Properties of objects are prefixed with a dot in the property path. + * Indices of arrays or objects implementing the {@link \ArrayAccess} + * interface are enclosed in brackets. For example, if the property in + * the previous example is $addresses and contains an array + * of Address instance, the property path generated for the + * $street property of one of these addresses is for example + * "addresses[0].street". + * + * @param string $subPath Optional. The suffix appended to the current + * property path. + * + * @return string The current property path. The result may be an empty + * string if the validator is currently validating the + * root value of the validation graph. + */ + public function getPropertyPath($subPath = ''); +} diff --git a/core/vendor/symfony/validator/GlobalExecutionContextInterface.php b/core/vendor/symfony/validator/GlobalExecutionContextInterface.php new file mode 100644 index 0000000..5c646f2 --- /dev/null +++ b/core/vendor/symfony/validator/GlobalExecutionContextInterface.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * Stores the node-independent state of a validation run. + * + * When the validator validates a graph of objects, it uses two classes to + * store the state during the validation: + * + *
    + *
  • For each node in the validation graph (objects, properties, getters) the + * validator creates an instance of {@link ExecutionContextInterface} that + * stores the information about that node.
  • + *
  • One single GlobalExecutionContextInterface stores the state + * that is independent of the current node.
  • + *
+ * + * @author Bernhard Schussek + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link Context\ExecutionContextInterface} instead. + */ +interface GlobalExecutionContextInterface +{ + /** + * Returns the violations generated by the validator so far. + * + * @return ConstraintViolationListInterface A list of constraint violations. + */ + public function getViolations(); + + /** + * Returns the value at which validation was started in the object graph. + * + * @return mixed The root value. + * + * @see ExecutionContextInterface::getRoot() + */ + public function getRoot(); + + /** + * Returns the visitor instance used to validate the object graph nodes. + * + * @return ValidationVisitorInterface The validation visitor. + */ + public function getVisitor(); + + /** + * Returns the factory for constraint validators. + * + * @return ConstraintValidatorFactoryInterface The constraint validator factory. + */ + public function getValidatorFactory(); + + /** + * Returns the factory for validation metadata objects. + * + * @return MetadataFactoryInterface The metadata factory. + */ + public function getMetadataFactory(); +} diff --git a/core/vendor/symfony/validator/GroupSequenceProviderInterface.php b/core/vendor/symfony/validator/GroupSequenceProviderInterface.php new file mode 100644 index 0000000..62e8a5e --- /dev/null +++ b/core/vendor/symfony/validator/GroupSequenceProviderInterface.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * Defines the interface for a group sequence provider. + */ +interface GroupSequenceProviderInterface +{ + /** + * Returns which validation groups should be used for a certain state + * of the object. + * + * @return array An array of validation groups + */ + public function getGroupSequence(); +} diff --git a/core/vendor/symfony/validator/LICENSE b/core/vendor/symfony/validator/LICENSE new file mode 100644 index 0000000..43028bc --- /dev/null +++ b/core/vendor/symfony/validator/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2015 Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/core/vendor/symfony/validator/Mapping/BlackholeMetadataFactory.php b/core/vendor/symfony/validator/Mapping/BlackholeMetadataFactory.php new file mode 100644 index 0000000..ad5a980 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/BlackholeMetadataFactory.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +trigger_error('The '.__NAMESPACE__.'\BlackholeMetadataFactory class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Validator\Mapping\Factory\BlackHoleMetadataFactory class instead.', E_USER_DEPRECATED); + +use Symfony\Component\Validator\Mapping\Factory\BlackHoleMetadataFactory as MappingBlackHoleMetadataFactory; + +/** + * Alias of {@link Factory\BlackHoleMetadataFactory}. + * + * @author Fabien Potencier + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link Factory\BlackHoleMetadataFactory} instead. + */ +class BlackholeMetadataFactory extends MappingBlackHoleMetadataFactory +{ +} diff --git a/core/vendor/symfony/validator/Mapping/Cache/ApcCache.php b/core/vendor/symfony/validator/Mapping/Cache/ApcCache.php new file mode 100644 index 0000000..5dbe9f4 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/Cache/ApcCache.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Cache; + +trigger_error('The '.__NAMESPACE__.'\ApcCache class is deprecated since version 2.5 and will be removed in 3.0. Use DoctrineCache with the Doctrine\Common\Cache\ApcCache class instead.', E_USER_DEPRECATED); + +use Symfony\Component\Validator\Mapping\ClassMetadata; + +/** + * @deprecated since version 2.5, to be removed in 3.0. + * Use DoctrineCache with \Doctrine\Common\Cache\ApcCache instead. + */ +class ApcCache implements CacheInterface +{ + private $prefix; + + public function __construct($prefix) + { + if (!extension_loaded('apc')) { + throw new \RuntimeException('Unable to use ApcCache to cache validator mappings as APC is not enabled.'); + } + + $this->prefix = $prefix; + } + + public function has($class) + { + if (!function_exists('apc_exists')) { + $exists = false; + + apc_fetch($this->prefix.$class, $exists); + + return $exists; + } + + return apc_exists($this->prefix.$class); + } + + public function read($class) + { + return apc_fetch($this->prefix.$class); + } + + public function write(ClassMetadata $metadata) + { + apc_store($this->prefix.$metadata->getClassName(), $metadata); + } +} diff --git a/core/vendor/symfony/validator/Mapping/Cache/CacheInterface.php b/core/vendor/symfony/validator/Mapping/Cache/CacheInterface.php new file mode 100644 index 0000000..e8047c6 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/Cache/CacheInterface.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Cache; + +use Symfony\Component\Validator\Mapping\ClassMetadata; + +/** + * Persists ClassMetadata instances in a cache. + * + * @author Bernhard Schussek + */ +interface CacheInterface +{ + /** + * Returns whether metadata for the given class exists in the cache. + * + * @param string $class + */ + public function has($class); + + /** + * Returns the metadata for the given class from the cache. + * + * @param string $class Class Name + * + * @return ClassMetadata|false A ClassMetadata instance or false on miss + */ + public function read($class); + + /** + * Stores a class metadata in the cache. + * + * @param ClassMetadata $metadata A Class Metadata + */ + public function write(ClassMetadata $metadata); +} diff --git a/core/vendor/symfony/validator/Mapping/Cache/DoctrineCache.php b/core/vendor/symfony/validator/Mapping/Cache/DoctrineCache.php new file mode 100644 index 0000000..6dd5447 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/Cache/DoctrineCache.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Cache; + +use Doctrine\Common\Cache\Cache; +use Symfony\Component\Validator\Mapping\ClassMetadata; + +/** + * Adapts a Doctrine cache to a CacheInterface. + * + * @author Florian Voutzinos + */ +final class DoctrineCache implements CacheInterface +{ + private $cache; + + /** + * Creates a new Doctrine cache. + * + * @param Cache $cache The cache to adapt + */ + public function __construct(Cache $cache) + { + $this->cache = $cache; + } + + /** + * Sets the cache to adapt. + * + * @param Cache $cache The cache to adapt + */ + public function setCache(Cache $cache) + { + $this->cache = $cache; + } + + /** + * {@inheritdoc} + */ + public function has($class) + { + return $this->cache->contains($class); + } + + /** + * {@inheritdoc} + */ + public function read($class) + { + return $this->cache->fetch($class); + } + + /** + * {@inheritdoc} + */ + public function write(ClassMetadata $metadata) + { + $this->cache->save($metadata->getClassName(), $metadata); + } +} diff --git a/core/vendor/symfony/validator/Mapping/CascadingStrategy.php b/core/vendor/symfony/validator/Mapping/CascadingStrategy.php new file mode 100644 index 0000000..ff2853f --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/CascadingStrategy.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +/** + * Specifies whether an object should be cascaded. + * + * Cascading is relevant for any node type but class nodes. If such a node + * contains an object of value, and if cascading is enabled, then the node + * traverser will try to find class metadata for that object and validate the + * object against that metadata. + * + * If no metadata is found for a cascaded object, and if that object implements + * {@link \Traversable}, the node traverser will iterate over the object and + * cascade each object or collection contained within, unless iteration is + * prohibited by the specified {@link TraversalStrategy}. + * + * Although the constants currently represent a boolean switch, they are + * implemented as bit mask in order to allow future extensions. + * + * @since 2.5 + * @author Bernhard Schussek + * + * @see TraversalStrategy + */ +class CascadingStrategy +{ + /** + * Specifies that a node should not be cascaded. + */ + const NONE = 1; + + /** + * Specifies that a node should be cascaded. + */ + const CASCADE = 2; + + /** + * Not instantiable. + */ + private function __construct() + { + } +} diff --git a/core/vendor/symfony/validator/Mapping/ClassMetadata.php b/core/vendor/symfony/validator/Mapping/ClassMetadata.php new file mode 100644 index 0000000..5991f34 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/ClassMetadata.php @@ -0,0 +1,556 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\GroupSequence; +use Symfony\Component\Validator\Constraints\Traverse; +use Symfony\Component\Validator\Constraints\Valid; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\GroupDefinitionException; +use Symfony\Component\Validator\ValidationVisitorInterface; + +/** + * Default implementation of {@link ClassMetadataInterface}. + * + * This class supports serialization and cloning. + * + * @author Bernhard Schussek + * @author Fabien Potencier + */ +class ClassMetadata extends ElementMetadata implements ClassMetadataInterface +{ + /** + * @var string + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getClassName()} instead. + */ + public $name; + + /** + * @var string + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getDefaultGroup()} instead. + */ + public $defaultGroup; + + /** + * @var MemberMetadata[] + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getPropertyMetadata()} instead. + */ + public $members = array(); + + /** + * @var PropertyMetadata[] + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getPropertyMetadata()} instead. + */ + public $properties = array(); + + /** + * @var GetterMetadata[] + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getPropertyMetadata()} instead. + */ + public $getters = array(); + + /** + * @var array + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getGroupSequence()} instead. + */ + public $groupSequence = array(); + + /** + * @var bool + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link isGroupSequenceProvider()} instead. + */ + public $groupSequenceProvider = false; + + /** + * The strategy for traversing traversable objects. + * + * By default, only instances of {@link \Traversable} are traversed. + * + * @var int + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getTraversalStrategy()} instead. + */ + public $traversalStrategy = TraversalStrategy::IMPLICIT; + + /** + * @var \ReflectionClass + */ + private $reflClass; + + /** + * Constructs a metadata for the given class. + * + * @param string $class + */ + public function __construct($class) + { + $this->name = $class; + // class name without namespace + if (false !== $nsSep = strrpos($class, '\\')) { + $this->defaultGroup = substr($class, $nsSep + 1); + } else { + $this->defaultGroup = $class; + } + } + + /** + * {@inheritdoc} + * + * @deprecated since version 2.5, to be removed in 3.0. + */ + public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath, $propagatedGroup = null) + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); + + if (null === $propagatedGroup && Constraint::DEFAULT_GROUP === $group + && ($this->hasGroupSequence() || $this->isGroupSequenceProvider())) { + if ($this->hasGroupSequence()) { + $groups = $this->getGroupSequence()->groups; + } else { + $groups = $value->getGroupSequence(); + } + + foreach ($groups as $group) { + $this->accept($visitor, $value, $group, $propertyPath, Constraint::DEFAULT_GROUP); + + if (count($visitor->getViolations()) > 0) { + break; + } + } + + return; + } + + $visitor->visit($this, $value, $group, $propertyPath); + + if (null !== $value) { + $pathPrefix = empty($propertyPath) ? '' : $propertyPath.'.'; + + foreach ($this->getConstrainedProperties() as $property) { + foreach ($this->getPropertyMetadata($property) as $member) { + $member->accept($visitor, $member->getPropertyValue($value), $group, $pathPrefix.$property, $propagatedGroup); + } + } + } + } + + /** + * {@inheritdoc} + */ + public function __sleep() + { + $parentProperties = parent::__sleep(); + + // Don't store the cascading strategy. Classes never cascade. + unset($parentProperties[array_search('cascadingStrategy', $parentProperties)]); + + return array_merge($parentProperties, array( + 'getters', + 'groupSequence', + 'groupSequenceProvider', + 'members', + 'name', + 'properties', + 'defaultGroup', + )); + } + + /** + * {@inheritdoc} + */ + public function getClassName() + { + return $this->name; + } + + /** + * Returns the name of the default group for this class. + * + * For each class, the group "Default" is an alias for the group + * "", where is the non-namespaced name of the + * class. All constraints implicitly or explicitly assigned to group + * "Default" belong to both of these groups, unless the class defines + * a group sequence. + * + * If a class defines a group sequence, validating the class in "Default" + * will validate the group sequence. The constraints assigned to "Default" + * can still be validated by validating the class in "". + * + * @return string The name of the default group + */ + public function getDefaultGroup() + { + return $this->defaultGroup; + } + + /** + * {@inheritdoc} + */ + public function addConstraint(Constraint $constraint) + { + if (!in_array(Constraint::CLASS_CONSTRAINT, (array) $constraint->getTargets())) { + throw new ConstraintDefinitionException(sprintf( + 'The constraint "%s" cannot be put on classes.', + get_class($constraint) + )); + } + + if ($constraint instanceof Valid) { + throw new ConstraintDefinitionException(sprintf( + 'The constraint "%s" cannot be put on classes.', + get_class($constraint) + )); + } + + if ($constraint instanceof Traverse) { + if ($constraint->traverse) { + // If traverse is true, traversal should be explicitly enabled + $this->traversalStrategy = TraversalStrategy::TRAVERSE; + } else { + // If traverse is false, traversal should be explicitly disabled + $this->traversalStrategy = TraversalStrategy::NONE; + } + + // The constraint is not added + return $this; + } + + $constraint->addImplicitGroupName($this->getDefaultGroup()); + + parent::addConstraint($constraint); + + return $this; + } + + /** + * Adds a constraint to the given property. + * + * @param string $property The name of the property + * @param Constraint $constraint The constraint + * + * @return ClassMetadata This object + */ + public function addPropertyConstraint($property, Constraint $constraint) + { + if (!isset($this->properties[$property])) { + $this->properties[$property] = new PropertyMetadata($this->getClassName(), $property); + + $this->addPropertyMetadata($this->properties[$property]); + } + + $constraint->addImplicitGroupName($this->getDefaultGroup()); + + $this->properties[$property]->addConstraint($constraint); + + return $this; + } + + /** + * @param string $property + * @param Constraint[] $constraints + * + * @return ClassMetadata + */ + public function addPropertyConstraints($property, array $constraints) + { + foreach ($constraints as $constraint) { + $this->addPropertyConstraint($property, $constraint); + } + + return $this; + } + + /** + * Adds a constraint to the getter of the given property. + * + * The name of the getter is assumed to be the name of the property with an + * uppercased first letter and either the prefix "get" or "is". + * + * @param string $property The name of the property + * @param Constraint $constraint The constraint + * + * @return ClassMetadata This object + */ + public function addGetterConstraint($property, Constraint $constraint) + { + if (!isset($this->getters[$property])) { + $this->getters[$property] = new GetterMetadata($this->getClassName(), $property); + + $this->addPropertyMetadata($this->getters[$property]); + } + + $constraint->addImplicitGroupName($this->getDefaultGroup()); + + $this->getters[$property]->addConstraint($constraint); + + return $this; + } + + /** + * @param string $property + * @param Constraint[] $constraints + * + * @return ClassMetadata + */ + public function addGetterConstraints($property, array $constraints) + { + foreach ($constraints as $constraint) { + $this->addGetterConstraint($property, $constraint); + } + + return $this; + } + + /** + * Merges the constraints of the given metadata into this object. + * + * @param ClassMetadata $source The source metadata + */ + public function mergeConstraints(ClassMetadata $source) + { + foreach ($source->getConstraints() as $constraint) { + $this->addConstraint(clone $constraint); + } + + foreach ($source->getConstrainedProperties() as $property) { + foreach ($source->getPropertyMetadata($property) as $member) { + $member = clone $member; + + foreach ($member->getConstraints() as $constraint) { + $constraint->addImplicitGroupName($this->getDefaultGroup()); + } + + $this->addPropertyMetadata($member); + + if ($member instanceof MemberMetadata && !$member->isPrivate($this->name)) { + $property = $member->getPropertyName(); + + if ($member instanceof PropertyMetadata && !isset($this->properties[$property])) { + $this->properties[$property] = $member; + } elseif ($member instanceof GetterMetadata && !isset($this->getters[$property])) { + $this->getters[$property] = $member; + } + } + } + } + } + + /** + * Adds a member metadata. + * + * @param MemberMetadata $metadata + * + * @deprecated since version 2.6, to be removed in 3.0. + */ + protected function addMemberMetadata(MemberMetadata $metadata) + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the addPropertyMetadata() method instead.', E_USER_DEPRECATED); + + $this->addPropertyMetadata($metadata); + } + + /** + * Returns true if metadatas of members is present for the given property. + * + * @param string $property The name of the property + * + * @return bool + * + * @deprecated since version 2.6, to be removed in 3.0. Use {@link hasPropertyMetadata} instead. + */ + public function hasMemberMetadatas($property) + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the hasPropertyMetadata() method instead.', E_USER_DEPRECATED); + + return $this->hasPropertyMetadata($property); + } + + /** + * Returns all metadatas of members describing the given property. + * + * @param string $property The name of the property + * + * @return MemberMetadata[] An array of MemberMetadata + * + * @deprecated since version 2.6, to be removed in 3.0. Use {@link getPropertyMetadata} instead. + */ + public function getMemberMetadatas($property) + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getPropertyMetadata() method instead.', E_USER_DEPRECATED); + + return $this->getPropertyMetadata($property); + } + + /** + * {@inheritdoc} + */ + public function hasPropertyMetadata($property) + { + return array_key_exists($property, $this->members); + } + + /** + * {@inheritdoc} + */ + public function getPropertyMetadata($property) + { + if (!isset($this->members[$property])) { + return array(); + } + + return $this->members[$property]; + } + + /** + * {@inheritdoc} + */ + public function getConstrainedProperties() + { + return array_keys($this->members); + } + + /** + * Sets the default group sequence for this class. + * + * @param array $groupSequence An array of group names + * + * @return ClassMetadata + * + * @throws GroupDefinitionException + */ + public function setGroupSequence($groupSequence) + { + if ($this->isGroupSequenceProvider()) { + throw new GroupDefinitionException('Defining a static group sequence is not allowed with a group sequence provider'); + } + + if (is_array($groupSequence)) { + $groupSequence = new GroupSequence($groupSequence); + } + + if (in_array(Constraint::DEFAULT_GROUP, $groupSequence->groups, true)) { + throw new GroupDefinitionException(sprintf('The group "%s" is not allowed in group sequences', Constraint::DEFAULT_GROUP)); + } + + if (!in_array($this->getDefaultGroup(), $groupSequence->groups, true)) { + throw new GroupDefinitionException(sprintf('The group "%s" is missing in the group sequence', $this->getDefaultGroup())); + } + + $this->groupSequence = $groupSequence; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function hasGroupSequence() + { + return $this->groupSequence && count($this->groupSequence->groups) > 0; + } + + /** + * {@inheritdoc} + */ + public function getGroupSequence() + { + return $this->groupSequence; + } + + /** + * Returns a ReflectionClass instance for this class. + * + * @return \ReflectionClass + */ + public function getReflectionClass() + { + if (!$this->reflClass) { + $this->reflClass = new \ReflectionClass($this->getClassName()); + } + + return $this->reflClass; + } + + /** + * Sets whether a group sequence provider should be used. + * + * @param bool $active + * + * @throws GroupDefinitionException + */ + public function setGroupSequenceProvider($active) + { + if ($this->hasGroupSequence()) { + throw new GroupDefinitionException('Defining a group sequence provider is not allowed with a static group sequence'); + } + + if (!$this->getReflectionClass()->implementsInterface('Symfony\Component\Validator\GroupSequenceProviderInterface')) { + throw new GroupDefinitionException(sprintf('Class "%s" must implement GroupSequenceProviderInterface', $this->name)); + } + + $this->groupSequenceProvider = $active; + } + + /** + * {@inheritdoc} + */ + public function isGroupSequenceProvider() + { + return $this->groupSequenceProvider; + } + + /** + * Class nodes are never cascaded. + * + * {@inheritdoc} + */ + public function getCascadingStrategy() + { + return CascadingStrategy::NONE; + } + + /** + * Adds a property metadata. + * + * @param PropertyMetadataInterface $metadata + */ + private function addPropertyMetadata(PropertyMetadataInterface $metadata) + { + $property = $metadata->getPropertyName(); + + $this->members[$property][] = $metadata; + } +} diff --git a/core/vendor/symfony/validator/Mapping/ClassMetadataFactory.php b/core/vendor/symfony/validator/Mapping/ClassMetadataFactory.php new file mode 100644 index 0000000..92cc85b --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/ClassMetadataFactory.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +trigger_error('The '.__NAMESPACE__.'\ClassMetadataFactory class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory class instead.', E_USER_DEPRECATED); + +use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory; + +/** + * Alias of {@link LazyLoadingMetadataFactory}. + * + * @author Bernhard Schussek + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link LazyLoadingMetadataFactory} instead. + */ +class ClassMetadataFactory extends LazyLoadingMetadataFactory +{ +} diff --git a/core/vendor/symfony/validator/Mapping/ClassMetadataInterface.php b/core/vendor/symfony/validator/Mapping/ClassMetadataInterface.php new file mode 100644 index 0000000..bb76c2c --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/ClassMetadataInterface.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +use Symfony\Component\Validator\ClassBasedInterface; +use Symfony\Component\Validator\PropertyMetadataContainerInterface as LegacyPropertyMetadataContainerInterface; + +/** + * Stores all metadata needed for validating objects of specific class. + * + * Most importantly, the metadata stores the constraints against which an object + * and its properties should be validated. + * + * Additionally, the metadata stores whether the "Default" group is overridden + * by a group sequence for that class and whether instances of that class + * should be traversed or not. + * + * @since 2.5 + * @author Bernhard Schussek + * + * @see MetadataInterface + * @see \Symfony\Component\Validator\Constraints\GroupSequence + * @see \Symfony\Component\Validator\GroupSequenceProviderInterface + * @see TraversalStrategy + */ +interface ClassMetadataInterface extends MetadataInterface, LegacyPropertyMetadataContainerInterface, ClassBasedInterface +{ + /** + * Returns the names of all constrained properties. + * + * @return string[] A list of property names + */ + public function getConstrainedProperties(); + + /** + * Returns whether the "Default" group is overridden by a group sequence. + * + * If it is, you can access the group sequence with {@link getGroupSequence()}. + * + * @return bool Returns true if the "Default" group is overridden + * + * @see \Symfony\Component\Validator\Constraints\GroupSequence + */ + public function hasGroupSequence(); + + /** + * Returns the group sequence that overrides the "Default" group for this + * class. + * + * @return \Symfony\Component\Validator\Constraints\GroupSequence|null The group sequence or null + * + * @see \Symfony\Component\Validator\Constraints\GroupSequence + */ + public function getGroupSequence(); + + /** + * Returns whether the "Default" group is overridden by a dynamic group + * sequence obtained by the validated objects. + * + * If this method returns true, the class must implement + * {@link \Symfony\Component\Validator\GroupSequenceProviderInterface}. + * This interface will be used to obtain the group sequence when an object + * of this class is validated. + * + * @return bool Returns true if the "Default" group is overridden by + * a dynamic group sequence + * + * @see \Symfony\Component\Validator\GroupSequenceProviderInterface + */ + public function isGroupSequenceProvider(); +} diff --git a/core/vendor/symfony/validator/Mapping/ElementMetadata.php b/core/vendor/symfony/validator/Mapping/ElementMetadata.php new file mode 100644 index 0000000..1783864 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/ElementMetadata.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +/** + * Contains the metadata of a structural element. + * + * @author Bernhard Schussek + * + * @deprecated since version 2.5, to be removed in 3.0. + * Extend {@link GenericMetadata} instead. + */ +abstract class ElementMetadata extends GenericMetadata +{ + public function __construct() + { + if (!$this instanceof MemberMetadata && !$this instanceof ClassMetadata) { + trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Validator\Mapping\GenericMetadata class instead.', E_USER_DEPRECATED); + } + } +} diff --git a/core/vendor/symfony/validator/Mapping/Factory/BlackHoleMetadataFactory.php b/core/vendor/symfony/validator/Mapping/Factory/BlackHoleMetadataFactory.php new file mode 100644 index 0000000..5b38d0c --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/Factory/BlackHoleMetadataFactory.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Factory; + +/** + * Metadata factory that does not store metadata. + * + * This implementation is useful if you want to validate values against + * constraints only and you don't need to add constraints to classes and + * properties. + * + * @author Fabien Potencier + */ +class BlackHoleMetadataFactory implements MetadataFactoryInterface +{ + /** + * {@inheritdoc} + */ + public function getMetadataFor($value) + { + throw new \LogicException('This class does not support metadata.'); + } + + /** + * {@inheritdoc} + */ + public function hasMetadataFor($value) + { + return false; + } +} diff --git a/core/vendor/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php b/core/vendor/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php new file mode 100644 index 0000000..208dfce --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php @@ -0,0 +1,155 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Factory; + +use Symfony\Component\Validator\Exception\NoSuchMetadataException; +use Symfony\Component\Validator\Mapping\Cache\CacheInterface; +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Mapping\ClassMetadataInterface; +use Symfony\Component\Validator\Mapping\Loader\LoaderChain; +use Symfony\Component\Validator\Mapping\Loader\LoaderInterface; + +/** + * Creates new {@link ClassMetadataInterface} instances. + * + * Whenever {@link getMetadataFor()} is called for the first time with a given + * class name or object of that class, a new metadata instance is created and + * returned. On subsequent requests for the same class, the same metadata + * instance will be returned. + * + * You can optionally pass a {@link LoaderInterface} instance to the constructor. + * Whenever a new metadata instance is created, it is passed to the loader, + * which can configure the metadata based on configuration loaded from the + * filesystem or a database. If you want to use multiple loaders, wrap them in a + * {@link LoaderChain}. + * + * You can also optionally pass a {@link CacheInterface} instance to the + * constructor. This cache will be used for persisting the generated metadata + * between multiple PHP requests. + * + * @author Bernhard Schussek + */ +class LazyLoadingMetadataFactory implements MetadataFactoryInterface +{ + /** + * The loader for loading the class metadata + * + * @var LoaderInterface|null + */ + protected $loader; + + /** + * The cache for caching class metadata + * + * @var CacheInterface|null + */ + protected $cache; + + /** + * The loaded metadata, indexed by class name + * + * @var ClassMetadata[] + */ + protected $loadedClasses = array(); + + /** + * Creates a new metadata factory. + * + * @param LoaderInterface|null $loader The loader for configuring new metadata + * @param CacheInterface|null $cache The cache for persisting metadata + * between multiple PHP requests + */ + public function __construct(LoaderInterface $loader = null, CacheInterface $cache = null) + { + $this->loader = $loader; + $this->cache = $cache; + } + + /** + * {@inheritdoc} + * + * If the method was called with the same class name (or an object of that + * class) before, the same metadata instance is returned. + * + * If the factory was configured with a cache, this method will first look + * for an existing metadata instance in the cache. If an existing instance + * is found, it will be returned without further ado. + * + * Otherwise, a new metadata instance is created. If the factory was + * configured with a loader, the metadata is passed to the + * {@link LoaderInterface::loadClassMetadata()} method for further + * configuration. At last, the new object is returned. + */ + public function getMetadataFor($value) + { + if (!is_object($value) && !is_string($value)) { + throw new NoSuchMetadataException(sprintf('Cannot create metadata for non-objects. Got: %s', gettype($value))); + } + + $class = ltrim(is_object($value) ? get_class($value) : $value, '\\'); + + if (isset($this->loadedClasses[$class])) { + return $this->loadedClasses[$class]; + } + + if (null !== $this->cache && false !== ($this->loadedClasses[$class] = $this->cache->read($class))) { + return $this->loadedClasses[$class]; + } + + if (!class_exists($class) && !interface_exists($class)) { + throw new NoSuchMetadataException(sprintf('The class or interface "%s" does not exist.', $class)); + } + + $metadata = new ClassMetadata($class); + + // Include constraints from the parent class + if ($parent = $metadata->getReflectionClass()->getParentClass()) { + $metadata->mergeConstraints($this->getMetadataFor($parent->name)); + } + + // Include constraints from all implemented interfaces + foreach ($metadata->getReflectionClass()->getInterfaces() as $interface) { + if ('Symfony\Component\Validator\GroupSequenceProviderInterface' === $interface->name) { + continue; + } + $metadata->mergeConstraints($this->getMetadataFor($interface->name)); + } + + if (null !== $this->loader) { + $this->loader->loadClassMetadata($metadata); + } + + if (null !== $this->cache) { + $this->cache->write($metadata); + } + + return $this->loadedClasses[$class] = $metadata; + } + + /** + * {@inheritdoc} + */ + public function hasMetadataFor($value) + { + if (!is_object($value) && !is_string($value)) { + return false; + } + + $class = ltrim(is_object($value) ? get_class($value) : $value, '\\'); + + if (class_exists($class) || interface_exists($class)) { + return true; + } + + return false; + } +} diff --git a/core/vendor/symfony/validator/Mapping/Factory/MetadataFactoryInterface.php b/core/vendor/symfony/validator/Mapping/Factory/MetadataFactoryInterface.php new file mode 100644 index 0000000..58736e2 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/Factory/MetadataFactoryInterface.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Factory; + +use Symfony\Component\Validator\MetadataFactoryInterface as LegacyMetadataFactoryInterface; + +/** + * Returns {@link \Symfony\Component\Validator\Mapping\MetadataInterface} instances for values. + * + * @since 2.5 + * @author Bernhard Schussek + */ +interface MetadataFactoryInterface extends LegacyMetadataFactoryInterface +{ +} diff --git a/core/vendor/symfony/validator/Mapping/GenericMetadata.php b/core/vendor/symfony/validator/Mapping/GenericMetadata.php new file mode 100644 index 0000000..cc0e54d --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/GenericMetadata.php @@ -0,0 +1,244 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\Traverse; +use Symfony\Component\Validator\Constraints\Valid; +use Symfony\Component\Validator\Exception\BadMethodCallException; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\ValidationVisitorInterface; + +/** + * A generic container of {@link Constraint} objects. + * + * This class supports serialization and cloning. + * + * @since 2.5 + * @author Bernhard Schussek + */ +class GenericMetadata implements MetadataInterface +{ + /** + * @var Constraint[] + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getConstraints()} and {@link findConstraints()} instead. + */ + public $constraints = array(); + + /** + * @var array + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link findConstraints()} instead. + */ + public $constraintsByGroup = array(); + + /** + * The strategy for cascading objects. + * + * By default, objects are not cascaded. + * + * @var int + * + * @see CascadingStrategy + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getCascadingStrategy()} instead. + */ + public $cascadingStrategy = CascadingStrategy::NONE; + + /** + * The strategy for traversing traversable objects. + * + * By default, traversable objects are not traversed. + * + * @var int + * + * @see TraversalStrategy + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getTraversalStrategy()} instead. + */ + public $traversalStrategy = TraversalStrategy::NONE; + + /** + * Returns the names of the properties that should be serialized. + * + * @return string[] + */ + public function __sleep() + { + return array( + 'constraints', + 'constraintsByGroup', + 'cascadingStrategy', + 'traversalStrategy', + ); + } + + /** + * Clones this object. + */ + public function __clone() + { + $constraints = $this->constraints; + + $this->constraints = array(); + $this->constraintsByGroup = array(); + + foreach ($constraints as $constraint) { + $this->addConstraint(clone $constraint); + } + } + + /** + * Adds a constraint. + * + * If the constraint {@link Valid} is added, the cascading strategy will be + * changed to {@link CascadingStrategy::CASCADE}. Depending on the + * properties $traverse and $deep of that constraint, the traversal strategy + * will be set to one of the following: + * + * - {@link TraversalStrategy::IMPLICIT} if $traverse is enabled and $deep + * is enabled + * - {@link TraversalStrategy::IMPLICIT} | {@link TraversalStrategy::STOP_RECURSION} + * if $traverse is enabled, but $deep is disabled + * - {@link TraversalStrategy::NONE} if $traverse is disabled + * + * @param Constraint $constraint The constraint to add + * + * @return GenericMetadata This object + * + * @throws ConstraintDefinitionException When trying to add the + * {@link Traverse} constraint + */ + public function addConstraint(Constraint $constraint) + { + if ($constraint instanceof Traverse) { + throw new ConstraintDefinitionException(sprintf( + 'The constraint "%s" can only be put on classes. Please use '. + '"Symfony\Component\Validator\Constraints\Valid" instead.', + get_class($constraint) + )); + } + + if ($constraint instanceof Valid) { + $this->cascadingStrategy = CascadingStrategy::CASCADE; + + if ($constraint->traverse) { + // Traverse unless the value is not traversable + $this->traversalStrategy = TraversalStrategy::IMPLICIT; + + if (!$constraint->deep) { + $this->traversalStrategy |= TraversalStrategy::STOP_RECURSION; + } + } else { + $this->traversalStrategy = TraversalStrategy::NONE; + } + + return $this; + } + + $this->constraints[] = $constraint; + + foreach ($constraint->groups as $group) { + $this->constraintsByGroup[$group][] = $constraint; + } + + return $this; + } + + /** + * Adds an list of constraints. + * + * @param Constraint[] $constraints The constraints to add + * + * @return GenericMetadata This object + */ + public function addConstraints(array $constraints) + { + foreach ($constraints as $constraint) { + $this->addConstraint($constraint); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getConstraints() + { + return $this->constraints; + } + + /** + * Returns whether this element has any constraints. + * + * @return bool + */ + public function hasConstraints() + { + return count($this->constraints) > 0; + } + + /** + * {@inheritdoc} + * + * Aware of the global group (* group). + */ + public function findConstraints($group) + { + return isset($this->constraintsByGroup[$group]) + ? $this->constraintsByGroup[$group] + : array(); + } + + /** + * {@inheritdoc} + */ + public function getCascadingStrategy() + { + return $this->cascadingStrategy; + } + + /** + * {@inheritdoc} + */ + public function getTraversalStrategy() + { + return $this->traversalStrategy; + } + + /** + * Exists for compatibility with the deprecated + * {@link Symfony\Component\Validator\MetadataInterface}. + * + * Should not be used. + * + * Implemented for backward compatibility with Symfony < 2.5. + * + * @throws BadMethodCallException + * + * @deprecated since version 2.5, to be removed in 3.0. + */ + public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath) + { + throw new BadMethodCallException('Not supported.'); + } +} diff --git a/core/vendor/symfony/validator/Mapping/GetterMetadata.php b/core/vendor/symfony/validator/Mapping/GetterMetadata.php new file mode 100644 index 0000000..0cf9992 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/GetterMetadata.php @@ -0,0 +1,77 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +use Symfony\Component\Validator\Exception\ValidatorException; + +/** + * Stores all metadata needed for validating a class property via its getter + * method. + * + * A property getter is any method that is equal to the property's name, + * prefixed with either "get" or "is". That method will be used to access the + * property's value. + * + * The getter will be invoked by reflection, so the access of private and + * protected getters is supported. + * + * This class supports serialization and cloning. + * + * @author Bernhard Schussek + * + * @see PropertyMetadataInterface + */ +class GetterMetadata extends MemberMetadata +{ + /** + * Constructor. + * + * @param string $class The class the getter is defined on + * @param string $property The property which the getter returns + * + * @throws ValidatorException + */ + public function __construct($class, $property) + { + $getMethod = 'get'.ucfirst($property); + $isMethod = 'is'.ucfirst($property); + $hasMethod = 'has'.ucfirst($property); + + if (method_exists($class, $getMethod)) { + $method = $getMethod; + } elseif (method_exists($class, $isMethod)) { + $method = $isMethod; + } elseif (method_exists($class, $hasMethod)) { + $method = $hasMethod; + } else { + throw new ValidatorException(sprintf('Neither of these methods exist in class %s: %s, %s, %s', $class, $getMethod, $isMethod, $hasMethod)); + } + + parent::__construct($class, $method, $property); + } + + /** + * {@inheritdoc} + */ + public function getPropertyValue($object) + { + return $this->newReflectionMember($object)->invoke($object); + } + + /** + * {@inheritdoc} + */ + protected function newReflectionMember($objectOrClassName) + { + return new \ReflectionMethod($objectOrClassName, $this->getName()); + } +} diff --git a/core/vendor/symfony/validator/Mapping/Loader/AbstractLoader.php b/core/vendor/symfony/validator/Mapping/Loader/AbstractLoader.php new file mode 100644 index 0000000..2ae8988 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/Loader/AbstractLoader.php @@ -0,0 +1,91 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\MappingException; + +/** + * Base loader for validation metadata. + * + * This loader supports the loading of constraints from Symfony's default + * namespace (see {@link DEFAULT_NAMESPACE}) using the short class names of + * those constraints. Constraints can also be loaded using their fully + * qualified class names. At last, namespace aliases can be defined to load + * constraints with the syntax "alias:ShortName". + * + * @author Bernhard Schussek + */ +abstract class AbstractLoader implements LoaderInterface +{ + /** + * The namespace to load constraints from by default. + */ + const DEFAULT_NAMESPACE = '\\Symfony\\Component\\Validator\\Constraints\\'; + + /** + * @var array + */ + protected $namespaces = array(); + + /** + * Adds a namespace alias. + * + * The namespace alias can be used to reference constraints from specific + * namespaces in {@link newConstraint()}: + * + * $this->addNamespaceAlias('mynamespace', '\\Acme\\Package\\Constraints\\'); + * + * $constraint = $this->newConstraint('mynamespace:NotNull'); + * + * @param string $alias The alias + * @param string $namespace The PHP namespace + */ + protected function addNamespaceAlias($alias, $namespace) + { + $this->namespaces[$alias] = $namespace; + } + + /** + * Creates a new constraint instance for the given constraint name. + * + * @param string $name The constraint name. Either a constraint relative + * to the default constraint namespace, or a fully + * qualified class name. Alternatively, the constraint + * may be preceded by a namespace alias and a colon. + * The namespace alias must have been defined using + * {@link addNamespaceAlias()}. + * @param mixed $options The constraint options + * + * @return Constraint + * + * @throws MappingException If the namespace prefix is undefined + */ + protected function newConstraint($name, $options = null) + { + if (strpos($name, '\\') !== false && class_exists($name)) { + $className = (string) $name; + } elseif (strpos($name, ':') !== false) { + list($prefix, $className) = explode(':', $name, 2); + + if (!isset($this->namespaces[$prefix])) { + throw new MappingException(sprintf('Undefined namespace prefix "%s"', $prefix)); + } + + $className = $this->namespaces[$prefix].$className; + } else { + $className = self::DEFAULT_NAMESPACE.$name; + } + + return new $className($options); + } +} diff --git a/core/vendor/symfony/validator/Mapping/Loader/AnnotationLoader.php b/core/vendor/symfony/validator/Mapping/Loader/AnnotationLoader.php new file mode 100644 index 0000000..d1b8c35 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/Loader/AnnotationLoader.php @@ -0,0 +1,95 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +use Doctrine\Common\Annotations\Reader; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\Callback; +use Symfony\Component\Validator\Constraints\GroupSequence; +use Symfony\Component\Validator\Constraints\GroupSequenceProvider; +use Symfony\Component\Validator\Exception\MappingException; +use Symfony\Component\Validator\Mapping\ClassMetadata; + +/** + * Loads validation metadata using a Doctrine annotation {@link Reader}. + * + * @author Bernhard Schussek + */ +class AnnotationLoader implements LoaderInterface +{ + /** + * @var Reader + */ + protected $reader; + + public function __construct(Reader $reader) + { + $this->reader = $reader; + } + + /** + * {@inheritdoc} + */ + public function loadClassMetadata(ClassMetadata $metadata) + { + $reflClass = $metadata->getReflectionClass(); + $className = $reflClass->name; + $success = false; + + foreach ($this->reader->getClassAnnotations($reflClass) as $constraint) { + if ($constraint instanceof GroupSequence) { + $metadata->setGroupSequence($constraint->groups); + } elseif ($constraint instanceof GroupSequenceProvider) { + $metadata->setGroupSequenceProvider(true); + } elseif ($constraint instanceof Constraint) { + $metadata->addConstraint($constraint); + } + + $success = true; + } + + foreach ($reflClass->getProperties() as $property) { + if ($property->getDeclaringClass()->name === $className) { + foreach ($this->reader->getPropertyAnnotations($property) as $constraint) { + if ($constraint instanceof Constraint) { + $metadata->addPropertyConstraint($property->name, $constraint); + } + + $success = true; + } + } + } + + foreach ($reflClass->getMethods() as $method) { + if ($method->getDeclaringClass()->name === $className) { + foreach ($this->reader->getMethodAnnotations($method) as $constraint) { + if ($constraint instanceof Callback) { + $constraint->callback = $method->getName(); + $constraint->methods = null; + + $metadata->addConstraint($constraint); + } elseif ($constraint instanceof Constraint) { + if (preg_match('/^(get|is|has)(.+)$/i', $method->name, $matches)) { + $metadata->addGetterConstraint(lcfirst($matches[2]), $constraint); + } else { + throw new MappingException(sprintf('The constraint on "%s::%s" cannot be added. Constraints can only be added on methods beginning with "get", "is" or "has".', $className, $method->name)); + } + } + + $success = true; + } + } + } + + return $success; + } +} diff --git a/core/vendor/symfony/validator/Mapping/Loader/FileLoader.php b/core/vendor/symfony/validator/Mapping/Loader/FileLoader.php new file mode 100644 index 0000000..326bbdf --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/Loader/FileLoader.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +use Symfony\Component\Validator\Exception\MappingException; + +/** + * Base loader for loading validation metadata from a file. + * + * @author Bernhard Schussek + * + * @see YamlFileLoader + * @see XmlFileLoader + */ +abstract class FileLoader extends AbstractLoader +{ + /** + * The file to load. + * + * @var string + */ + protected $file; + + /** + * Creates a new loader. + * + * @param string $file The mapping file to load + * + * @throws MappingException If the file does not exist or is not readable + */ + public function __construct($file) + { + if (!is_file($file)) { + throw new MappingException(sprintf('The mapping file "%s" does not exist', $file)); + } + + if (!is_readable($file)) { + throw new MappingException(sprintf('The mapping file "%s" is not readable', $file)); + } + + if (!stream_is_local($this->file)) { + throw new MappingException(sprintf('The mapping file "%s" is not a local file', $file)); + } + + $this->file = $file; + } +} diff --git a/core/vendor/symfony/validator/Mapping/Loader/FilesLoader.php b/core/vendor/symfony/validator/Mapping/Loader/FilesLoader.php new file mode 100644 index 0000000..571c7e7 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/Loader/FilesLoader.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +/** + * Base loader for loading validation metadata from a list of files. + * + * @author Bulat Shakirzyanov + * @author Bernhard Schussek + * + * @see YamlFilesLoader + * @see XmlFilesLoader + */ +abstract class FilesLoader extends LoaderChain +{ + /** + * Creates a new loader. + * + * @param array $paths An array of file paths + */ + public function __construct(array $paths) + { + parent::__construct($this->getFileLoaders($paths)); + } + + /** + * Returns an array of file loaders for the given file paths. + * + * @param array $paths An array of file paths + * + * @return LoaderInterface[] The metadata loaders + */ + protected function getFileLoaders($paths) + { + $loaders = array(); + + foreach ($paths as $path) { + $loaders[] = $this->getFileLoaderInstance($path); + } + + return $loaders; + } + + /** + * Creates a loader for the given file path. + * + * @param string $path The file path + * + * @return LoaderInterface The created loader + */ + abstract protected function getFileLoaderInstance($path); +} diff --git a/core/vendor/symfony/validator/Mapping/Loader/LoaderChain.php b/core/vendor/symfony/validator/Mapping/Loader/LoaderChain.php new file mode 100644 index 0000000..970d906 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/Loader/LoaderChain.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +use Symfony\Component\Validator\Exception\MappingException; +use Symfony\Component\Validator\Mapping\ClassMetadata; + +/** + * Loads validation metadata from multiple {@link LoaderInterface} instances. + * + * Pass the loaders when constructing the chain. Once + * {@link loadClassMetadata()} is called, that method will be called on all + * loaders in the chain. + * + * @author Bernhard Schussek + */ +class LoaderChain implements LoaderInterface +{ + /** + * @var LoaderInterface[] + */ + protected $loaders; + + /** + * @param LoaderInterface[] $loaders The metadata loaders to use + * + * @throws MappingException If any of the loaders has an invalid type + */ + public function __construct(array $loaders) + { + foreach ($loaders as $loader) { + if (!$loader instanceof LoaderInterface) { + throw new MappingException(sprintf('Class %s is expected to implement LoaderInterface', get_class($loader))); + } + } + + $this->loaders = $loaders; + } + + /** + * {@inheritdoc} + */ + public function loadClassMetadata(ClassMetadata $metadata) + { + $success = false; + + foreach ($this->loaders as $loader) { + $success = $loader->loadClassMetadata($metadata) || $success; + } + + return $success; + } +} diff --git a/core/vendor/symfony/validator/Mapping/Loader/LoaderInterface.php b/core/vendor/symfony/validator/Mapping/Loader/LoaderInterface.php new file mode 100644 index 0000000..5dadc82 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/Loader/LoaderInterface.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +use Symfony\Component\Validator\Mapping\ClassMetadata; + +/** + * Loads validation metadata into {@link ClassMetadata} instances. + * + * @author Bernhard Schussek + */ +interface LoaderInterface +{ + /** + * Loads validation metadata into a {@link ClassMetadata} instance. + * + * @param ClassMetadata $metadata The metadata to load + * + * @return bool Whether the loader succeeded + */ + public function loadClassMetadata(ClassMetadata $metadata); +} diff --git a/core/vendor/symfony/validator/Mapping/Loader/StaticMethodLoader.php b/core/vendor/symfony/validator/Mapping/Loader/StaticMethodLoader.php new file mode 100644 index 0000000..4ff2257 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/Loader/StaticMethodLoader.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +use Symfony\Component\Validator\Exception\MappingException; +use Symfony\Component\Validator\Mapping\ClassMetadata; + +/** + * Loads validation metadata by calling a static method on the loaded class. + * + * @author Bernhard Schussek + */ +class StaticMethodLoader implements LoaderInterface +{ + /** + * The name of the method to call. + * + * @var string + */ + protected $methodName; + + /** + * Creates a new loader. + * + * @param string $methodName The name of the static method to call + */ + public function __construct($methodName = 'loadValidatorMetadata') + { + $this->methodName = $methodName; + } + + /** + * {@inheritdoc} + */ + public function loadClassMetadata(ClassMetadata $metadata) + { + /** @var \ReflectionClass $reflClass */ + $reflClass = $metadata->getReflectionClass(); + + if (!$reflClass->isInterface() && $reflClass->hasMethod($this->methodName)) { + $reflMethod = $reflClass->getMethod($this->methodName); + + if ($reflMethod->isAbstract()) { + return false; + } + + if (!$reflMethod->isStatic()) { + throw new MappingException(sprintf('The method %s::%s should be static', $reflClass->name, $this->methodName)); + } + + if ($reflMethod->getDeclaringClass()->name != $reflClass->name) { + return false; + } + + $reflMethod->invoke(null, $metadata); + + return true; + } + + return false; + } +} diff --git a/core/vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php b/core/vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php new file mode 100644 index 0000000..2961b00 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php @@ -0,0 +1,219 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +use Symfony\Component\Config\Util\XmlUtils; +use Symfony\Component\Validator\Exception\MappingException; +use Symfony\Component\Validator\Mapping\ClassMetadata; + +/** + * Loads validation metadata from an XML file. + * + * @author Bernhard Schussek + */ +class XmlFileLoader extends FileLoader +{ + /** + * The XML nodes of the mapping file. + * + * @var \SimpleXMLElement[]|null + */ + protected $classes; + + /** + * {@inheritdoc} + */ + public function loadClassMetadata(ClassMetadata $metadata) + { + if (null === $this->classes) { + // This method may throw an exception. Do not modify the class' + // state before it completes + $xml = $this->parseFile($this->file); + + $this->classes = array(); + + foreach ($xml->namespace as $namespace) { + $this->addNamespaceAlias((string) $namespace['prefix'], trim((string) $namespace)); + } + + foreach ($xml->class as $class) { + $this->classes[(string) $class['name']] = $class; + } + } + + if (isset($this->classes[$metadata->getClassName()])) { + $classDescription = $this->classes[$metadata->getClassName()]; + + $this->loadClassMetadataFromXml($metadata, $classDescription); + + return true; + } + + return false; + } + + /** + * Parses a collection of "constraint" XML nodes. + * + * @param \SimpleXMLElement $nodes The XML nodes + * + * @return array The Constraint instances + */ + protected function parseConstraints(\SimpleXMLElement $nodes) + { + $constraints = array(); + + foreach ($nodes as $node) { + if (count($node) > 0) { + if (count($node->value) > 0) { + $options = $this->parseValues($node->value); + } elseif (count($node->constraint) > 0) { + $options = $this->parseConstraints($node->constraint); + } elseif (count($node->option) > 0) { + $options = $this->parseOptions($node->option); + } else { + $options = array(); + } + } elseif (strlen((string) $node) > 0) { + $options = trim($node); + } else { + $options = null; + } + + $constraints[] = $this->newConstraint((string) $node['name'], $options); + } + + return $constraints; + } + + /** + * Parses a collection of "value" XML nodes. + * + * @param \SimpleXMLElement $nodes The XML nodes + * + * @return array The values + */ + protected function parseValues(\SimpleXMLElement $nodes) + { + $values = array(); + + foreach ($nodes as $node) { + if (count($node) > 0) { + if (count($node->value) > 0) { + $value = $this->parseValues($node->value); + } elseif (count($node->constraint) > 0) { + $value = $this->parseConstraints($node->constraint); + } else { + $value = array(); + } + } else { + $value = trim($node); + } + + if (isset($node['key'])) { + $values[(string) $node['key']] = $value; + } else { + $values[] = $value; + } + } + + return $values; + } + + /** + * Parses a collection of "option" XML nodes. + * + * @param \SimpleXMLElement $nodes The XML nodes + * + * @return array The options + */ + protected function parseOptions(\SimpleXMLElement $nodes) + { + $options = array(); + + foreach ($nodes as $node) { + if (count($node) > 0) { + if (count($node->value) > 0) { + $value = $this->parseValues($node->value); + } elseif (count($node->constraint) > 0) { + $value = $this->parseConstraints($node->constraint); + } else { + $value = array(); + } + } else { + $value = XmlUtils::phpize($node); + if (is_string($value)) { + $value = trim($value); + } + } + + $options[(string) $node['name']] = $value; + } + + return $options; + } + + /** + * Loads the XML class descriptions from the given file. + * + * @param string $path The path of the XML file + * + * @return \SimpleXMLElement The class descriptions + * + * @throws MappingException If the file could not be loaded + */ + protected function parseFile($path) + { + try { + $dom = XmlUtils::loadFile($path, __DIR__.'/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd'); + } catch (\Exception $e) { + throw new MappingException($e->getMessage(), $e->getCode(), $e); + } + + return simplexml_import_dom($dom); + } + + /** + * Loads the validation metadata from the given XML class description. + * + * @param ClassMetadata $metadata The metadata to load + * @param array $classDescription The XML class description + */ + private function loadClassMetadataFromXml(ClassMetadata $metadata, $classDescription) + { + foreach ($classDescription->{'group-sequence-provider'} as $_) { + $metadata->setGroupSequenceProvider(true); + } + + foreach ($classDescription->{'group-sequence'} as $groupSequence) { + if (count($groupSequence->value) > 0) { + $metadata->setGroupSequence($this->parseValues($groupSequence[0]->value)); + } + } + + foreach ($this->parseConstraints($classDescription->constraint) as $constraint) { + $metadata->addConstraint($constraint); + } + + foreach ($classDescription->property as $property) { + foreach ($this->parseConstraints($property->constraint) as $constraint) { + $metadata->addPropertyConstraint((string) $property['name'], $constraint); + } + } + + foreach ($classDescription->getter as $getter) { + foreach ($this->parseConstraints($getter->constraint) as $constraint) { + $metadata->addGetterConstraint((string) $getter['property'], $constraint); + } + } + } +} diff --git a/core/vendor/symfony/validator/Mapping/Loader/XmlFilesLoader.php b/core/vendor/symfony/validator/Mapping/Loader/XmlFilesLoader.php new file mode 100644 index 0000000..6017c3f --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/Loader/XmlFilesLoader.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +/** + * Loads validation metadata from a list of XML files. + * + * @author Bulat Shakirzyanov + * @author Bernhard Schussek + * + * @see FilesLoader + */ +class XmlFilesLoader extends FilesLoader +{ + /** + * {@inheritdoc} + */ + public function getFileLoaderInstance($file) + { + return new XmlFileLoader($file); + } +} diff --git a/core/vendor/symfony/validator/Mapping/Loader/YamlFileLoader.php b/core/vendor/symfony/validator/Mapping/Loader/YamlFileLoader.php new file mode 100644 index 0000000..6075b27 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/Loader/YamlFileLoader.php @@ -0,0 +1,179 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Yaml\Parser as YamlParser; + +/** + * Loads validation metadata from a YAML file. + * + * @author Bernhard Schussek + */ +class YamlFileLoader extends FileLoader +{ + /** + * An array of YAML class descriptions. + * + * @var array + */ + protected $classes = null; + + /** + * Caches the used YAML parser. + * + * @var YamlParser + */ + private $yamlParser; + + /** + * {@inheritdoc} + */ + public function loadClassMetadata(ClassMetadata $metadata) + { + if (null === $this->classes) { + if (null === $this->yamlParser) { + $this->yamlParser = new YamlParser(); + } + + // This method may throw an exception. Do not modify the class' + // state before it completes + if (false === ($classes = $this->parseFile($this->file))) { + return false; + } + + $this->classes = $classes; + + if (isset($this->classes['namespaces'])) { + foreach ($this->classes['namespaces'] as $alias => $namespace) { + $this->addNamespaceAlias($alias, $namespace); + } + + unset($this->classes['namespaces']); + } + } + + if (isset($this->classes[$metadata->getClassName()])) { + $classDescription = $this->classes[$metadata->getClassName()]; + + $this->loadClassMetadataFromYaml($metadata, $classDescription); + + return true; + } + + return false; + } + + /** + * Parses a collection of YAML nodes. + * + * @param array $nodes The YAML nodes + * + * @return array An array of values or Constraint instances + */ + protected function parseNodes(array $nodes) + { + $values = array(); + + foreach ($nodes as $name => $childNodes) { + if (is_numeric($name) && is_array($childNodes) && 1 === count($childNodes)) { + $options = current($childNodes); + + if (is_array($options)) { + $options = $this->parseNodes($options); + } + + $values[] = $this->newConstraint(key($childNodes), $options); + } else { + if (is_array($childNodes)) { + $childNodes = $this->parseNodes($childNodes); + } + + $values[$name] = $childNodes; + } + } + + return $values; + } + + /** + * Loads the YAML class descriptions from the given file. + * + * @param string $path The path of the YAML file + * + * @return array|null The class descriptions or null, if the file was empty + * + * @throws \InvalidArgumentException If the file could not be loaded or did + * not contain a YAML array + */ + private function parseFile($path) + { + $classes = $this->yamlParser->parse(file_get_contents($path)); + + // empty file + if (null === $classes) { + return; + } + + // not an array + if (!is_array($classes)) { + throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $this->file)); + } + + return $classes; + } + + /** + * Loads the validation metadata from the given YAML class description. + * + * @param ClassMetadata $metadata The metadata to load + * @param array $classDescription The YAML class description + */ + private function loadClassMetadataFromYaml(ClassMetadata $metadata, array $classDescription) + { + if (isset($classDescription['group_sequence_provider'])) { + $metadata->setGroupSequenceProvider( + (bool) $classDescription['group_sequence_provider'] + ); + } + + if (isset($classDescription['group_sequence'])) { + $metadata->setGroupSequence($classDescription['group_sequence']); + } + + if (isset($classDescription['constraints']) && is_array($classDescription['constraints'])) { + foreach ($this->parseNodes($classDescription['constraints']) as $constraint) { + $metadata->addConstraint($constraint); + } + } + + if (isset($classDescription['properties']) && is_array($classDescription['properties'])) { + foreach ($classDescription['properties'] as $property => $constraints) { + if (null !== $constraints) { + foreach ($this->parseNodes($constraints) as $constraint) { + $metadata->addPropertyConstraint($property, $constraint); + } + } + } + } + + if (isset($classDescription['getters']) && is_array($classDescription['getters'])) { + foreach ($classDescription['getters'] as $getter => $constraints) { + if (null !== $constraints) { + foreach ($this->parseNodes($constraints) as $constraint) { + $metadata->addGetterConstraint($getter, $constraint); + } + } + } + } + } +} diff --git a/core/vendor/symfony/validator/Mapping/Loader/YamlFilesLoader.php b/core/vendor/symfony/validator/Mapping/Loader/YamlFilesLoader.php new file mode 100644 index 0000000..235856f --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/Loader/YamlFilesLoader.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +/** + * Loads validation metadata from a list of YAML files. + * + * @author Bulat Shakirzyanov + * @author Bernhard Schussek + * + * @see FilesLoader + */ +class YamlFilesLoader extends FilesLoader +{ + /** + * {@inheritdoc} + */ + public function getFileLoaderInstance($file) + { + return new YamlFileLoader($file); + } +} diff --git a/core/vendor/symfony/validator/Mapping/Loader/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd b/core/vendor/symfony/validator/Mapping/Loader/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd new file mode 100644 index 0000000..1ca840b --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/Loader/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/vendor/symfony/validator/Mapping/MemberMetadata.php b/core/vendor/symfony/validator/Mapping/MemberMetadata.php new file mode 100644 index 0000000..394fa20 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/MemberMetadata.php @@ -0,0 +1,259 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\ValidationVisitorInterface; + +/** + * Stores all metadata needed for validating a class property. + * + * The method of accessing the property's value must be specified by subclasses + * by implementing the {@link newReflectionMember()} method. + * + * This class supports serialization and cloning. + * + * @author Bernhard Schussek + * + * @see PropertyMetadataInterface + */ +abstract class MemberMetadata extends ElementMetadata implements PropertyMetadataInterface +{ + /** + * @var string + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getClassName()} instead. + */ + public $class; + + /** + * @var string + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getName()} instead. + */ + public $name; + + /** + * @var string + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getPropertyName()} instead. + */ + public $property; + + /** + * @var \ReflectionMethod[]|\ReflectionProperty[] + */ + private $reflMember = array(); + + /** + * Constructor. + * + * @param string $class The name of the class this member is defined on + * @param string $name The name of the member + * @param string $property The property the member belongs to + */ + public function __construct($class, $name, $property) + { + $this->class = $class; + $this->name = $name; + $this->property = $property; + } + + /** + * {@inheritdoc} + * + * @deprecated since version 2.5, to be removed in 3.0. + */ + public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath, $propagatedGroup = null) + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); + + $visitor->visit($this, $value, $group, $propertyPath); + + if ($this->isCascaded()) { + $visitor->validate($value, $propagatedGroup ?: $group, $propertyPath, $this->isCollectionCascaded(), $this->isCollectionCascadedDeeply()); + } + } + + /** + * {@inheritdoc} + */ + public function addConstraint(Constraint $constraint) + { + if (!in_array(Constraint::PROPERTY_CONSTRAINT, (array) $constraint->getTargets())) { + throw new ConstraintDefinitionException(sprintf( + 'The constraint %s cannot be put on properties or getters', + get_class($constraint) + )); + } + + parent::addConstraint($constraint); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function __sleep() + { + return array_merge(parent::__sleep(), array( + 'class', + 'name', + 'property', + )); + } + + /** + * Returns the name of the member. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * {@inheritdoc} + */ + public function getClassName() + { + return $this->class; + } + + /** + * {@inheritdoc} + */ + public function getPropertyName() + { + return $this->property; + } + + /** + * Returns whether this member is public. + * + * @param object|string $objectOrClassName The object or the class name + * + * @return bool + */ + public function isPublic($objectOrClassName) + { + return $this->getReflectionMember($objectOrClassName)->isPublic(); + } + + /** + * Returns whether this member is protected. + * + * @param object|string $objectOrClassName The object or the class name + * + * @return bool + */ + public function isProtected($objectOrClassName) + { + return $this->getReflectionMember($objectOrClassName)->isProtected(); + } + + /** + * Returns whether this member is private. + * + * @param object|string $objectOrClassName The object or the class name + * + * @return bool + */ + public function isPrivate($objectOrClassName) + { + return $this->getReflectionMember($objectOrClassName)->isPrivate(); + } + + /** + * Returns whether objects stored in this member should be validated. + * + * @return bool + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link getCascadingStrategy()} instead. + */ + public function isCascaded() + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the getCascadingStrategy() method instead.', E_USER_DEPRECATED); + + return (bool) ($this->cascadingStrategy & CascadingStrategy::CASCADE); + } + + /** + * Returns whether arrays or traversable objects stored in this member + * should be traversed and validated in each entry. + * + * @return bool + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link getTraversalStrategy()} instead. + */ + public function isCollectionCascaded() + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the getTraversalStrategy() method instead.', E_USER_DEPRECATED); + + return (bool) ($this->traversalStrategy & (TraversalStrategy::IMPLICIT | TraversalStrategy::TRAVERSE)); + } + + /** + * Returns whether arrays or traversable objects stored in this member + * should be traversed recursively for inner arrays/traversable objects. + * + * @return bool + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link getTraversalStrategy()} instead. + */ + public function isCollectionCascadedDeeply() + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the getTraversalStrategy() method instead.', E_USER_DEPRECATED); + + return !($this->traversalStrategy & TraversalStrategy::STOP_RECURSION); + } + + /** + * Returns the reflection instance for accessing the member's value. + * + * @param object|string $objectOrClassName The object or the class name + * + * @return \ReflectionMethod|\ReflectionProperty The reflection instance + */ + public function getReflectionMember($objectOrClassName) + { + $className = is_string($objectOrClassName) ? $objectOrClassName : get_class($objectOrClassName); + if (!isset($this->reflMember[$className])) { + $this->reflMember[$className] = $this->newReflectionMember($objectOrClassName); + } + + return $this->reflMember[$className]; + } + + /** + * Creates a new reflection instance for accessing the member's value. + * + * Must be implemented by subclasses. + * + * @param object|string $objectOrClassName The object or the class name + * + * @return \ReflectionMethod|\ReflectionProperty The reflection instance + */ + abstract protected function newReflectionMember($objectOrClassName); +} diff --git a/core/vendor/symfony/validator/Mapping/MetadataInterface.php b/core/vendor/symfony/validator/Mapping/MetadataInterface.php new file mode 100644 index 0000000..fda1dbb --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/MetadataInterface.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +use Symfony\Component\Validator\MetadataInterface as LegacyMetadataInterface; + +/** + * A container for validation metadata. + * + * Most importantly, the metadata stores the constraints against which an object + * and its properties should be validated. + * + * Additionally, the metadata stores whether objects should be validated + * against their class' metadata and whether traversable objects should be + * traversed or not. + * + * @since 2.5 + * @author Bernhard Schussek + * + * @see CascadingStrategy + * @see TraversalStrategy + */ +interface MetadataInterface extends LegacyMetadataInterface +{ + /** + * Returns the strategy for cascading objects. + * + * @return int The cascading strategy + * + * @see CascadingStrategy + */ + public function getCascadingStrategy(); + + /** + * Returns the strategy for traversing traversable objects. + * + * @return int The traversal strategy + * + * @see TraversalStrategy + */ + public function getTraversalStrategy(); + + /** + * Returns all constraints of this element. + * + * @return Constraint[] A list of Constraint instances + */ + public function getConstraints(); +} diff --git a/core/vendor/symfony/validator/Mapping/PropertyMetadata.php b/core/vendor/symfony/validator/Mapping/PropertyMetadata.php new file mode 100644 index 0000000..7319294 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/PropertyMetadata.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +use Symfony\Component\Validator\Exception\ValidatorException; + +/** + * Stores all metadata needed for validating a class property. + * + * The value of the property is obtained by directly accessing the property. + * The property will be accessed by reflection, so the access of private and + * protected properties is supported. + * + * This class supports serialization and cloning. + * + * @author Bernhard Schussek + * + * @see PropertyMetadataInterface + */ +class PropertyMetadata extends MemberMetadata +{ + /** + * Constructor. + * + * @param string $class The class this property is defined on + * @param string $name The name of this property + * + * @throws ValidatorException + */ + public function __construct($class, $name) + { + if (!property_exists($class, $name)) { + throw new ValidatorException(sprintf('Property %s does not exist in class %s', $name, $class)); + } + + parent::__construct($class, $name, $name); + } + + /** + * {@inheritdoc} + */ + public function getPropertyValue($object) + { + return $this->getReflectionMember($object)->getValue($object); + } + + /** + * {@inheritdoc} + */ + protected function newReflectionMember($objectOrClassName) + { + $class = new \ReflectionClass($objectOrClassName); + while (!$class->hasProperty($this->getName())) { + $class = $class->getParentClass(); + } + + $member = new \ReflectionProperty($class->getName(), $this->getName()); + $member->setAccessible(true); + + return $member; + } +} diff --git a/core/vendor/symfony/validator/Mapping/PropertyMetadataInterface.php b/core/vendor/symfony/validator/Mapping/PropertyMetadataInterface.php new file mode 100644 index 0000000..79e2c79 --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/PropertyMetadataInterface.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +use Symfony\Component\Validator\ClassBasedInterface; +use Symfony\Component\Validator\PropertyMetadataInterface as LegacyPropertyMetadataInterface; + +/** + * Stores all metadata needed for validating the value of a class property. + * + * Most importantly, the metadata stores the constraints against which the + * property's value should be validated. + * + * Additionally, the metadata stores whether objects stored in the property + * should be validated against their class' metadata and whether traversable + * objects should be traversed or not. + * + * @since 2.5 + * @author Bernhard Schussek + * + * @see MetadataInterface + * @see CascadingStrategy + * @see TraversalStrategy + */ +interface PropertyMetadataInterface extends MetadataInterface, LegacyPropertyMetadataInterface, ClassBasedInterface +{ +} diff --git a/core/vendor/symfony/validator/Mapping/TraversalStrategy.php b/core/vendor/symfony/validator/Mapping/TraversalStrategy.php new file mode 100644 index 0000000..450a3ec --- /dev/null +++ b/core/vendor/symfony/validator/Mapping/TraversalStrategy.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +/** + * Specifies whether and how a traversable object should be traversed. + * + * If the node traverser traverses a node whose value is an instance of + * {@link \Traversable}, and if that node is either a class node or if + * cascading is enabled, then the node's traversal strategy will be checked. + * Depending on the requested traversal strategy, the node traverser will + * iterate over the object and cascade each object or collection returned by + * the iterator. + * + * The traversal strategy is ignored for arrays. Arrays are always iterated. + * + * @since 2.1 + * @author Bernhard Schussek + * + * @see CascadingStrategy + */ +class TraversalStrategy +{ + /** + * Specifies that a node's value should be iterated only if it is an + * instance of {@link \Traversable}. + */ + const IMPLICIT = 1; + + /** + * Specifies that a node's value should never be iterated. + */ + const NONE = 2; + + /** + * Specifies that a node's value should always be iterated. If the value is + * not an instance of {@link \Traversable}, an exception should be thrown. + */ + const TRAVERSE = 4; + + /** + * Specifies that nested instances of {@link \Traversable} should never be + * iterated. Can be combined with {@link IMPLICIT} or {@link TRAVERSE}. + * + * @deprecated since version 2.5, to be removed in 3.0. This constant was added for backwards compatibility only. + * + * @internal + */ + const STOP_RECURSION = 8; + + /** + * Not instantiable. + */ + private function __construct() + { + } +} diff --git a/core/vendor/symfony/validator/MetadataFactoryInterface.php b/core/vendor/symfony/validator/MetadataFactoryInterface.php new file mode 100644 index 0000000..555bea9 --- /dev/null +++ b/core/vendor/symfony/validator/MetadataFactoryInterface.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * Returns {@link MetadataInterface} instances for values. + * + * @author Bernhard Schussek + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link Mapping\Factory\MetadataFactoryInterface} instead. + */ +interface MetadataFactoryInterface +{ + /** + * Returns the metadata for the given value. + * + * @param mixed $value Some value + * + * @return MetadataInterface The metadata for the value + * + * @throws Exception\NoSuchMetadataException If no metadata exists for the given value + */ + public function getMetadataFor($value); + + /** + * Returns whether the class is able to return metadata for the given value. + * + * @param mixed $value Some value + * + * @return bool Whether metadata can be returned for that value + */ + public function hasMetadataFor($value); +} diff --git a/core/vendor/symfony/validator/MetadataInterface.php b/core/vendor/symfony/validator/MetadataInterface.php new file mode 100644 index 0000000..2c89449 --- /dev/null +++ b/core/vendor/symfony/validator/MetadataInterface.php @@ -0,0 +1,73 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * A container for validation metadata. + * + * The container contains constraints that may belong to different validation + * groups. Constraints for a specific group can be fetched by calling + * {@link findConstraints}. + * + * Implement this interface to add validation metadata to your own metadata + * layer. Each metadata may have named properties. Each property can be + * represented by one or more {@link PropertyMetadataInterface} instances that + * are returned by {@link getPropertyMetadata}. Since + * PropertyMetadataInterface inherits from MetadataInterface, + * each property may be divided into further properties. + * + * The {@link accept} method of each metadata implements the Visitor pattern. + * The method should forward the call to the visitor's + * {@link ValidationVisitorInterface::visit} method and additionally call + * accept() on all structurally related metadata instances. + * + * For example, to store constraints for PHP classes and their properties, + * create a class ClassMetadata (implementing MetadataInterface) + * and a class PropertyMetadata (implementing PropertyMetadataInterface). + * ClassMetadata::getPropertyMetadata($property) returns all + * PropertyMetadata instances for a property of that class. Its + * accept()-method simply forwards to ValidationVisitorInterface::visit() + * and calls accept() on all contained PropertyMetadata + * instances, which themselves call ValidationVisitorInterface::visit() + * again. + * + * @author Bernhard Schussek + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link Mapping\MetadataInterface} instead. + */ +interface MetadataInterface +{ + /** + * Implementation of the Visitor design pattern. + * + * Calls {@link ValidationVisitorInterface::visit} and then forwards the + * accept()-call to all property metadata instances. + * + * @param ValidationVisitorInterface $visitor The visitor implementing the validation logic + * @param mixed $value The value to validate + * @param string|string[] $group The validation group to validate in + * @param string $propertyPath The current property path in the validation graph + * + * @deprecated since version 2.5, to be removed in 3.0. + */ + public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath); + + /** + * Returns all constraints for a given validation group. + * + * @param string $group The validation group + * + * @return Constraint[] A list of constraint instances + */ + public function findConstraints($group); +} diff --git a/core/vendor/symfony/validator/ObjectInitializerInterface.php b/core/vendor/symfony/validator/ObjectInitializerInterface.php new file mode 100644 index 0000000..0426bc8 --- /dev/null +++ b/core/vendor/symfony/validator/ObjectInitializerInterface.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * Prepares an object for validation. + * + * Concrete implementations of this interface are used by {@link ValidationVisitorInterface} + * to initialize objects just before validating them. + * + * @author Fabien Potencier + * @author Bernhard Schussek + * + * @api + */ +interface ObjectInitializerInterface +{ + /** + * Initializes an object just before validation. + * + * @param object $object The object to validate + * + * @api + */ + public function initialize($object); +} diff --git a/core/vendor/symfony/validator/PropertyMetadataContainerInterface.php b/core/vendor/symfony/validator/PropertyMetadataContainerInterface.php new file mode 100644 index 0000000..5441be1 --- /dev/null +++ b/core/vendor/symfony/validator/PropertyMetadataContainerInterface.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * A container for {@link PropertyMetadataInterface} instances. + * + * @author Bernhard Schussek + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link Mapping\ClassMetadataInterface} instead. + */ +interface PropertyMetadataContainerInterface +{ + /** + * Check if there's any metadata attached to the given named property. + * + * @param string $property The property name. + * + * @return bool + */ + public function hasPropertyMetadata($property); + + /** + * Returns all metadata instances for the given named property. + * + * If your implementation does not support properties, simply throw an + * exception in this method (for example a BadMethodCallException). + * + * @param string $property The property name. + * + * @return PropertyMetadataInterface[] A list of metadata instances. Empty if + * no metadata exists for the property. + */ + public function getPropertyMetadata($property); +} diff --git a/core/vendor/symfony/validator/PropertyMetadataInterface.php b/core/vendor/symfony/validator/PropertyMetadataInterface.php new file mode 100644 index 0000000..20af8a9 --- /dev/null +++ b/core/vendor/symfony/validator/PropertyMetadataInterface.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * A container for validation metadata of a property. + * + * What exactly you define as "property" is up to you. The validator expects + * implementations of {@link MetadataInterface} that contain constraints and + * optionally a list of named properties that also have constraints (and may + * have further sub properties). Such properties are mapped by implementations + * of this interface. + * + * @author Bernhard Schussek + * + * @see MetadataInterface + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link Mapping\PropertyMetadataInterface} instead. + */ +interface PropertyMetadataInterface extends MetadataInterface +{ + /** + * Returns the name of the property. + * + * @return string The property name. + */ + public function getPropertyName(); + + /** + * Extracts the value of the property from the given container. + * + * @param mixed $containingValue The container to extract the property value from. + * + * @return mixed The value of the property. + */ + public function getPropertyValue($containingValue); +} diff --git a/core/vendor/symfony/validator/README.md b/core/vendor/symfony/validator/README.md new file mode 100644 index 0000000..0c9bc50 --- /dev/null +++ b/core/vendor/symfony/validator/README.md @@ -0,0 +1,126 @@ +Validator Component +=================== + +This component is based on the JSR-303 Bean Validation specification and +enables specifying validation rules for classes using XML, YAML, PHP or +annotations, which can then be checked against instances of these classes. + +Usage +----- + +The component provides "validation constraints", which are simple objects +containing the rules for the validation. Let's validate a simple string +as an example: + +```php +use Symfony\Component\Validator\Validation; +use Symfony\Component\Validator\Constraints\Length; + +$validator = Validation::createValidator(); + +$violations = $validator->validateValue('Bernhard', new Length(array('min' => 10))); +``` + +This validation will fail because the given string is shorter than ten +characters. The precise errors, here called "constraint violations", are +returned by the validator. You can analyze these or return them to the user. +If the violation list is empty, validation succeeded. + +Validation of arrays is possible using the `Collection` constraint: + +```php +use Symfony\Component\Validator\Validation; +use Symfony\Component\Validator\Constraints as Assert; + +$validator = Validation::createValidator(); + +$constraint = new Assert\Collection(array( + 'name' => new Assert\Collection(array( + 'first_name' => new Assert\Length(array('min' => 101)), + 'last_name' => new Assert\Length(array('min' => 1)), + )), + 'email' => new Assert\Email(), + 'simple' => new Assert\Length(array('min' => 102)), + 'gender' => new Assert\Choice(array(3, 4)), + 'file' => new Assert\File(), + 'password' => new Assert\Length(array('min' => 60)), +)); + +$violations = $validator->validateValue($input, $constraint); +``` + +Again, the validator returns the list of violations. + +Validation of objects is possible using "constraint mapping". With such +a mapping you can put constraints onto properties and objects of classes. +Whenever an object of this class is validated, its properties and +method results are matched against the constraints. + +```php +use Symfony\Component\Validator\Validation; +use Symfony\Component\Validator\Constraints as Assert; + +class User +{ + /** + * @Assert\Length(min = 3) + * @Assert\NotBlank + */ + private $name; + + /** + * @Assert\Email + * @Assert\NotBlank + */ + private $email; + + public function __construct($name, $email) + { + $this->name = $name; + $this->email = $email; + } + + /** + * @Assert\True(message = "The user should have a Google Mail account") + */ + public function isGmailUser() + { + return false !== strpos($this->email, '@gmail.com'); + } +} + +$validator = Validation::createValidatorBuilder() + ->enableAnnotationMapping() + ->getValidator(); + +$user = new User('John Doe', 'john@example.com'); + +$violations = $validator->validate($user); +``` + +This example uses the annotation support of Doctrine Common to +map constraints to properties and methods. You can also map constraints +using XML, YAML or plain PHP, if you dislike annotations or don't want +to include Doctrine. Check the documentation for more information about +these drivers. + +Resources +--------- + +Silex integration: + +https://github.com/fabpot/Silex/blob/master/src/Silex/Provider/ValidatorServiceProvider.php + +Documentation: + +http://symfony.com/doc/2.7/book/validation.html + +JSR-303 Specification: + +http://jcp.org/en/jsr/detail?id=303 + +You can run the unit tests with the following command: + + $ cd path/to/Symfony/Component/Validator/ + $ composer install + $ phpunit diff --git a/core/vendor/symfony/validator/Resources/translations/validators.af.xlf b/core/vendor/symfony/validator/Resources/translations/validators.af.xlf new file mode 100644 index 0000000..177bb00 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.af.xlf @@ -0,0 +1,227 @@ + + + + + + This value should be false. + Hierdie waarde moet vals wees. + + + This value should be true. + Hierdie waarde moet waar wees. + + + This value should be of type {{ type }}. + Hierdie waarde moet van die soort {{type}} wees. + + + This value should be blank. + Hierdie waarde moet leeg wees. + + + The value you selected is not a valid choice. + Die waarde wat jy gekies het is nie 'n geldige keuse nie. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Jy moet ten minste {{ limit }} kies.|Jy moet ten minste {{ limit }} keuses kies. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Jy moet by die meeste {{ limit }} keuse kies.|Jy moet by die meeste {{ limit }} keuses kies. + + + One or more of the given values is invalid. + Een of meer van die gegewe waardes is ongeldig. + + + This field was not expected. + Die veld is nie verwag nie. + + + This field is missing. + Hierdie veld ontbreek. + + + This value is not a valid date. + Hierdie waarde is nie 'n geldige datum nie. + + + This value is not a valid datetime. + Hierdie waarde is nie 'n geldige datum en tyd nie. + + + This value is not a valid email address. + Hierdie waarde is nie 'n geldige e-pos adres nie. + + + The file could not be found. + Die lêer kon nie gevind word nie. + + + The file is not readable. + Die lêer kan nie gelees word nie. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Die lêer is te groot ({{ size }} {{ suffix }}). Toegelaat maksimum grootte is {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Die MIME-tipe van die lêer is ongeldig ({{ type }}). Toegelaat MIME-tipes is {{ types }}. + + + This value should be {{ limit }} or less. + Hierdie waarde moet {{ limit }} of minder wees. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Hierdie waarde is te lank. Dit moet {{ limit }} karakter of minder wees.|Hierdie waarde is te lank. Dit moet {{ limit }} karakters of minder wees. + + + This value should be {{ limit }} or more. + Hierdie waarde moet {{ limit }} of meer wees. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Hierdie waarde is te kort. Dit moet {{ limit }} karakter of meer wees.|Hierdie waarde is te kort. Dit moet {{ limit }} karakters of meer wees. + + + This value should not be blank. + Hierdie waarde moet nie leeg wees nie. + + + This value should not be null. + Hierdie waarde moet nie nul wees nie. + + + This value should be null. + Hierdie waarde moet nul wees. + + + This value is not valid. + Hierdie waarde is nie geldig nie. + + + This value is not a valid time. + Hierdie waarde is nie 'n geldige tyd nie. + + + This value is not a valid URL. + Hierdie waarde is nie 'n geldige URL nie. + + + The two values should be equal. + Die twee waardes moet gelyk wees. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Die lêer is te groot. Toegelaat maksimum grootte is {{ limit }} {{ suffix }}. + + + The file is too large. + Die lêer is te groot. + + + The file could not be uploaded. + Die lêer kan nie opgelaai word nie. + + + This value should be a valid number. + Hierdie waarde moet 'n geldige nommer wees. + + + This file is not a valid image. + Hierdie lêer is nie 'n geldige beeld nie. + + + This is not a valid IP address. + Hierdie is nie 'n geldige IP-adres nie. + + + This value is not a valid language. + Hierdie waarde is nie 'n geldige taal nie. + + + This value is not a valid locale. + Hierdie waarde is nie 'n geldige land instelling nie. + + + This value is not a valid country. + Hierdie waarde is nie 'n geldige land nie. + + + This value is already used. + Hierdie waarde word reeds gebruik. + + + The size of the image could not be detected. + Die grootte van die beeld kon nie opgespoor word nie. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Die beeld breedte is te groot ({{ width }}px). Toegelaat maksimum breedte is {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Die beeld breedte is te klein ({{ width }}px). Minimum breedte verwag is {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Die beeld hoogte is te groot ({{ height }}px). Toegelaat maksimum hoogte is {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Die beeld hoogte is te klein ({{ height }}px). Minimum hoogte verwag is {{ min_height }}px. + + + This value should be the user's current password. + Hierdie waarde moet die huidige wagwoord van die gebruiker wees. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Hierdie waarde moet presies {{ limit }} karakter wees.|Hierdie waarde moet presies {{ limit }} karakters wees. + + + The file was only partially uploaded. + Die lêer is slegs gedeeltelik opgelaai. + + + No file was uploaded. + Geen lêer is opgelaai nie. + + + No temporary folder was configured in php.ini. + Geen tydelike lêer is ingestel in php.ini nie. + + + Cannot write temporary file to disk. + Kan nie tydelike lêer skryf op skyf nie. + + + A PHP extension caused the upload to fail. + 'n PHP-uitbreiding veroorsaak die oplaai van die lêer om te misluk. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Hierdie versameling moet {{ limit }} element of meer bevat.|Hierdie versameling moet {{ limit }} elemente of meer bevat. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Hierdie versameling moet {{ limit }} element of minder bevat.|Hierdie versameling moet {{ limit }} elemente of meer bevat. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Hierdie versameling moet presies {{ limit }} element bevat.|Hierdie versameling moet presies {{ limit }} elemente bevat. + + + Invalid card number. + Ongeldige kredietkaart nommer. + + + Unsupported card type or invalid card number. + Nie-ondersteunde tipe kaart of ongeldige kredietkaart nommer. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.ar.xlf b/core/vendor/symfony/validator/Resources/translations/validators.ar.xlf new file mode 100644 index 0000000..b448c2e --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.ar.xlf @@ -0,0 +1,283 @@ + + + + + + This value should be false. + هذه القيمة يجب أن تكون خاطئة. + + + This value should be true. + هذه القيمة يجب أن تكون حقيقية. + + + This value should be of type {{ type }}. + هذه القيمة يجب ان تكون من نوع {{ type }}. + + + This value should be blank. + هذه القيمة يجب ان تكون Ùارغة. + + + The value you selected is not a valid choice. + القيمة المختارة ليست خيارا صحيحا. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + يجب ان تختار {{ limit }} اختيار على الاقل.|يجب ان تختار {{ limit }} اختيار على الاقل.|يجب ان تختار {{ limit }} اختيارات على الاقل.|يجب ان تختار {{ limit }} اختيار على الاقل.|يجب ان تختار {{ limit }} اختيار على الاقل.|يجب ان تختار {{ limit }} اختيار على الاقل. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + يجب ان تختار {{ limit }} اختيار على الاكثر.|يجب ان تختار {{ limit }} اختيار على الاكثر.|يجب ان تختار {{ limit }} اختيارات على الاكثر.|يجب ان تختار {{ limit }} اختيار على الاكثر.|يجب ان تختار {{ limit }} اختيار على الاكثر.|يجب ان تختار {{ limit }} اختيار على الاكثر. + + + One or more of the given values is invalid. + واحد أو أكثر من القيم المعطاه خاطئ. + + + This field was not expected. + لم يكن من المتوقع هذا المجال. + + + This field is missing. + هذا المجال Ù…Ùقود. + + + This value is not a valid date. + هذه القيمة ليست تاريخا صالحا. + + + This value is not a valid datetime. + هذه القيمة ليست تاريخا Ùˆ وقتا صالحا. + + + This value is not a valid email address. + هذه القيمة ليست عنوان بريد إلكتروني صحيح. + + + The file could not be found. + لا يمكن العثور على الملÙ. + + + The file is not readable. + المل٠غير قابل للقراءة. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + المل٠كبير جدا ({{ size }} {{ suffix }}).اقصى مساحه مسموح بها ({{ limit }} {{ suffix }}). + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + نوع المل٠غير صحيح ({{ type }}). الانواع المسموح بها هى {{ types }}. + + + This value should be {{ limit }} or less. + هذه القيمة يجب ان تكون {{ limit }} او اقل. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + هذه القيمة طويلة جدا. يجب ان تكون {{ limit }} حر٠او اقل.|هذه القيمة طويلة جدا. يجب ان تكون {{ limit }} حر٠او اقل.|هذه القيمة طويلة جدا. يجب ان تكون {{ limit }} حرو٠او اقل.|هذه القيمة طويلة جدا. يجب ان تكون {{ limit }} حر٠او اقل.|هذه القيمة طويلة جدا. يجب ان تكون {{ limit }} حر٠او اقل.|هذه القيمة طويلة جدا. يجب ان تكون {{ limit }} حر٠او اقل. + + + This value should be {{ limit }} or more. + هذه القيمة يجب ان تكون {{ limit }} او اكثر. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + هذه القيمة قصيرة جدا. يجب ان تكون {{ limit }} حر٠او اكثر.|هذه القيمة قصيرة جدا. يجب ان تكون {{ limit }} حر٠او اكثر.|هذه القيمة قصيرة جدا. يجب ان تكون {{ limit }} حرو٠او اكثر.|هذه القيمة قصيرة جدا. يجب ان تكون {{ limit }} حر٠او اكثر.|هذه القيمة قصيرة جدا. يجب ان تكون {{ limit }} حر٠او اكثر.|هذه القيمة قصيرة جدا. يجب ان تكون {{ limit }} حر٠او اكثر. + + + This value should not be blank. + هذه القيمة يجب الا تكون Ùارغة. + + + This value should not be null. + هذه القيمة يجب الا تكون Ùارغة. + + + This value should be null. + هذه القيمة يجب ان تكون Ùارغة. + + + This value is not valid. + هذه القيمة غير صحيحة. + + + This value is not a valid time. + هذه القيمة ليست وقت صحيح. + + + This value is not a valid URL. + هذه القيمة ليست رابط الكترونى صحيح. + + + The two values should be equal. + القيمتان يجب ان تكونا متساويتان. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + المل٠كبير جدا. اقصى مساحه مسموح بها {{ limit }} {{ suffix }}. + + + The file is too large. + المل٠كبير جدا. + + + The file could not be uploaded. + لم استطع استقبال الملÙ. + + + This value should be a valid number. + هذه القيمة يجب ان تكون رقم. + + + This file is not a valid image. + هذا المل٠ليس صورة صحيحة. + + + This is not a valid IP address. + هذه القيمة ليست عنوان رقمى صحيح. + + + This value is not a valid language. + هذه القيمة ليست لغة صحيحة. + + + This value is not a valid locale. + هذه القيمة ليست موقع صحيح. + + + This value is not a valid country. + هذه القيمة ليست بلدا صالحا. + + + This value is already used. + هذه القيمة مستخدمة بالÙعل. + + + The size of the image could not be detected. + لم استطع معرÙØ© حجم الصورة. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + عرض الصورة كبير جدا ({{ width }}px). اقصى عرض مسموح به هو{{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + عرض الصورة صغير جدا ({{ width }}px). اقل عرض مسموح به هو{{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + طول الصورة كبير جدا ({{ height }}px). اقصى طول مسموح به هو{{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + طول الصورة صغير جدا ({{ height }}px). اقل طول مسموح به هو{{ min_height }}px. + + + This value should be the user's current password. + هذه القيمة يجب ان تكون كلمة سر المستخدم الحالية. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + هذه القيمة يجب ان تحتوى على {{ limit }} حر٠Ùقط.|هذه القيمة يجب ان تحتوى على {{ limit }} حر٠Ùقط.|هذه القيمة يجب ان تحتوى على {{ limit }} حرو٠Ùقط.|هذه القيمة يجب ان تحتوى على {{ limit }} حر٠Ùقط.|هذه القيمة يجب ان تحتوى على {{ limit }} حر٠Ùقط.|هذه القيمة يجب ان تحتوى على {{ limit }} حر٠Ùقط. + + + The file was only partially uploaded. + تم استقبال جزء من المل٠Ùقط. + + + No file was uploaded. + لم يتم ارسال اى ملÙ. + + + No temporary folder was configured in php.ini. + لم يتم تهيئة حاÙظة مؤقتة ÙÙ‰ مل٠php.ini. + + + Cannot write temporary file to disk. + لم استطع كتابة المل٠المؤقت. + + + A PHP extension caused the upload to fail. + احد اضاÙات PHP تسببت ÙÙ‰ Ùشل استقبال الملÙ. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اكثر.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اكثر.|هذه المجموعة يجب ان تحتوى على {{ limit }} عناصر او اكثر.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اكثر.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اكثر.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اكثر. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اقل.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اقل.|هذه المجموعة يجب ان تحتوى على {{ limit }} عناصر او اقل.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اقل.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اقل.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اقل. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر Ùقط.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر Ùقط.|هذه المجموعة يجب ان تحتوى على {{ limit }} عناصر Ùقط.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر Ùقط.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر Ùقط.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر Ùقط. + + + Invalid card number. + رقم البطاقه غير صحيح. + + + Unsupported card type or invalid card number. + نوع البطاقه غير مدعوم او الرقم غير صحيح. + + + This is not a valid International Bank Account Number (IBAN). + الرقم IBAN (رقم الحساب المصرÙÙŠ الدولي) الذي تم إدخاله غير صالح. + + + This value is not a valid ISBN-10. + هذه القيمة ليست ISBN-10 صالحة. + + + This value is not a valid ISBN-13. + هذه القيمة ليست ISBN-13 صالحة. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + هذه القيمة ليست ISBN-10 صالحة ولا ISBN-13 صالحة. + + + This value is not a valid ISSN. + هذه القيمة ليست ISSN صالحة. + + + This value is not a valid currency. + العÙملة غير صحيحة. + + + This value should be equal to {{ compared_value }}. + القيمة يجب ان تساوي {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + القيمة يجب ان تكون اعلي من {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + القيمة يجب ان تكون مساوية او اعلي من {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + القيمة يجب ان تطابق {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + القيمة يجب ان تكون اقل من {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + القيمة يجب ان تساوي او تقل عن {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + القيمة يجب ان لا تساوي {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + القيمة يجب ان لا تطابق {{ compared_value_type }} {{ compared_value }}. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.az.xlf b/core/vendor/symfony/validator/Resources/translations/validators.az.xlf new file mode 100644 index 0000000..add868c --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.az.xlf @@ -0,0 +1,227 @@ + + + + + + This value should be false. + Bu dÉ™yÉ™r false olmalıdır. + + + This value should be true. + Bu dÉ™yÉ™r true olmalıdır. + + + This value should be of type {{ type }}. + Bu dÉ™yÉ™rin tipi {{ type }} olmalıdır. + + + This value should be blank. + Bu dÉ™yÉ™r boÅŸ olmalıdır. + + + The value you selected is not a valid choice. + Seçdiyiniz dÉ™yÉ™r düzgün bir seçim deÄŸil. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Æn az {{ limit }} seçim qeyd edilmÉ™lidir. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Æn çox {{ limit }} seçim qeyd edilmÉ™lidir. + + + One or more of the given values is invalid. + TÉ™qdim edilÉ™n dÉ™yÉ™rlÉ™rdÉ™n bir vÉ™ ya bir neçəsi yanlışdır. + + + This field was not expected. + Bu sahÉ™ gözlÉ™nilmirdi. + + + This field is missing. + Bu sahÉ™ É™ksikdir. + + + This value is not a valid date. + Bu dÉ™yÉ™r düzgün bir tarix deyil. + + + This value is not a valid datetime. + Bu dÉ™yÉ™r düzgün bir tarixsaat deyil. + + + This value is not a valid email address. + Bu dÉ™yÉ™r düzgün bir e-poçt adresi deyil. + + + The file could not be found. + Fayl tapılmadı. + + + The file is not readable. + Fayl oxunabilÉ™n deyil. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Fayl çox böyükdür ({{ size }} {{ suffix }}). Ä°cazÉ™ verilÉ™n maksimum fayl ölçüsü {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Faylın mime tipi yanlışdr ({{ type }}). Ä°cazÉ™ verilÉ™n mime tiplÉ™ri {{ types }}. + + + This value should be {{ limit }} or less. + Bu dÉ™yÉ™r {{ limit }} vÉ™ ya altında olmalıdır. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Bu dÉ™yÉ™r çox uzundur. {{ limit }} vÉ™ ya daha az simvol olmalıdır. + + + This value should be {{ limit }} or more. + Bu dÉ™yÉ™r {{ limit }} veya daha fazla olmalıdır. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Bu dÉ™yÉ™r çox qısadır. {{ limit }} vÉ™ ya daha çox simvol olmalıdır. + + + This value should not be blank. + Bu dÉ™yÉ™r boÅŸ olmamalıdır. + + + This value should not be null. + Bu dÉ™yÉ™r boÅŸ olmamalıdır. + + + This value should be null. + Bu dÉ™yÉ™r boÅŸ olmamalıdır. + + + This value is not valid. + Bu dÉ™yÉ™r doÄŸru deyil. + + + This value is not a valid time. + Bu dÉ™yÉ™r doÄŸru bir saat deyil. + + + This value is not a valid URL. + Bu dÉ™yÉ™r doÄŸru bir URL deÄŸil. + + + The two values should be equal. + Ä°ki dÉ™yÉ™r eyni olmalıdır. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Fayl çox böyükdür. Ä°cazÉ™ verilÉ™n É™n böyük fayl ölçüsü {{ limit }} {{ suffix }}. + + + The file is too large. + Fayl çox böyükdür. + + + The file could not be uploaded. + Fayl yüklÉ™nÉ™bilmir. + + + This value should be a valid number. + Bu dÉ™yÉ™r rÉ™qÉ™m olmalıdır. + + + This file is not a valid image. + Bu fayl düzgün bir ÅŸÉ™kil deyil. + + + This is not a valid IP address. + Bu düzgün bir IP adresi deyil. + + + This value is not a valid language. + Bu dÉ™yÉ™r düzgün bir dil deyil. + + + This value is not a valid locale. + Bu dÉ™yÉ™r düzgün bir dil deyil. + + + This value is not a valid country. + Bu dÉ™yÉ™r düzgün bir ölkÉ™ deyil. + + + This value is already used. + Bu dÉ™yÉ™r hal-hazırda istifadÉ™dÉ™dir. + + + The size of the image could not be detected. + Şəklin ölçüsü hesablana bilmir. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Şəklin geniÅŸliyi çox böyükdür ({{ width }}px). Ä°cazÉ™ verilÉ™n É™n böyük geniÅŸlik {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Şəklin geniÅŸliyi çox kiçikdir ({{ width }}px). Æn az {{ min_width }}px olmalıdır. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Şəklin yüksÉ™kliyi çox böyükdür ({{ height }}px). Ä°cazÉ™ verilÉ™n É™n böyük yüksÉ™klik {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Şəklin yüksÉ™kliyi çox kiçikdir ({{ height }}px). Æn az {{ min_height }}px olmalıdır. + + + This value should be the user's current password. + Bu dÉ™yÉ™r istifadəçinin hazırkı parolu olmalıdır. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Bu dÉ™yÉ™r tam olaraq {{ limit }} simvol olmaldır. + + + The file was only partially uploaded. + Fayl qismÉ™n yüklÉ™ndi. + + + No file was uploaded. + Fayl yüklÉ™nmÉ™di. + + + No temporary folder was configured in php.ini. + php.ini'dÉ™ müvÉ™qqÉ™ti qovluq quraÅŸdırılmayıb. + + + Cannot write temporary file to disk. + MüvÉ™qqÉ™ti fayl diskÉ™ yazıla bilmir. + + + A PHP extension caused the upload to fail. + Bir PHP É™lavÉ™si faylın yüklÉ™nmÉ™sinÉ™ mane oldu. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Bu kolleksiyada {{ limit }} vÉ™ ya daha çox element olmalıdır. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Bu kolleksiyada {{ limit }} vÉ™ ya daha az element olmalıdır. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Bu kolleksiyada tam olaraq {{ limit }} element olmalıdır. + + + Invalid card number. + Yanlış kart nömrÉ™si. + + + Unsupported card type or invalid card number. + DÉ™stÉ™klÉ™nmÉ™yÉ™n kart tipi vÉ™ ya yanlış kart nömrÉ™si. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.bg.xlf b/core/vendor/symfony/validator/Resources/translations/validators.bg.xlf new file mode 100644 index 0000000..7c5da55 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.bg.xlf @@ -0,0 +1,283 @@ + + + + + + This value should be false. + СтойноÑтта Ñ‚Ñ€Ñбва да бъде лъжа (false). + + + This value should be true. + СтойноÑтта Ñ‚Ñ€Ñбва да бъде иÑтина (true). + + + This value should be of type {{ type }}. + СтойноÑтта Ñ‚Ñ€Ñбва да бъде от тип {{ type }}. + + + This value should be blank. + СтойноÑтта Ñ‚Ñ€Ñбва да бъде празна. + + + The value you selected is not a valid choice. + Избраната ÑтойноÑÑ‚ е невалидна. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + ТрÑбва да изберете поне {{ limit }} опциÑ.|ТрÑбва да изберете поне {{ limit }} опции. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + ТрÑбва да изберете най-много {{ limit }} опциÑ.|ТрÑбва да изберете най-много {{ limit }} опции. + + + One or more of the given values is invalid. + Една или повече от зададените ÑтойноÑти е невалидна. + + + This field was not expected. + Това поле не Ñе е очаквало. + + + This field is missing. + Това поле липÑва. + + + This value is not a valid date. + СтойноÑтта не е валидна дата (date). + + + This value is not a valid datetime. + СтойноÑтта не е валидна дата (datetime). + + + This value is not a valid email address. + СтойноÑтта не е валиден email адреÑ. + + + The file could not be found. + Файлът не беше открит. + + + The file is not readable. + Файлът не може да бъде прочетен. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Файлът е твърде голÑм ({{ size }} {{ suffix }}). МакÑималниÑÑ‚ размер е {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Майм типа на файла е невалиден ({{ type }}). Разрешени майм типове Ñа {{ types }}. + + + This value should be {{ limit }} or less. + СтойноÑтта Ñ‚Ñ€Ñбва да бъде {{ limit }} или по-малко. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + СтойноÑтта е твърде дълга. ТрÑбва да Ñъдържа най-много {{ limit }} Ñимвол.|СтойноÑтта е твърде дълга. ТрÑбва да Ñъдържа най-много {{ limit }} Ñимвола. + + + This value should be {{ limit }} or more. + СтойноÑтта Ñ‚Ñ€Ñбва да бъде {{ limit }} или повече. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + СтойноÑтта е твърде кратка. ТрÑбва да Ñъдържа поне {{ limit }} Ñимвол.|СтойноÑтта е твърде кратка. ТрÑбва да Ñъдържа поне {{ limit }} Ñимвола. + + + This value should not be blank. + СтойноÑтта не Ñ‚Ñ€Ñбва да бъде празна. + + + This value should not be null. + СтойноÑтта не Ñ‚Ñ€Ñбва да бъде null. + + + This value should be null. + СтойноÑтта Ñ‚Ñ€Ñбва да бъде null. + + + This value is not valid. + СтойноÑтта не е валидна. + + + This value is not a valid time. + СтойноÑтта не е валидно време (time). + + + This value is not a valid URL. + СтойноÑтта не е валиден URL. + + + The two values should be equal. + Двете ÑтойноÑти Ñ‚Ñ€Ñбва да бъдат равни. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Файлът е твърде голÑм. РазрешениÑÑ‚ макÑимален размер е {{ limit }} {{ suffix }}. + + + The file is too large. + Файлът е твърде голÑм. + + + The file could not be uploaded. + Файлът не може да бъде качен. + + + This value should be a valid number. + СтойноÑтта Ñ‚Ñ€Ñбва да бъде валиден номер. + + + This file is not a valid image. + Файлът не е валидно изображение. + + + This is not a valid IP address. + Това не е валиден IP адреÑ. + + + This value is not a valid language. + СтойноÑтта не е валиден език. + + + This value is not a valid locale. + СтойноÑтта не е валидна локализациÑ. + + + This value is not a valid country. + СтойноÑтта не е валидна държава. + + + This value is already used. + СтойноÑтта вече е в употреба. + + + The size of the image could not be detected. + Размера на изображението не може да бъде определен. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Изображението е твърде широко ({{ width }}px). Широчината Ñ‚Ñ€Ñбва да бъде макÑимум {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Изображението е Ñ Ñ‚Ð²ÑŠÑ€Ð´Ðµ малка широчина ({{ width }}px). Широчината Ñ‚Ñ€Ñбва да бъде минимум {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Изображението е Ñ Ñ‚Ð²ÑŠÑ€Ð´Ðµ голÑма виÑочина ({{ height }}px). ВиÑочината Ñ‚Ñ€Ñбва да бъде макÑимум {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Изображението е Ñ Ñ‚Ð²ÑŠÑ€Ð´Ðµ малка виÑочина ({{ height }}px). ВиÑочина Ñ‚Ñ€Ñбва да бъде минимум {{ min_height }}px. + + + This value should be the user's current password. + СтойноÑтта Ñ‚Ñ€Ñбва да бъде текущата потребителÑка парола. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + СтойноÑтта Ñ‚Ñ€Ñбва да бъде точно {{ limit }} Ñимвол.|СтойноÑтта Ñ‚Ñ€Ñбва да бъде точно {{ limit }} Ñимвола. + + + The file was only partially uploaded. + Файлът е качен чаÑтично. + + + No file was uploaded. + Файлът не беше качен. + + + No temporary folder was configured in php.ini. + Ðе е поÑочена Ð´Ð¸Ñ€ÐµÐºÑ‚Ð¾Ñ€Ð¸Ñ Ð·Ð° временни файлове в php.ini. + + + Cannot write temporary file to disk. + Ðе може да запише временен файл на диÑка. + + + A PHP extension caused the upload to fail. + PHP разширение предизвика прекъÑване на качването. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + КолекциÑта Ñ‚Ñ€Ñбва да Ñъдържа поне {{ limit }} елемент.|КолекциÑта Ñ‚Ñ€Ñбва да Ñъдържа поне {{ limit }} елемента. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + КолекциÑта Ñ‚Ñ€Ñбва да Ñъдържа най-много {{ limit }} елемент.|КолекциÑта Ñ‚Ñ€Ñбва да Ñъдържа най-много {{ limit }} елемента. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + КолекциÑта Ñ‚Ñ€Ñбва да Ñъдържа точно {{ limit }} елемент.|КолекциÑта Ñ‚Ñ€Ñбва да Ñъдържа точно {{ limit }} елемента. + + + Invalid card number. + Ðевалиден номер на картата. + + + Unsupported card type or invalid card number. + Ðеподдържан тип карта или невалиден номер на картата. + + + This is not a valid International Bank Account Number (IBAN). + Ðевалиден Международен номер на банкова Ñметка (IBAN). + + + This value is not a valid ISBN-10. + Ðевалиден ISBN-10. + + + This value is not a valid ISBN-13. + Ðевалиден ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Ðевалидна ÑтойноÑÑ‚ както за ISBN-10, така и за ISBN-13 . + + + This value is not a valid ISSN. + Ðевалиден Международен Ñтандартен Ñериен номер (ISSN). + + + This value is not a valid currency. + Ðевалидна валута. + + + This value should be equal to {{ compared_value }}. + СтойноÑтта Ñ‚Ñ€Ñбва да бъде равна на {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + СтойноÑтта Ñ‚Ñ€Ñбва да бъде по-голÑма от {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + СтойноÑтта Ñ‚Ñ€Ñбва да бъде по-голÑма или равна на {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + СтойноÑтта Ñ‚Ñ€Ñбва да бъде идентична Ñ {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + СтойноÑтта Ñ‚Ñ€Ñбва да бъде по-малка {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + СтойноÑтта Ñ‚Ñ€Ñбва да бъде по-малка или равна на {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + СтойноÑтта не Ñ‚Ñ€Ñбва да бъде равна на {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + СтойноÑтта не Ñ‚Ñ€Ñбва да бъде идентична Ñ {{ compared_value_type }} {{ compared_value }}. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.ca.xlf b/core/vendor/symfony/validator/Resources/translations/validators.ca.xlf new file mode 100644 index 0000000..85b6970 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.ca.xlf @@ -0,0 +1,307 @@ + + + + + + This value should be false. + Aquest valor hauria de ser fals. + + + This value should be true. + Aquest valor hauria de ser cert. + + + This value should be of type {{ type }}. + Aquest valor hauria de ser del tipus {{ type }}. + + + This value should be blank. + Aquest valor hauria d'estar buit. + + + The value you selected is not a valid choice. + El valor seleccionat no és una opció vàlida. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Ha de seleccionar almenys {{ limit }} opció.|Ha de seleccionar almenys {{ limit }} opcions. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Ha de seleccionar com a màxim {{ limit }} opció.|Ha de seleccionar com a màxim {{ limit }} opcions. + + + One or more of the given values is invalid. + Un o més dels valors facilitats són incorrectes. + + + This field was not expected. + Aquest camp no s'esperava. + + + This field is missing. + Aquest camp està desaparegut. + + + This value is not a valid date. + Aquest valor no és una data vàlida. + + + This value is not a valid datetime. + Aquest valor no és una data i hora vàlida. + + + This value is not a valid email address. + Aquest valor no és una adreça d'email vàlida. + + + The file could not be found. + No s'ha pogut trobar l'arxiu. + + + The file is not readable. + No es pot llegir l'arxiu. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + L'arxiu és massa gran ({{ size }} {{ suffix }}). La grandària màxima permesa és {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + El tipus mime de l'arxiu no és vàlid ({{ type }}). Els tipus mime vàlids són {{ types }}. + + + This value should be {{ limit }} or less. + Aquest valor hauria de ser {{ limit }} o menys. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Aquest valor és massa llarg. Hauria de tenir {{ limit }} caràcter o menys.|Aquest valor és massa llarg. Hauria de tenir {{ limit }} caràcters o menys. + + + This value should be {{ limit }} or more. + Aquest valor hauria de ser {{ limit }} o més. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Aquest valor és massa curt. Hauria de tenir {{ limit }} caràcters o més. + + + This value should not be blank. + Aquest valor no hauria d'estar buit. + + + This value should not be null. + Aquest valor no hauria de ser null. + + + This value should be null. + Aquest valor hauria de ser null. + + + This value is not valid. + Aquest valor no és vàlid. + + + This value is not a valid time. + Aquest valor no és una hora vàlida. + + + This value is not a valid URL. + Aquest valor no és una URL vàlida. + + + The two values should be equal. + Els dos valors haurien de ser iguals. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + L'arxiu és massa gran. El tamany màxim permés és {{ limit }} {{ suffix }}. + + + The file is too large. + L'arxiu és massa gran. + + + The file could not be uploaded. + No es pot pujar l'arxiu. + + + This value should be a valid number. + Aquest valor hauria de ser un nombre vàlid. + + + This file is not a valid image. + L'arxiu no és una imatge vàlida. + + + This is not a valid IP address. + Això no és una adreça IP vàlida. + + + This value is not a valid language. + Aquest valor no és un idioma vàlid. + + + This value is not a valid locale. + Aquest valor no és una localització vàlida. + + + This value is not a valid country. + Aquest valor no és un país vàlid. + + + This value is already used. + Aquest valor ja s'ha utilitzat. + + + The size of the image could not be detected. + No s'ha pogut determinar la grandària de la imatge. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + L'amplària de la imatge és massa gran ({{ width }}px). L'amplària màxima permesa són {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + L'amplària de la imatge és massa petita ({{ width }}px). L'amplària mínima requerida són {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + L'altura de la imatge és massa gran ({{ height }}px). L'altura màxima permesa són {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + L'altura de la imatge és massa petita ({{ height }}px). L'altura mínima requerida són {{ min_height }}px. + + + This value should be the user's current password. + Aquest valor hauria de ser la contrasenya actual de l'usuari. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Aquest valor hauria de tenir exactament {{ limit }} caràcter.|Aquest valor hauria de tenir exactament {{ limit }} caràcters. + + + The file was only partially uploaded. + L'arxiu va ser només pujat parcialment. + + + No file was uploaded. + Cap arxiu va ser pujat. + + + No temporary folder was configured in php.ini. + Cap carpeta temporal va ser configurada en php.ini. + + + Cannot write temporary file to disk. + No es va poder escriure l'arxiu temporal en el disc. + + + A PHP extension caused the upload to fail. + Una extensió de PHP va fer que la pujada fallara. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Aquesta col·lecció ha de contenir {{ limit }} element o més.|Aquesta col·lecció ha de contenir {{ limit }} elements o més. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Aquesta col·lecció ha de contenir {{ limit }} element o menys.|Aquesta col·lecció ha de contenir {{ limit }} elements o menys. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Aquesta col·lecció ha de contenir exactament {{ limit }} element.|Aquesta col·lecció ha de contenir exactament {{ limit }} elements. + + + Invalid card number. + Número de targeta invàlid. + + + Unsupported card type or invalid card number. + Tipus de targeta no suportada o número de targeta invàlid. + + + This is not a valid International Bank Account Number (IBAN). + Això no és un nombre de compte bancari internacional (IBAN) vàlid. + + + This value is not a valid ISBN-10. + Aquest valor no és un ISBN-10 vàlid. + + + This value is not a valid ISBN-13. + Aquest valor no és un ISBN-13 vàlid. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Aquest valor no és ni un ISBN-10 vàlid ni un ISBN-13 vàlid. + + + This value is not a valid ISSN. + Aquest valor no és un ISSN vàlid. + + + This value is not a valid currency. + Aquest valor no és una divisa vàlida. + + + This value should be equal to {{ compared_value }}. + Aquest valor hauria de ser igual a {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Aquest valor hauria de ser més gran a {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Aquest valor hauria de ser major o igual a {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Aquest valor hauria de ser idèntic a {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Aquest valor hauria de ser menor a {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Aquest valor hauria de ser menor o igual a {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Aquest valor no hauria de ser igual a {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Aquest valor no hauria de idèntic a {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + La proporció de l'imatge és massa gran ({{ ratio }}). La màxima proporció permesa és {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + La proporció de l'imatge és massa petita ({{ ratio }}). La mínima proporció permesa és {{ max_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + L'imatge és quadrada({{ width }}x{{ height }}px). Les imatges quadrades no estan permeses. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + L'imatge està orientada horitzontalment ({{ width }}x{{ height }}px). Les imatges orientades horitzontalment no estan permeses. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + L'imatge està orientada verticalment ({{ width }}x{{ height }}px). Les imatges orientades verticalment no estan permeses. + + + An empty file is not allowed. + No està permès un fixter buit. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.cs.xlf b/core/vendor/symfony/validator/Resources/translations/validators.cs.xlf new file mode 100644 index 0000000..2ae47b2 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.cs.xlf @@ -0,0 +1,307 @@ + + + + + + This value should be false. + Tato hodnota musí být nepravdivá (false). + + + This value should be true. + Tato hodnota musí být pravdivá (true). + + + This value should be of type {{ type }}. + Tato hodnota musí být typu {{ type }}. + + + This value should be blank. + Tato hodnota musí být prázdná. + + + The value you selected is not a valid choice. + Vybraná hodnota není platnou možností. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Musí být vybrána nejménÄ› {{ limit }} možnost.|Musí být vybrány nejménÄ› {{ limit }} možnosti.|Musí být vybráno nejménÄ› {{ limit }} možností. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Musí být vybrána maximálnÄ› {{ limit }} možnost.|Musí být vybrány maximálnÄ› {{ limit }} možnosti.|Musí být vybráno maximálnÄ› {{ limit }} možností. + + + One or more of the given values is invalid. + NÄ›které z uvedených hodnot jsou neplatné. + + + This field was not expected. + Toto pole nebyla oÄekávána. + + + This field is missing. + Toto pole chybí. + + + This value is not a valid date. + Tato hodnota není platné datum. + + + This value is not a valid datetime. + Tato hodnota není platné datum s Äasovým údajem. + + + This value is not a valid email address. + Tato hodnota není platná e-mailová adresa. + + + The file could not be found. + Soubor nebyl nalezen. + + + The file is not readable. + Soubor je neÄitelný. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Soubor je příliÅ¡ velký ({{ size }} {{ suffix }}). Maximální povolená velikost souboru je {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Neplatný mime typ souboru ({{ type }}). Povolené mime typy souborů jsou {{ types }}. + + + This value should be {{ limit }} or less. + Tato hodnota musí být {{ limit }} nebo ménÄ›. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Tato hodnota je příliÅ¡ dlouhá. Musí obsahovat maximálnÄ› {{ limit }} znak.|Tato hodnota je příliÅ¡ dlouhá. Musí obsahovat maximálnÄ› {{ limit }} znaky.|Tato hodnota je příliÅ¡ dlouhá. Musí obsahovat maximálnÄ› {{ limit }} znaků. + + + This value should be {{ limit }} or more. + Tato hodnota musí být {{ limit }} nebo více. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Tato hodnota je příliÅ¡ krátká. Musí obsahovat minimálnÄ› {{ limit }} znak.|Tato hodnota je příliÅ¡ krátká. Musí obsahovat minimálnÄ› {{ limit }} znaky.|Tato hodnota je příliÅ¡ krátká. Musí obsahovat minimálnÄ› {{ limit }} znaků. + + + This value should not be blank. + Tato hodnota nesmí být prázdná. + + + This value should not be null. + Tato hodnota nesmí být null. + + + This value should be null. + Tato hodnota musí být null. + + + This value is not valid. + Tato hodnota není platná. + + + This value is not a valid time. + Tato hodnota není platný Äasový údaj. + + + This value is not a valid URL. + Tato hodnota není platná URL adresa. + + + The two values should be equal. + Tyto dvÄ› hodnoty musí být stejné. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Soubor je příliÅ¡ velký. Maximální povolená velikost souboru je {{ limit }} {{ suffix }}. + + + The file is too large. + Soubor je příliÅ¡ velký. + + + The file could not be uploaded. + Soubor se nepodaÅ™ilo nahrát. + + + This value should be a valid number. + Tato hodnota musí být Äíslo. + + + This file is not a valid image. + Tento soubor není obrázek. + + + This is not a valid IP address. + Toto není platná IP adresa. + + + This value is not a valid language. + Tento jazyk neexistuje. + + + This value is not a valid locale. + Tato lokalizace neexistuje. + + + This value is not a valid country. + Tato zemÄ› neexistuje. + + + This value is already used. + Tato hodnota je již používána. + + + The size of the image could not be detected. + NepodaÅ™ily se zjistit rozmÄ›ry obrázku. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Obrázek je příliÅ¡ Å¡iroký ({{ width }}px). Maximální povolená šířka obrázku je {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Obrázek je příliÅ¡ úzký ({{ width }}px). Minimální šířka musí být {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Obrázek je příliÅ¡ vysoký ({{ height }}px). Maximální povolená výška obrázku je {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Obrázek je příliÅ¡ nízký ({{ height }}px). Minimální výška obrázku musí být {{ min_height }}px. + + + This value should be the user's current password. + Tato hodnota musí být aktuální heslo uživatele. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Tato hodnota musí mít pÅ™esnÄ› {{ limit }} znak.|Tato hodnota musí mít pÅ™esnÄ› {{ limit }} znaky.|Tato hodnota musí mít pÅ™esnÄ› {{ limit }} znaků. + + + The file was only partially uploaded. + Byla nahrána jen Äást souboru. + + + No file was uploaded. + Žádný soubor nebyl nahrán. + + + No temporary folder was configured in php.ini. + V php.ini není nastavena cesta k adresáři pro doÄasné soubory. + + + Cannot write temporary file to disk. + DoÄasný soubor se nepodaÅ™ilo zapsat na disk. + + + A PHP extension caused the upload to fail. + Rozšíření PHP zabránilo nahrání souboru. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Tato kolekce musí obsahovat minimálnÄ› {{ limit }} prvek.|Tato kolekce musí obsahovat minimálnÄ› {{ limit }} prvky.|Tato kolekce musí obsahovat minimálnÄ› {{ limit }} prvků. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Tato kolekce musí obsahovat maximálnÄ› {{ limit }} prvek.|Tato kolekce musí obsahovat maximálnÄ› {{ limit }} prvky.|Tato kolekce musí obsahovat maximálnÄ› {{ limit }} prvků. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Tato kolekce musí obsahovat pÅ™esnÄ› {{ limit }} prvek.|Tato kolekce musí obsahovat pÅ™esnÄ› {{ limit }} prvky.|Tato kolekce musí obsahovat pÅ™esnÄ› {{ limit }} prvků. + + + Invalid card number. + Neplatné Äíslo karty. + + + Unsupported card type or invalid card number. + Nepodporovaný typ karty nebo neplatné Äíslo karty. + + + This is not a valid International Bank Account Number (IBAN). + Toto je neplatný IBAN. + + + This value is not a valid ISBN-10. + Tato hodnota není platné ISBN-10. + + + This value is not a valid ISBN-13. + Tato hodnota není platné ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Tato hodnota není platné ISBN-10 ani ISBN-13. + + + This value is not a valid ISSN. + Tato hodnota není platné ISSN. + + + This value is not a valid currency. + Tato mÄ›na neexistuje. + + + This value should be equal to {{ compared_value }}. + Tato hodnota musí být rovna {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Tato hodnota musí být vÄ›tší než {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Tato hodnota musí být vÄ›tší nebo rovna {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Tato hodnota musí být typu {{ compared_value_type }} a zároveň musí být rovna {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Tato hodnota musí být menší než {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Tato hodnota musí být menší nebo rovna {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Tato hodnota nesmí být rovna {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Tato hodnota nesmí být typu {{ compared_value_type }} a zároveň nesmí být rovna {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + PomÄ›r stran obrázku je příliÅ¡ velký ({{ ratio }}). Maximální povolený pomÄ›r stran obrázku je {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + PomÄ›r stran obrázku je příliÅ¡ malý ({{ ratio }}). Minimální povolený pomÄ›r stran obrázku je {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Strany obrázku jsou Ätvercové ({{ width }}x{{ height }}px). ÄŒtvercové obrázky nejsou povolené. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Obrázek je orientovaný na šířku ({{ width }}x{{ height }}px). Obrázky orientované na šířku nejsou povolené. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Obrázek je orientovaný na výšku ({{ width }}x{{ height }}px). Obrázky orientované na výšku nejsou povolené. + + + An empty file is not allowed. + Soubor nesmí být prázdný. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.cy.xlf b/core/vendor/symfony/validator/Resources/translations/validators.cy.xlf new file mode 100644 index 0000000..da7cb9a --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.cy.xlf @@ -0,0 +1,227 @@ + + + + + + This value should be false. + Dylid bod y gwerth hwn yn ffug. + + + This value should be true. + Dylid bod y gwerth hwn yn wir. + + + This value should be of type {{ type }}. + Dylid bod y gwerth hwn bod o fath {{ type }}. + + + This value should be blank. + Dylid bod y gwerth hwn yn wag. + + + The value you selected is not a valid choice. + Nid yw'r gwerth â ddewiswyd yn ddilys. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Rhaid dewis o leiaf {{ limit }} opsiwn. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Rhaid dewis dim mwy na {{ limit }} opsiwn. + + + One or more of the given values is invalid. + Mae un neu fwy o'r gwerthoedd a roddwyd yn annilys. + + + This field was not expected. + Nid oedd disgwyl y maes hwn. + + + This field is missing. + Mae'r maes hwn ar goll. + + + This value is not a valid date. + Nid yw'r gwerth yn ddyddiad dilys. + + + This value is not a valid datetime. + Nid yw'r gwerth yn datetime dilys. + + + This value is not a valid email address. + Nid yw'r gwerth yn gyfeiriad ebost dilys. + + + The file could not be found. + Ni ddarganfyddwyd y ffeil. + + + The file is not readable. + Ni ellir darllen y ffeil. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Mae'r ffeil yn rhy fawr ({{ size }} {{ suffix }}). Yr uchafswm â ganiateir yw {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Nid yw math mime y ffeil yn ddilys ({{ type }}). Dyma'r mathau â ganiateir {{ types }}. + + + This value should be {{ limit }} or less. + Dylai'r gwerth hwn fod yn {{ limit }} neu lai. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Mae'r gwerth hwn rhy hir. Dylai gynnwys {{ limit }} nodyn cyfrifiadurol neu lai. + + + This value should be {{ limit }} or more. + Dylai'r gwerth hwn fod yn {{ limit }} neu fwy. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Mae'r gwerth hwn yn rhy fyr. Dylai gynnwys {{ limit }} nodyn cyfrifiadurol neu fwy. + + + This value should not be blank. + Ni ddylai'r gwerth hwn fod yn wag. + + + This value should not be null. + Ni ddylai'r gwerth hwn fod yn null. + + + This value should be null. + Dylai'r gwerth fod yn null. + + + This value is not valid. + Nid yw'r gwerth hwn yn ddilys. + + + This value is not a valid time. + Nid yw'r gwerth hwn yn amser dilys. + + + This value is not a valid URL. + Nid yw'r gwerth hwn yn URL dilys. + + + The two values should be equal. + Rhaid i'r ddau werth fod yn gyfystyr a'u gilydd. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Mae'r ffeil yn rhy fawr. Yr uchafswm â ganiateir yw {{ limit }} {{ suffix }}. + + + The file is too large. + Mae'r ffeil yn rhy fawr. + + + The file could not be uploaded. + Methwyd ag uwchlwytho'r ffeil. + + + This value should be a valid number. + Dylai'r gwerth hwn fod yn rif dilys. + + + This file is not a valid image. + Nid yw'r ffeil hon yn ddelwedd dilys. + + + This is not a valid IP address. + Nid yw hwn yn gyfeiriad IP dilys. + + + This value is not a valid language. + Nid yw'r gwerth hwn yn iaith ddilys. + + + This value is not a valid locale. + Nid yw'r gwerth hwn yn locale dilys. + + + This value is not a valid country. + Nid yw'r gwerth hwn yn wlad dilys. + + + This value is already used. + Mae'r gwerth hwn eisoes yn cael ei ddefnyddio. + + + The size of the image could not be detected. + Methwyd â darganfod maint y ddelwedd. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Mae lled y ddelwedd yn rhy fawr ({{ width }}px). Y lled mwyaf â ganiateir yw {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Mae lled y ddelwedd yn rhy fach ({{ width }}px). Y lled lleiaf â ganiateir yw {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Mae uchder y ddelwedd yn rhy fawr ({{ width }}px). Yr uchder mwyaf â ganiateir yw {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Mae uchder y ddelwedd yn rhy fach ({{ width }}px). Yr uchder lleiaf â ganiateir yw {{ min_height }}px. + + + This value should be the user's current password. + Dylaid bod y gwerth hwn yn gyfrinair presenol y defnyddiwr. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Dylai'r gwerth hwn fod yn union {{ limit }} nodyn cyfrifiadurol o hyd. + + + The file was only partially uploaded. + Dim ond rhan o'r ffeil ag uwchlwythwyd. + + + No file was uploaded. + Ni uwchlwythwyd unrhyw ffeil. + + + No temporary folder was configured in php.ini. + Nid oes ffolder dros-dro wedi'i gosod yn php.ini. + + + Cannot write temporary file to disk. + Methwyd ag ysgrifennu'r ffeil dros-dro ar ddisg. + + + A PHP extension caused the upload to fail. + Methwyd ag uwchlwytho oherwydd ategyn PHP. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Dylai'r casgliad hwn gynnwys {{ limit }} elfen neu fwy. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Dylai'r casgliad hwn gynnwys {{ limit }} elfen neu lai. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Dylai'r casgliad hwn gynnwys union {{ limit }} elfen. + + + Invalid card number. + Nid oedd rhif y cerdyn yn ddilys. + + + Unsupported card type or invalid card number. + Unai ni dderbynir y math yna o gerdyn, neu nid yw rhif y cerdyn yn ddilys. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.da.xlf b/core/vendor/symfony/validator/Resources/translations/validators.da.xlf new file mode 100644 index 0000000..14e479a --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.da.xlf @@ -0,0 +1,247 @@ + + + + + + This value should be false. + Værdien skal være falsk. + + + This value should be true. + Værdien skal være sand. + + + This value should be of type {{ type }}. + Værdien skal være af typen {{ type }}. + + + This value should be blank. + Værdien skal være blank. + + + The value you selected is not a valid choice. + Værdien skal være en af de givne muligheder. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Du skal vælge mindst {{ limit }} muligheder. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Du kan højest vælge {{ limit }} muligheder. + + + One or more of the given values is invalid. + En eller flere af de oplyste værdier er ugyldige. + + + This field was not expected. + Feltet blev ikke forventet. + + + This field is missing. + Dette felt er mangler. + + + This value is not a valid date. + Værdien er ikke en gyldig dato. + + + This value is not a valid datetime. + Værdien er ikke en gyldig dato og tid. + + + This value is not a valid email address. + Værdien er ikke en gyldig e-mail adresse. + + + The file could not be found. + Filen kunne ikke findes. + + + The file is not readable. + Filen kan ikke læses. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Filen er for stor ({{ size }} {{ suffix }}). Tilladte maksimale størrelse {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Mimetypen af filen er ugyldig ({{ type }}). Tilladte mimetyper er {{ types }}. + + + This value should be {{ limit }} or less. + Værdien skal være {{ limit }} eller mindre. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Værdien er for lang. Den skal have {{ limit }} bogstaver eller mindre. + + + This value should be {{ limit }} or more. + Værdien skal være {{ limit }} eller mere. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Værdien er for kort. Den skal have {{ limit }} tegn eller flere. + + + This value should not be blank. + Værdien mÃ¥ ikke være blank. + + + This value should not be null. + Værdien mÃ¥ ikke være tom (null). + + + This value should be null. + Værdien skal være tom (null). + + + This value is not valid. + Værdien er ikke gyldig. + + + This value is not a valid time. + Værdien er ikke en gyldig tid. + + + This value is not a valid URL. + Værdien er ikke en gyldig URL. + + + The two values should be equal. + De to værdier skal være ens. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Filen er for stor. Den maksimale størrelse er {{ limit }} {{ suffix }}. + + + The file is too large. + Filen er for stor. + + + The file could not be uploaded. + Filen kunne ikke blive uploadet. + + + This value should be a valid number. + Værdien skal være et gyldigt tal. + + + This file is not a valid image. + Filen er ikke gyldigt billede. + + + This is not a valid IP address. + Dette er ikke en gyldig IP adresse. + + + This value is not a valid language. + Værdien er ikke et gyldigt sprog. + + + This value is not a valid locale. + Værdien er ikke en gyldig lokalitet. + + + This value is not a valid country. + Værdien er ikke et gyldigt land. + + + This value is already used. + Værdien er allerede i brug. + + + The size of the image could not be detected. + Størrelsen pÃ¥ billedet kunne ikke detekteres. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Billedbredden er for stor ({{ width }}px). Tilladt maksimumsbredde er {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Billedebredden er for lille ({{ width }}px). Forventet minimumshøjde er {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Billedhøjden er for stor ({{ height }}px). Tilladt maksimumshøjde er {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Billedhøjden er for lille ({{ height }}px). Forventet minimumshøjde er {{ min_height }}px. + + + This value should be the user's current password. + Værdien skal være brugerens nuværende password. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Værdien skal have præcis {{ limit }} tegn. + + + The file was only partially uploaded. + Filen var kun delvis uploadet. + + + No file was uploaded. + Ingen fil blev uploadet. + + + No temporary folder was configured in php.ini. + Ingen midlertidig mappe er konfigureret i php.ini. + + + Cannot write temporary file to disk. + Kan ikke skrive midlertidig fil til disk. + + + A PHP extension caused the upload to fail. + En PHP udvidelse forÃ¥rsagede fejl i upload. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Denne samling skal indeholde {{ limit }} element eller flere.|Denne samling skal indeholde {{ limit }} elementer eller flere. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Denne samling skal indeholde {{ limit }} element eller mindre.|Denne samling skal indeholde {{ limit }} elementer eller mindre. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Denne samling skal indeholde præcis {{ limit }} element.|Denne samling skal indeholde præcis {{ limit }} elementer. + + + Invalid card number. + Ugyldigt kortnummer. + + + Unsupported card type or invalid card number. + Ikke-understøttet korttype eller ugyldigt kortnummer. + + + This is not a valid International Bank Account Number (IBAN). + Det er ikke en gyldig International Bank Account Number (IBAN). + + + This value is not a valid ISBN-10. + Værdien er ikke en gyldig ISBN-10. + + + This value is not a valid ISBN-13. + Værdien er ikke en gyldig ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Værdien er hverken en gyldig ISBN-10 eller en gyldig ISBN-13. + + + This value is not a valid ISSN. + Værdien er ikke en gyldig ISSN. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.de.xlf b/core/vendor/symfony/validator/Resources/translations/validators.de.xlf new file mode 100644 index 0000000..c79cb94 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.de.xlf @@ -0,0 +1,315 @@ + + + + + + This value should be false. + Dieser Wert sollte false sein. + + + This value should be true. + Dieser Wert sollte true sein. + + + This value should be of type {{ type }}. + Dieser Wert sollte vom Typ {{ type }} sein. + + + This value should be blank. + Dieser Wert sollte leer sein. + + + The value you selected is not a valid choice. + Sie haben einen ungültigen Wert ausgewählt. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Sie müssen mindestens {{ limit }} Möglichkeit wählen.|Sie müssen mindestens {{ limit }} Möglichkeiten wählen. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Sie dürfen höchstens {{ limit }} Möglichkeit wählen.|Sie dürfen höchstens {{ limit }} Möglichkeiten wählen. + + + One or more of the given values is invalid. + Einer oder mehrere der angegebenen Werte sind ungültig. + + + This field was not expected. + Dieses Feld wurde nicht erwartet. + + + This field is missing. + Dieses Feld fehlt. + + + This value is not a valid date. + Dieser Wert entspricht keiner gültigen Datumsangabe. + + + This value is not a valid datetime. + Dieser Wert entspricht keiner gültigen Datums- und Zeitangabe. + + + This value is not a valid email address. + Dieser Wert ist keine gültige E-Mail-Adresse. + + + The file could not be found. + Die Datei wurde nicht gefunden. + + + The file is not readable. + Die Datei ist nicht lesbar. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Die Datei ist zu groß ({{ size }} {{ suffix }}). Die maximal zulässige Größe beträgt {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Der Dateityp ist ungültig ({{ type }}). Erlaubte Dateitypen sind {{ types }}. + + + This value should be {{ limit }} or less. + Dieser Wert sollte kleiner oder gleich {{ limit }} sein. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Diese Zeichenkette ist zu lang. Sie sollte höchstens {{ limit }} Zeichen haben.|Diese Zeichenkette ist zu lang. Sie sollte höchstens {{ limit }} Zeichen haben. + + + This value should be {{ limit }} or more. + Dieser Wert sollte größer oder gleich {{ limit }} sein. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Diese Zeichenkette ist zu kurz. Sie sollte mindestens {{ limit }} Zeichen haben.|Diese Zeichenkette ist zu kurz. Sie sollte mindestens {{ limit }} Zeichen haben. + + + This value should not be blank. + Dieser Wert sollte nicht leer sein. + + + This value should not be null. + Dieser Wert sollte nicht null sein. + + + This value should be null. + Dieser Wert sollte null sein. + + + This value is not valid. + Dieser Wert ist nicht gültig. + + + This value is not a valid time. + Dieser Wert entspricht keiner gültigen Zeitangabe. + + + This value is not a valid URL. + Dieser Wert ist keine gültige URL. + + + The two values should be equal. + Die beiden Werte sollten identisch sein. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Die Datei ist zu groß. Die maximal zulässige Größe beträgt {{ limit }} {{ suffix }}. + + + The file is too large. + Die Datei ist zu groß. + + + The file could not be uploaded. + Die Datei konnte nicht hochgeladen werden. + + + This value should be a valid number. + Dieser Wert sollte eine gültige Zahl sein. + + + This file is not a valid image. + Diese Datei ist kein gültiges Bild. + + + This is not a valid IP address. + Dies ist keine gültige IP-Adresse. + + + This value is not a valid language. + Dieser Wert entspricht keiner gültigen Sprache. + + + This value is not a valid locale. + Dieser Wert entspricht keinem gültigen Gebietsschema. + + + This value is not a valid country. + Dieser Wert entspricht keinem gültigen Land. + + + This value is already used. + Dieser Wert wird bereits verwendet. + + + The size of the image could not be detected. + Die Größe des Bildes konnte nicht ermittelt werden. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Die Bildbreite ist zu groß ({{ width }}px). Die maximal zulässige Breite beträgt {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Die Bildbreite ist zu gering ({{ width }}px). Die erwartete Mindestbreite beträgt {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Die Bildhöhe ist zu groß ({{ height }}px). Die maximal zulässige Höhe beträgt {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Die Bildhöhe ist zu gering ({{ height }}px). Die erwartete Mindesthöhe beträgt {{ min_height }}px. + + + This value should be the user's current password. + Dieser Wert sollte dem aktuellen Benutzerpasswort entsprechen. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Dieser Wert sollte genau {{ limit }} Zeichen lang sein.|Dieser Wert sollte genau {{ limit }} Zeichen lang sein. + + + The file was only partially uploaded. + Die Datei wurde nur teilweise hochgeladen. + + + No file was uploaded. + Es wurde keine Datei hochgeladen. + + + No temporary folder was configured in php.ini. + Es wurde kein temporärer Ordner in der php.ini konfiguriert. + + + Cannot write temporary file to disk. + Kann die temporäre Datei nicht speichern. + + + A PHP extension caused the upload to fail. + Eine PHP-Erweiterung verhinderte den Upload. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Diese Sammlung sollte {{ limit }} oder mehr Elemente beinhalten.|Diese Sammlung sollte {{ limit }} oder mehr Elemente beinhalten. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Diese Sammlung sollte {{ limit }} oder weniger Elemente beinhalten.|Diese Sammlung sollte {{ limit }} oder weniger Elemente beinhalten. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Diese Sammlung sollte genau {{ limit }} Element beinhalten.|Diese Sammlung sollte genau {{ limit }} Elemente beinhalten. + + + Invalid card number. + Ungültige Kartennummer. + + + Unsupported card type or invalid card number. + Nicht unterstützer Kartentyp oder ungültige Kartennummer. + + + This is not a valid International Bank Account Number (IBAN). + Dieser Wert ist keine gültige IBAN-Kontonummer. + + + This value is not a valid ISBN-10. + Dieser Wert entspricht keiner gültigen ISBN-10. + + + This value is not a valid ISBN-13. + Dieser Wert entspricht keiner gültigen ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Dieser Wert ist weder eine gültige ISBN-10 noch eine gültige ISBN-13. + + + This value is not a valid ISSN. + Dieser Wert ist keine gültige ISSN. + + + This value is not a valid currency. + Dieser Wert ist keine gültige Währung. + + + This value should be equal to {{ compared_value }}. + Dieser Wert sollte gleich {{ compared_value }} sein. + + + This value should be greater than {{ compared_value }}. + Dieser Wert sollte größer als {{ compared_value }} sein. + + + This value should be greater than or equal to {{ compared_value }}. + Dieser Wert sollte größer oder gleich {{ compared_value }} sein. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Dieser Wert sollte identisch sein mit {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Dieser Wert sollte kleiner als {{ compared_value }} sein. + + + This value should be less than or equal to {{ compared_value }}. + Dieser Wert sollte kleiner oder gleich {{ compared_value }} sein. + + + This value should not be equal to {{ compared_value }}. + Dieser Wert sollte nicht {{ compared_value }} sein. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Dieser Wert sollte nicht identisch sein mit {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Das Seitenverhältnis des Bildes ist zu groß ({{ ratio }}). Der erlaubte Maximalwert ist {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Das Seitenverhältnis des Bildes ist zu klein ({{ ratio }}). Der erwartete Minimalwert ist {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Das Bild ist quadratisch ({{ width }}x{{ height }}px). Quadratische Bilder sind nicht erlaubt. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Das Bild ist im Querformat ({{ width }}x{{ height }}px). Bilder im Querformat sind nicht erlaubt. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Das Bild ist im Hochformat ({{ width }}x{{ height }}px). Bilder im Hochformat sind nicht erlaubt. + + + An empty file is not allowed. + Eine leere Datei ist nicht erlaubt. + + + The host could not be resolved. + Der Hostname konnte nicht aufgelöst werden. + + + This value does not match the expected {{ charset }} charset. + Dieser Wert entspricht nicht dem erwarteten Zeichensatz {{ charset }}. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.el.xlf b/core/vendor/symfony/validator/Resources/translations/validators.el.xlf new file mode 100644 index 0000000..4fa0d42 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.el.xlf @@ -0,0 +1,283 @@ + + + + + + This value should be false. + Αυτή η τιμή Ï€Ïέπει να είναι ψευδής. + + + This value should be true. + Αυτή η τιμή Ï€Ïέπει να είναι αληθής. + + + This value should be of type {{ type }}. + Αυτή η τιμή Ï€Ïέπει να είναι Ï„Ïπου {{ type }}. + + + This value should be blank. + Αυτή η τιμή Ï€Ïέπει να είναι κενή. + + + The value you selected is not a valid choice. + Η τιμή που επιλέχθηκε δεν αντιστοιχεί σε έγκυÏη επιλογή. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + ΠÏέπει να επιλέξετε τουλάχιστον {{ limit }} επιλογή.|ΠÏέπει να επιλέξετε τουλάχιστον {{ limit }} επιλογές. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + ΠÏέπει να επιλέξετε το Ï€Î¿Î»Ï {{ limit }} επιλογή.|ΠÏέπει να επιλέξετε το Ï€Î¿Î»Ï {{ limit }} επιλογές. + + + One or more of the given values is invalid. + Μια ή πεÏισσότεÏες τιμές δεν είναι έγκυÏες. + + + This field was not expected. + Αυτό το πεδίο δεν ήταν αναμενόμενο. + + + This field is missing. + Λείπει αυτό το πεδίο. + + + This value is not a valid date. + Η τιμή δεν αντιστοιχεί σε έγκυÏη ημεÏομηνία. + + + This value is not a valid datetime. + Η τιμή δεν αντιστοιχεί σε έγκυÏη ημεÏομηνία και ÏŽÏα. + + + This value is not a valid email address. + Η τιμή δεν αντιστοιχεί σε έγκυÏο email. + + + The file could not be found. + Το αÏχείο δε μποÏεί να βÏεθεί. + + + The file is not readable. + Το αÏχείο δεν είναι αναγνώσιμο. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Το αÏχείο είναι Ï€Î¿Î»Ï Î¼ÎµÎ³Î¬Î»Î¿ ({{ size }} {{ suffix }}). Το μέγιστο επιτÏεπτό μέγεθος είναι {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Ο Ï„Ïπος mime του αÏχείου δεν είναι έγκυÏος ({{ type }}). Οι έγκÏυοι Ï„Ïποι mime είναι {{ types }}. + + + This value should be {{ limit }} or less. + Αυτή η τιμή θα έπÏεπε να είναι {{ limit }} ή λιγότεÏο. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Αυτή η τιμή είναι Ï€Î¿Î»Ï Î¼ÎµÎ³Î¬Î»Î·. Θα έπÏεπε να έχει {{ limit }} χαÏακτήÏα ή λιγότεÏο.|Αυτή η τιμή είναι Ï€Î¿Î»Ï Î¼ÎµÎ³Î¬Î»Î·. Θα έπÏεπε να έχει {{ limit }} χαÏακτήÏες ή λιγότεÏο. + + + This value should be {{ limit }} or more. + Αυτή η τιμή θα έπÏεπε να είναι {{ limit }} ή πεÏισσότεÏο. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Αυτή η τιμή είναι Ï€Î¿Î»Ï Î¼Î¹ÎºÏή. Θα έπÏεπε να έχει {{ limit }} χαÏακτήÏα ή πεÏισσότεÏο.|Αυτή η τιμή είναι Ï€Î¿Î»Ï Î¼Î¹ÎºÏή. Θα έπÏεπε να έχει {{ limit }} χαÏακτήÏες ή πεÏισσότεÏο. + + + This value should not be blank. + Αυτή η τιμή δεν Ï€Ïέπει να είναι κενή. + + + This value should not be null. + Αυτή η τιμή δεν Ï€Ïέπει να είναι μηδενική. + + + This value should be null. + Αυτή η τιμή Ï€Ïέπει να είναι μηδενική. + + + This value is not valid. + Αυτή η τιμή δεν είναι έκγυÏη. + + + This value is not a valid time. + Αυτή η τιμή δεν αντιστοιχεί σε έγκυÏη ÏŽÏα. + + + This value is not a valid URL. + Αυτή η τιμή δεν αντιστοιχεί σε έγκυÏο URL. + + + The two values should be equal. + Οι δÏο τιμές θα Ï€Ïέπει να είναι ίδιες. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Το αÏχείο είναι Ï€Î¿Î»Ï Î¼ÎµÎ³Î¬Î»Î¿. Το μέγιστο επιτÏεπτό μέγεθος είναι {{ limit }} {{ suffix }}. + + + The file is too large. + Το αÏχείο είναι Ï€Î¿Î»Ï Î¼ÎµÎ³Î¬Î»Î¿. + + + The file could not be uploaded. + Το αÏχείο δε μποÏεί να ανέβει. + + + This value should be a valid number. + Αυτή η τιμή θα Ï€Ïέπει να είναι ένας έγκυÏος αÏιθμός. + + + This file is not a valid image. + Το αÏχείο δεν αποτελεί έγκυÏη εικόνα. + + + This is not a valid IP address. + Αυτό δεν είναι μια έκγυÏη διεÏθυνση IP. + + + This value is not a valid language. + Αυτή η τιμή δεν αντιστοιχεί σε μια έκγυÏη γλώσσα. + + + This value is not a valid locale. + Αυτή η τιμή δεν αντιστοιχεί σε έκγυÏο κωδικό τοποθεσίας. + + + This value is not a valid country. + Αυτή η τιμή δεν αντιστοιχεί σε μια έκγυÏη χώÏα. + + + This value is already used. + Αυτή η τιμή χÏησιμοποιείται ήδη. + + + The size of the image could not be detected. + Το μέγεθος της εικόνας δεν ήταν δυνατό να ανιχνευθεί. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Το πλάτος της εικόνας είναι Ï€Î¿Î»Ï Î¼ÎµÎ³Î¬Î»Î¿ ({{ width }}px). Το μέγιστο επιτÏεπτό πλάτος είναι {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Το πλάτος της εικόνας είναι Ï€Î¿Î»Ï Î¼Î¹ÎºÏÏŒ ({{ width }}px). Το ελάχιστο επιτÏεπτό πλάτος είναι {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Το Ïψος της εικόνας είναι Ï€Î¿Î»Ï Î¼ÎµÎ³Î¬Î»Î¿ ({{ height }}px). Το μέγιστο επιτÏεπτό Ïψος είναι {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Το Ïψος της εικόνας είναι Ï€Î¿Î»Ï Î¼Î¹ÎºÏÏŒ ({{ height }}px). Το ελάχιστο επιτÏεπτό Ïψος είναι {{ min_height }}px. + + + This value should be the user's current password. + Αυτή η τιμή θα έπÏεπε να είναι ο Ï„Ïέχων κωδικός. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Αυτή η τιμή θα έπÏεπε να έχει ακÏιβώς {{ limit }} χαÏακτήÏα.|Αυτή η τιμή θα έπÏεπε να έχει ακÏιβώς {{ limit }} χαÏακτήÏες. + + + The file was only partially uploaded. + Το αÏχείο δεν ανέβηκε ολόκληÏο. + + + No file was uploaded. + Δεν ανέβηκε κανένα αÏχείο. + + + No temporary folder was configured in php.ini. + Κανένας Ï€ÏοσωÏινός φάκελος δεν έχει Ïυθμιστεί στο php.ini. + + + Cannot write temporary file to disk. + Αδυναμία εγγÏαφής Ï€ÏοσωÏÎ¹Î½Î¿Ï Î±Ïχείου στο δίσκο. + + + A PHP extension caused the upload to fail. + Μια επέκταση PHP Ï€Ïοκάλεσε αδυναμία ανεβάσματος. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Αυτή η συλλογή θα Ï€Ïέπει να πεÏιέχει {{ limit }} στοιχείο ή πεÏισσότεÏα.|Αυτή η συλλογή θα Ï€Ïέπει να πεÏιέχει {{ limit }} στοιχεία ή πεÏισσότεÏα. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Αυτή η συλλογή θα Ï€Ïέπει να πεÏιέχει {{ limit }} στοιχείo ή λιγότεÏα.|Αυτή η συλλογή θα Ï€Ïέπει να πεÏιέχει {{ limit }} στοιχεία ή λιγότεÏα. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Αυτή η συλλογή θα Ï€Ïέπει να πεÏιέχει ακÏιβώς {{ limit }} στοιχείo.|Αυτή η συλλογή θα Ï€Ïέπει να πεÏιέχει ακÏιβώς {{ limit }} στοιχεία. + + + Invalid card number. + Μη έγκυÏος αÏιθμός κάÏτας. + + + Unsupported card type or invalid card number. + Μη υποστηÏιζόμενος Ï„Ïπος κάÏτας ή μη έγκυÏος αÏιθμός κάÏτας. + + + This is not a valid International Bank Account Number (IBAN). + Αυτό δεν αντιστοιχεί σε έκγυÏο διεθνή αÏιθμό Ï„ÏÎ±Ï€ÎµÎ¶Î¹ÎºÎ¿Ï Î»Î¿Î³Î±ÏÎ¹Î±ÏƒÎ¼Î¿Ï (IBAN). + + + This value is not a valid ISBN-10. + Αυτό δεν είναι έγκυÏος κωδικός ISBN-10. + + + This value is not a valid ISBN-13. + Αυτό δεν είναι έγκυÏος κωδικός ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Αυτό δεν είναι οÏτε έγκυÏος κωδικός ISBN-10 οÏτε έγκυÏος κωδικός ISBN-13. + + + This value is not a valid ISSN. + Αυτό δεν είναι έγκυÏος κωδικός ISSN. + + + This value is not a valid currency. + Αυτό δεν αντιστοιχεί σε έγκυÏο νόμισμα. + + + This value should be equal to {{ compared_value }}. + Αυτή η τιμή θα Ï€Ïέπει να είναι ίση με {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Αυτή η τιμή θα Ï€Ïέπει να είναι μεγαλÏτεÏη από {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Αυτή η τιμή θα Ï€Ïέπει να είναι μεγαλÏτεÏη ή ίση με {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Αυτή η τιμή θα Ï€Ïέπει να είναι πανομοιότυπη με {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Αυτή η τιμή θα Ï€Ïέπει να είναι μικÏότεÏη από {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Αυτή η τιμή θα Ï€Ïέπει να είναι μικÏότεÏη ή ίση με {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Αυτή η τιμή δεν θα Ï€Ïέπει να είναι ίση με {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Αυτή η τιμή δεν Ï€Ïέπει να είναι πανομοιότυπη με {{ compared_value_type }} {{ compared_value }}. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.en.xlf b/core/vendor/symfony/validator/Resources/translations/validators.en.xlf new file mode 100644 index 0000000..e666c79 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.en.xlf @@ -0,0 +1,315 @@ + + + + + + This value should be false. + This value should be false. + + + This value should be true. + This value should be true. + + + This value should be of type {{ type }}. + This value should be of type {{ type }}. + + + This value should be blank. + This value should be blank. + + + The value you selected is not a valid choice. + The value you selected is not a valid choice. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + + + One or more of the given values is invalid. + One or more of the given values is invalid. + + + This field was not expected. + This field was not expected. + + + This field is missing. + This field is missing. + + + This value is not a valid date. + This value is not a valid date. + + + This value is not a valid datetime. + This value is not a valid datetime. + + + This value is not a valid email address. + This value is not a valid email address. + + + The file could not be found. + The file could not be found. + + + The file is not readable. + The file is not readable. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + + + This value should be {{ limit }} or less. + This value should be {{ limit }} or less. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + + + This value should be {{ limit }} or more. + This value should be {{ limit }} or more. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + + + This value should not be blank. + This value should not be blank. + + + This value should not be null. + This value should not be null. + + + This value should be null. + This value should be null. + + + This value is not valid. + This value is not valid. + + + This value is not a valid time. + This value is not a valid time. + + + This value is not a valid URL. + This value is not a valid URL. + + + The two values should be equal. + The two values should be equal. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + + + The file is too large. + The file is too large. + + + The file could not be uploaded. + The file could not be uploaded. + + + This value should be a valid number. + This value should be a valid number. + + + This file is not a valid image. + This file is not a valid image. + + + This is not a valid IP address. + This is not a valid IP address. + + + This value is not a valid language. + This value is not a valid language. + + + This value is not a valid locale. + This value is not a valid locale. + + + This value is not a valid country. + This value is not a valid country. + + + This value is already used. + This value is already used. + + + The size of the image could not be detected. + The size of the image could not be detected. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + + + This value should be the user's current password. + This value should be the user's current password. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + + + The file was only partially uploaded. + The file was only partially uploaded. + + + No file was uploaded. + No file was uploaded. + + + No temporary folder was configured in php.ini. + No temporary folder was configured in php.ini. + + + Cannot write temporary file to disk. + Cannot write temporary file to disk. + + + A PHP extension caused the upload to fail. + A PHP extension caused the upload to fail. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + + + Invalid card number. + Invalid card number. + + + Unsupported card type or invalid card number. + Unsupported card type or invalid card number. + + + This is not a valid International Bank Account Number (IBAN). + This is not a valid International Bank Account Number (IBAN). + + + This value is not a valid ISBN-10. + This value is not a valid ISBN-10. + + + This value is not a valid ISBN-13. + This value is not a valid ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + This value is neither a valid ISBN-10 nor a valid ISBN-13. + + + This value is not a valid ISSN. + This value is not a valid ISSN. + + + This value is not a valid currency. + This value is not a valid currency. + + + This value should be equal to {{ compared_value }}. + This value should be equal to {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + This value should be greater than {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + This value should be greater than or equal to {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + This value should be less than {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + This value should be less than or equal to {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + This value should not be equal to {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + + + An empty file is not allowed. + An empty file is not allowed. + + + The host could not be resolved. + The host could not be resolved. + + + This value does not match the expected {{ charset }} charset. + This value does not match the expected {{ charset }} charset. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.es.xlf b/core/vendor/symfony/validator/Resources/translations/validators.es.xlf new file mode 100644 index 0000000..d874573 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.es.xlf @@ -0,0 +1,315 @@ + + + + + + This value should be false. + Este valor debería ser falso. + + + This value should be true. + Este valor debería ser verdadero. + + + This value should be of type {{ type }}. + Este valor debería ser de tipo {{ type }}. + + + This value should be blank. + Este valor debería estar vacío. + + + The value you selected is not a valid choice. + El valor seleccionado no es una opción válida. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Debe seleccionar al menos {{ limit }} opción.|Debe seleccionar al menos {{ limit }} opciones. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Debe seleccionar como máximo {{ limit }} opción.|Debe seleccionar como máximo {{ limit }} opciones. + + + One or more of the given values is invalid. + Uno o más de los valores indicados no son válidos. + + + This field was not expected. + Este campo no se esperaba. + + + This field is missing. + Este campo está desaparecido. + + + This value is not a valid date. + Este valor no es una fecha válida. + + + This value is not a valid datetime. + Este valor no es una fecha y hora válidas. + + + This value is not a valid email address. + Este valor no es una dirección de email válida. + + + The file could not be found. + No se pudo encontrar el archivo. + + + The file is not readable. + No se puede leer el archivo. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + El archivo es demasiado grande ({{ size }} {{ suffix }}). El tamaño máximo permitido es {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + El tipo mime del archivo no es válido ({{ type }}). Los tipos mime válidos son {{ types }}. + + + This value should be {{ limit }} or less. + Este valor debería ser {{ limit }} o menos. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Este valor es demasiado largo. Debería tener {{ limit }} carácter o menos.|Este valor es demasiado largo. Debería tener {{ limit }} caracteres o menos. + + + This value should be {{ limit }} or more. + Este valor debería ser {{ limit }} o más. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Este valor es demasiado corto. Debería tener {{ limit }} carácter o más.|Este valor es demasiado corto. Debería tener {{ limit }} caracteres o más. + + + This value should not be blank. + Este valor no debería estar vacío. + + + This value should not be null. + Este valor no debería ser nulo. + + + This value should be null. + Este valor debería ser nulo. + + + This value is not valid. + Este valor no es válido. + + + This value is not a valid time. + Este valor no es una hora válida. + + + This value is not a valid URL. + Este valor no es una URL válida. + + + The two values should be equal. + Los dos valores deberían ser iguales. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + El archivo es demasiado grande. El tamaño máximo permitido es {{ limit }} {{ suffix }}. + + + The file is too large. + El archivo es demasiado grande. + + + The file could not be uploaded. + No se pudo subir el archivo. + + + This value should be a valid number. + Este valor debería ser un número válido. + + + This file is not a valid image. + El archivo no es una imagen válida. + + + This is not a valid IP address. + Esto no es una dirección IP válida. + + + This value is not a valid language. + Este valor no es un idioma válido. + + + This value is not a valid locale. + Este valor no es una localización válida. + + + This value is not a valid country. + Este valor no es un país válido. + + + This value is already used. + Este valor ya se ha utilizado. + + + The size of the image could not be detected. + No se pudo determinar el tamaño de la imagen. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + El ancho de la imagen es demasiado grande ({{ width }}px). El ancho máximo permitido es de {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + El ancho de la imagen es demasiado pequeño ({{ width }}px). El ancho mínimo requerido es {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + La altura de la imagen es demasiado grande ({{ height }}px). La altura máxima permitida es de {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + La altura de la imagen es demasiado pequeña ({{ height }}px). La altura mínima requerida es de {{ min_height }}px. + + + This value should be the user's current password. + Este valor debería ser la contraseña actual del usuario. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Este valor debería tener exactamente {{ limit }} carácter.|Este valor debería tener exactamente {{ limit }} caracteres. + + + The file was only partially uploaded. + El archivo fue sólo subido parcialmente. + + + No file was uploaded. + Ningún archivo fue subido. + + + No temporary folder was configured in php.ini. + Ninguna carpeta temporal fue configurada en php.ini. + + + Cannot write temporary file to disk. + No se pudo escribir el archivo temporal en el disco. + + + A PHP extension caused the upload to fail. + Una extensión de PHP hizo que la subida fallara. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Esta colección debe contener {{ limit }} elemento o más.|Esta colección debe contener {{ limit }} elementos o más. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Esta colección debe contener {{ limit }} elemento o menos.|Esta colección debe contener {{ limit }} elementos o menos. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Esta colección debe contener exactamente {{ limit }} elemento.|Esta colección debe contener exactamente {{ limit }} elementos. + + + Invalid card number. + Número de tarjeta inválido. + + + Unsupported card type or invalid card number. + Tipo de tarjeta no soportado o número de tarjeta inválido. + + + This is not a valid International Bank Account Number (IBAN). + Esto no es un International Bank Account Number (IBAN) válido. + + + This value is not a valid ISBN-10. + Este valor no es un ISBN-10 válido. + + + This value is not a valid ISBN-13. + Este valor no es un ISBN-13 válido. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Este valor no es ni un ISBN-10 válido ni un ISBN-13 válido. + + + This value is not a valid ISSN. + Este valor no es un ISSN válido. + + + This value is not a valid currency. + Este valor no es una divisa válida. + + + This value should be equal to {{ compared_value }}. + Este valor debería ser igual que {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Este valor debería ser mayor que {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Este valor debería ser mayor o igual que {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Este valor debería ser idéntico a {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Este valor debería ser menor que {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Este valor debería ser menor o igual que {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Este valor debería ser distinto de {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Este valor no debería ser idéntico a {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + La proporción de la imagen es demasiado grande ({{ ratio }}). La máxima proporción permitida es {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + La proporción de la imagen es demasiado pequeña ({{ ratio }}). La mínima proporción permitida es {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + La imagen es cuadrada ({{ width }}x{{ height }}px). Las imágenes cuadradas no están permitidas. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + La imagen está orientada horizontalmente ({{ width }}x{{ height }}px). Las imágenes orientadas horizontalmente no están permitidas. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + La imagen está orientada verticalmente ({{ width }}x{{ height }}px). Las imágenes orientadas verticalmente no están permitidas. + + + An empty file is not allowed. + No está permitido un archivo vacío. + + + The host could not be resolved. + No se puede resolver el host. + + + This value does not match the expected {{ charset }} charset. + La codificación de caracteres para este valor debería ser {{ charset }}. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.et.xlf b/core/vendor/symfony/validator/Resources/translations/validators.et.xlf new file mode 100644 index 0000000..d047c8b --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.et.xlf @@ -0,0 +1,283 @@ + + + + + + This value should be false. + Väärtus peaks olema väär. + + + This value should be true. + Väärtus peaks oleme tõene. + + + This value should be of type {{ type }}. + Väärtus peaks olema {{ type }}-tüüpi. + + + This value should be blank. + Väärtus peaks olema tühi. + + + The value you selected is not a valid choice. + Väärtus peaks olema üks etteantud valikutest. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Valima peaks vähemalt {{ limit }} valikut. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Valima peaks mitte rohkem kui {{ limit }} valikut. + + + One or more of the given values is invalid. + One or more of the given values is invalid. + + + This field was not expected. + See väli ei oodatud. + + + This field is missing. + See väli on puudu. + + + This value is not a valid date. + Väärtus pole korrektne kuupäev. + + + This value is not a valid datetime. + Väärtus pole korrektne kuupäev ja kellaeg. + + + This value is not a valid email address. + Väärtus pole korrektne e-maili aadress. + + + The file could not be found. + Faili ei leita. + + + The file is not readable. + Fail ei ole loetav. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Fail on liiga suur ({{ size }} {{ suffix }}). Suurim lubatud suurus on {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Faili sisutüüp on vigane ({{ type }}). Lubatud sisutüübid on {{ types }}. + + + This value should be {{ limit }} or less. + Väärtus peaks olema {{ limit }} või vähem. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Väärtus on liiga pikk. Pikkus peaks olema {{ limit }} tähemärki või vähem. + + + This value should be {{ limit }} or more. + Väärtus peaks olema {{ limit }} või rohkem. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Väärtus on liiga lühike. Pikkus peaks olema {{ limit }} tähemärki või rohkem. + + + This value should not be blank. + Väärtus ei tohiks olla tühi. + + + This value should not be null. + Väärtus ei tohiks olla 'null'. + + + This value should be null. + Väärtus peaks olema 'null'. + + + This value is not valid. + Väärtus on vigane. + + + This value is not a valid time. + Väärtus pole korrektne aeg. + + + This value is not a valid URL. + Väärtus pole korrektne URL. + + + The two values should be equal. + Väärtused peaksid olema võrdsed. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Fail on liiga suur. Maksimaalne lubatud suurus on {{ limit }} {{ suffix }}. + + + The file is too large. + Fail on liiga suur. + + + The file could not be uploaded. + Faili ei saa üles laadida. + + + This value should be a valid number. + Väärtus peaks olema korrektne number. + + + This file is not a valid image. + Fail ei ole korrektne pilt. + + + This is not a valid IP address. + IP aadress pole korrektne. + + + This value is not a valid language. + Väärtus pole korrektne keel. + + + This value is not a valid locale. + Väärtus pole korrektne asukohakeel. + + + This value is not a valid country. + Väärtus pole olemasolev riik. + + + This value is already used. + Väärtust on juba kasutatud. + + + The size of the image could not be detected. + Pildi suurust polnud võimalik tuvastada. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Pilt on liiga lai ({{ width }}px). Suurim lubatud laius on {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Pilt on liiga kitsas ({{ width }}px). Vähim lubatud laius on {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Pilt on liiga pikk ({{ height }}px). Lubatud suurim pikkus on {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Pilt pole piisavalt pikk ({{ height }}px). Lubatud vähim pikkus on {{ min_height }}px. + + + This value should be the user's current password. + Väärtus peaks olema kasutaja kehtiv salasõna. + + + This value should have exactly {{ limit }} characters. + Väärtus peaks olema täpselt {{ limit }} tähemärk pikk.|Väärtus peaks olema täpselt {{ limit }} tähemärki pikk. + + + The file was only partially uploaded. + Fail ei laetud täielikult üles. + + + No file was uploaded. + Ãœhtegi faili ei laetud üles. + + + No temporary folder was configured in php.ini. + Ãœhtegi ajutist kausta polnud php.ini-s seadistatud. + + + Cannot write temporary file to disk. + Ajutist faili ei saa kettale kirjutada. + + + A PHP extension caused the upload to fail. + PHP laiendi tõttu ebaõnnestus faili üleslaadimine. + + + This collection should contain {{ limit }} elements or more. + Kogumikus peaks olema vähemalt {{ limit }} element.|Kogumikus peaks olema vähemalt {{ limit }} elementi. + + + This collection should contain {{ limit }} elements or less. + Kogumikus peaks olema ülimalt {{ limit }} element.|Kogumikus peaks olema ülimalt {{ limit }} elementi. + + + This collection should contain exactly {{ limit }} elements. + Kogumikus peaks olema täpselt {{ limit }} element.|Kogumikus peaks olema täpselt {{ limit }}|elementi. + + + Invalid card number. + Vigane kaardi number. + + + Unsupported card type or invalid card number. + Kaardi tüüpi ei toetata või kaardi number on vigane. + + + This is not a valid International Bank Account Number (IBAN). + Väärtus pole korrektne IBAN-number. + + + This value is not a valid ISBN-10. + Väärtus pole korrektne ISBN-10. + + + This value is not a valid ISBN-13. + Väärtus pole korrektne ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Väärtus pole korrektne ISBN-10 ega ISBN-13. + + + This value is not a valid ISSN. + Väärtus pole korrektne ISSN. + + + This value is not a valid currency. + Väärtus pole korrektne valuuta. + + + This value should be equal to {{ compared_value }}. + Väärtus peaks olema võrdne {{ compared_value }}-ga. + + + This value should be greater than {{ compared_value }}. + Väärtus peaks olema suurem kui {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Väärtus peaks olema suurem kui või võrduma {{ compared_value }}-ga. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Väärtus peaks olema identne väärtusega {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Väärtus peaks olema väiksem kui {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Väärtus peaks olema väiksem kui või võrduma {{ compared_value }}-ga. + + + This value should not be equal to {{ compared_value }}. + Väärtus ei tohiks võrduda {{ compared_value }}-ga. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Väärtus ei tohiks olla identne väärtusega {{ compared_value_type }} {{ compared_value }}. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.eu.xlf b/core/vendor/symfony/validator/Resources/translations/validators.eu.xlf new file mode 100644 index 0000000..b2edefd --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.eu.xlf @@ -0,0 +1,283 @@ + + + + + + This value should be false. + Balio hau faltsua izan beharko litzateke. + + + This value should be true. + Balio hau egia izan beharko litzateke. + + + This value should be of type {{ type }}. + Balio hau {{ type }} motakoa izan beharko litzateke. + + + This value should be blank. + Balio hau hutsik egon beharko litzateke. + + + The value you selected is not a valid choice. + Hautatu duzun balioa ez da aukera egoki bat. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Gutxienez aukera {{ limit }} hautatu behar duzu.|Gutxienez {{ limit }} aukera hautatu behar dituzu. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Gehienez aukera {{ limit }} hautatu behar duzu.|Gehienez {{ limit }} aukera hautatu behar dituzu. + + + One or more of the given values is invalid. + Emandako balioetatik gutxienez bat ez da egokia. + + + This field was not expected. + Eremu hau ez zen espero. + + + This field is missing. + Eremu hau falta da. + + + This value is not a valid date. + Balio hau ez da data egoki bat. + + + This value is not a valid datetime. + Balio hau ez da data-ordu egoki bat. + + + This value is not a valid email address. + Balio hau ez da posta elektroniko egoki bat. + + + The file could not be found. + Ezin izan da fitxategia aurkitu. + + + The file is not readable. + Fitxategia ez da irakurgarria. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Fitxategia handiegia da ({{ size }} {{ suffix }}). Baimendutako tamaina handiena {{ limit }} {{ suffix }} da. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Fitxategiaren mime mota ez da egokia ({{ type }}). Hauek dira baimendutako mime motak: {{ types }}. + + + This value should be {{ limit }} or less. + Balio hau gehienez {{ limit }} izan beharko litzateke. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Balio hau luzeegia da. Gehienez karaktere {{ limit }} eduki beharko luke.|Balio hau luzeegia da. Gehienez {{ limit }} karaktere eduki beharko lituzke. + + + This value should be {{ limit }} or more. + Balio hau gutxienez {{ limit }} izan beharko litzateke. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Balio hau motzegia da. Karaktere {{ limit }} gutxienez eduki beharko luke.|Balio hau motzegia da. Gutxienez {{ limit }} karaktere eduki beharko lituzke. + + + This value should not be blank. + Balio hau ez litzateke hutsik egon behar. + + + This value should not be null. + Balio hau ez litzateke nulua izan behar. + + + This value should be null. + Balio hau nulua izan beharko litzateke. + + + This value is not valid. + Balio hau ez da egokia. + + + This value is not a valid time. + Balio hau ez da ordu egoki bat. + + + This value is not a valid URL. + Balio hau ez da baliabideen kokatzaile uniforme (URL) egoki bat. + + + The two values should be equal. + Bi balioak berdinak izan beharko lirateke. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Fitxategia handiegia da. Baimendutako tamaina handiena {{ limit }} {{ suffix }} da. + + + The file is too large. + Fitxategia handiegia da. + + + The file could not be uploaded. + Ezin izan da fitxategia igo. + + + This value should be a valid number. + Balio hau zenbaki egoki bat izan beharko litzateke. + + + This file is not a valid image. + Fitxategi hau ez da irudi egoki bat. + + + This is not a valid IP address. + Honako hau ez da IP helbide egoki bat. + + + This value is not a valid language. + Balio hau ez da hizkuntza egoki bat. + + + This value is not a valid locale. + Balio hau ez da kokapen egoki bat. + + + This value is not a valid country. + Balio hau ez da herrialde egoki bat. + + + This value is already used. + Balio hau jadanik erabilia izan da. + + + The size of the image could not be detected. + Ezin izan da irudiaren tamaina detektatu. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Irudiaren zabalera handiegia da ({{ width }}px). Onartutako gehienezko zabalera {{ max_width }}px dira. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Irudiaren zabalera txikiegia da ({{ width }}px). Onartutako gutxieneko zabalera {{ min_width }}px dira. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Irudiaren altuera handiegia da ({{ height }}px). Onartutako gehienezko altuera {{ max_height }}px dira. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Irudiaren altuera txikiegia da ({{ height }}px). Onartutako gutxieneko altuera {{ min_height }}px dira. + + + This value should be the user's current password. + Balio hau uneko erabiltzailearen pasahitza izan beharko litzateke. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Balio honek zehazki karaktere {{ limit }} izan beharko luke.|Balio honek zehazki {{ limit }} karaktere izan beharko lituzke. + + + The file was only partially uploaded. + Fitxategiaren zati bat bakarrik igo da. + + + No file was uploaded. + Ez da fitxategirik igo. + + + No temporary folder was configured in php.ini. + Ez da aldi baterako karpetarik konfiguratu php.ini fitxategian. + + + Cannot write temporary file to disk. + Ezin izan da aldi baterako fitxategia diskoan idatzi. + + + A PHP extension caused the upload to fail. + PHP luzapen batek igoeraren hutsa eragin du. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Bilduma honek gutxienez elementu {{ limit }} eduki beharko luke.|Bilduma honek gutxienez {{ limit }} elementu eduki beharko lituzke. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Bilduma honek gehienez elementu {{ limit }} eduki beharko luke.|Bilduma honek gehienez {{ limit }} elementu eduki beharko lituzke. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Bilduma honek zehazki elementu {{ limit }} eduki beharko luke.|Bilduma honek zehazki {{ limit }} elementu eduki beharko lituzke. + + + Invalid card number. + Txartel zenbaki baliogabea. + + + Unsupported card type or invalid card number. + Txartel mota onartezina edo txartel zenbaki baliogabea. + + + This is not a valid International Bank Account Number (IBAN). + Hau ez da baliozko banku internazionaleko kontu zenbaki (IBAN) bat. + + + This value is not a valid ISBN-10. + Balio hau ez da onartutako ISBN-10 bat. + + + This value is not a valid ISBN-13. + Balio hau ez da onartutako ISBN-13 bat. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Balio hau ez da onartutako ISBN-10 edo ISBN-13 bat. + + + This value is not a valid ISSN. + Balio hau ez da onartutako ISSN bat. + + + This value is not a valid currency. + Balio hau ez da baliozko moneta bat. + + + This value should be equal to {{ compared_value }}. + Balio hau {{ compared_value }}-(r)en berbera izan beharko litzateke. + + + This value should be greater than {{ compared_value }}. + Balio hau {{ compared_value }} baino handiagoa izan beharko litzateke. + + + This value should be greater than or equal to {{ compared_value }}. + Balio hau {{ compared_value }}-(r)en berdina edota handiagoa izan beharko litzateke. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Balio hau {{ compared_value_type }} {{ compared_value }}-(r)en berbera izan beharko litzateke. + + + This value should be less than {{ compared_value }}. + Balio hau {{ compared_value }} baino txikiagoa izan beharko litzateke. + + + This value should be less than or equal to {{ compared_value }}. + Balio hau {{ compared_value }}-(r)en berdina edota txikiagoa izan beharko litzateke. + + + This value should not be equal to {{ compared_value }}. + Balio hau ez litzateke {{ compared_value }}-(r)en berdina izan behar. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Balio hau ez litzateke {{ compared_value_type }} {{ compared_value }}-(r)en berbera izan behar. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.fa.xlf b/core/vendor/symfony/validator/Resources/translations/validators.fa.xlf new file mode 100644 index 0000000..98b4bd6 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.fa.xlf @@ -0,0 +1,283 @@ + + + + + + This value should be false. + این مقدار باید نادرست(False) باشد. + + + This value should be true. + این مقدار باید درست(True) باشد. + + + This value should be of type {{ type }}. + این مقدار باید از نوع {{ type }} باشد. + + + This value should be blank. + این Ùیلد باید خالی باشد. + + + The value you selected is not a valid choice. + گزینه انتخابی معتبر نیست. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + باید حداقل {{ limit }} گزینه انتخاب کنید.|باید حداقل {{ limit }} گزینه انتخاب کنید. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + حداکثر {{ limit }} گزینه Ù…ÛŒ توانید انتخاب کنید.|حداکثر {{ limit }} گزینه Ù…ÛŒ توانید انتخاب کنید. + + + One or more of the given values is invalid. + یک یا چند مقدار نامعتبر وجود دارد. + + + The fields {{ fields }} were not expected. + Ùیلدهای {{ fields }} اضاÙÛŒ هستند. + + + The fields {{ fields }} are missing. + Ùیلدهای {{ fields }} Ú©Ù… هستند. + + + This value is not a valid date. + این مقدار یک تاریخ معتبر نیست. + + + This value is not a valid datetime. + این مقدار یک تاریخ Ùˆ زمان معتبر نیست. + + + This value is not a valid email address. + این یک رایانامه معتبر نیست. + + + The file could not be found. + Ùایل پیدا نشد. + + + The file is not readable. + Ùایل قابلیت خواندن ندارد. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Ùایل بیش از اندازه بزرگ است({{ size }} {{ suffix }}). حداکثر اندازه مجاز برابر {{ limit }} {{ suffix }} است. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + این نوع Ùایل مجاز نیست({{ type }}). نوع های مجاز {{ types }} هستند. + + + This value should be {{ limit }} or less. + این مقدار باید کوچکتر یا مساوی {{ limit }} باشد. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + بسیار طولانی است.حداکثر تعداد حرو٠مجاز برابر {{ limit }} است.|بسیار طولانی است.حداکثر تعداد حرو٠مجاز برابر {{ limit }} است. + + + This value should be {{ limit }} or more. + این مقدار باید برابر Ùˆ یا بیشتر از {{ limit }} باشد. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + بسیار کوتاه است.تعداد حرو٠باید حداقل {{ limit }} باشد.|بسیار کوتاه است.تعداد حرو٠باید حداقل {{ limit }} باشد. + + + This value should not be blank. + این مقدار نباید تهی باشد. + + + This value should not be null. + باید مقداری داشته باشد.. + + + This value should be null. + نباید مقداری داشته باشد. + + + This value is not valid. + این مقدار معتبر نیست. + + + This value is not a valid time. + این مقدار یک زمان صحیح نیست. + + + This value is not a valid URL. + این یک URL معتبر نیست. + + + The two values should be equal. + دو مقدار باید برابر باشند. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Ùایل بیش از اندازه بزرگ است. حداکثر اندازه مجاز برابر {{ limit }} {{ suffix }} است. + + + The file is too large. + Ùایل بیش از اندازه بزرگ است. + + + The file could not be uploaded. + بارگذاری Ùایل با شکست مواجه شد. + + + This value should be a valid number. + این مقدار باید یک عدد معتبر باشد. + + + This file is not a valid image. + این Ùایل یک تصویر نیست. + + + This is not a valid IP address. + این مقدار یک IP معتبر نیست. + + + This value is not a valid language. + این مقدار یک زبان صحیح نیست. + + + This value is not a valid locale. + این مقدار یک محل صحیح نیست. + + + This value is not a valid country. + این مقدار یک کشور صحیح نیست. + + + This value is already used. + این مقدار قبلا مورد استÙاده قرار گرÙته است. + + + The size of the image could not be detected. + اندازه تصویر قابل شناسایی نیست. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + طول تصویر بسیار بزرگ است ({{ width }}px). بشینه طول مجاز {{ max_width }}px است. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + طول تصویر بسیار Ú©ÙˆÚ†Ú© است ({{ width }}px). کمینه طول موردنظر {{ min_width }}px است. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + ارتÙاع تصویر بسیار بزرگ است ({{ height }}px). بشینه ارتÙاع مجاز {{ max_height }}px است. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + ارتÙاع تصویر بسیار Ú©ÙˆÚ†Ú© است ({{ height }}px). کمینه ارتÙاع موردنظر {{ min_height }}px است. + + + This value should be the user's current password. + این مقدار Ù…ÛŒ بایست کلمه عبور کنونی کاربر باشد. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + این مقدار Ù…ÛŒ بایست دقیقا {{ limit }} کاراکتر داشته باشد.| این مقدار Ù…ÛŒ بایست دقیقا {{ limit }} کاراکتر داشته باشد. + + + The file was only partially uploaded. + Ùایل به صورت جزیی بارگذاری شده است. + + + No file was uploaded. + هیچ Ùایلی بارگذاری نشد. + + + No temporary folder was configured in php.ini. + Ùولدر موقت در php.ini پیکربندی نشده است. + + + Cannot write temporary file to disk. + Ùایل موقت را نمی توان در دیسک نوشت. + + + A PHP extension caused the upload to fail. + اکستنشن PHP موجب شد Ú©Ù‡ بارگذاری Ùایل با شکست مواجه شود. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + این مجموعه Ù…ÛŒ بایست دارای {{ limit }} عنصر یا بیشتر باشد.|این مجموعه Ù…ÛŒ بایست دارای {{ limit }} عنصر یا بیشتر باشد. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + این مجموعه Ù…ÛŒ بایست دارای حداقل {{ limit }} عنصر یا کمتر باشد.|این مجموعه Ù…ÛŒ بایست دارای {{ limit }} عنصر یا کمتر باشد. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + این مجموعه Ù…ÛŒ بایست به طور دقیق دارا {{ limit }} عنصر باشد.|این مجموعه Ù…ÛŒ بایست به طور دقیق دارای {{ limit }} قلم باشد. + + + Invalid card number. + شماره کارت نامعتبر است. + + + Unsupported card type or invalid card number. + نوع کارت پشتیبانی نمی شود یا شماره کارت نامعتبر است. + + + This is not a valid International Bank Account Number (IBAN). + این یک شماره حساب بین المللی بانک (IBAN) درست نیست. + + + This value is not a valid ISBN-10. + این مقدار یک ISBN-10 درست نیست. + + + This value is not a valid ISBN-13. + این مقدار یک ISBN-13 درست نیست. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + این مقدار یک ISBN-10 درست یا ISBN-13 درست نیست. + + + This value is not a valid ISSN. + این مقدار یک ISSN درست نیست. + + + This value is not a valid currency. + این مقدار یک یکای پول درست نیست. + + + This value should be equal to {{ compared_value }}. + این مقدار باید برابر با {{ compared_value }} باشد. + + + This value should be greater than {{ compared_value }}. + این مقدار باید از {{ compared_value }} بیشتر باشد. + + + This value should be greater than or equal to {{ compared_value }}. + این مقدار باید بزرگتر یا مساوی با {{ compared_value }} باشد. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + این مقدار باید با {{ compared_value_type }} {{ compared_value }} یکی باشد. + + + This value should be less than {{ compared_value }}. + این مقدار باید کمتر از {{ compared_value }} باشد. + + + This value should be less than or equal to {{ compared_value }}. + این مقدار باید کمتر یا مساوی با {{ compared_value }} باشد. + + + This value should not be equal to {{ compared_value }}. + این مقدار نباید با {{ compared_value }} برابر باشد. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + این مقدار نباید {{ compared_value_type }} {{ compared_value }} یکی باشد. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.fi.xlf b/core/vendor/symfony/validator/Resources/translations/validators.fi.xlf new file mode 100644 index 0000000..3f5a07e --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.fi.xlf @@ -0,0 +1,227 @@ + + + + + + This value should be false. + Arvon tulee olla epätosi. + + + This value should be true. + Arvon tulee olla tosi. + + + This value should be of type {{ type }}. + Arvon tulee olla tyyppiä {{ type }}. + + + This value should be blank. + Arvon tulee olla tyhjä. + + + The value you selected is not a valid choice. + Arvon tulee olla yksi annetuista vaihtoehdoista. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Sinun tulee valita vähintään {{ limit }} vaihtoehtoa. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Sinun tulee valitan enintään {{ limit }} vaihtoehtoa. + + + One or more of the given values is invalid. + Yksi tai useampi annetuista arvoista on virheellinen. + + + This field was not expected. + Tässä kentässä ei odotettu. + + + This field is missing. + Tämä kenttä puuttuu. + + + This value is not a valid date. + Annettu arvo ei ole kelvollinen päivämäärä. + + + This value is not a valid datetime. + Annettu arvo ei ole kelvollinen päivämäärä ja kellonaika. + + + This value is not a valid email address. + Annettu arvo ei ole kelvollinen sähköpostiosoite. + + + The file could not be found. + Tiedostoa ei löydy. + + + The file is not readable. + Tiedostoa ei voida lukea. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Tiedostonkoko ({{ size }} {{ suffix }}) on liian iso. Suurin sallittu tiedostonkoko on {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Tiedostotyyppi ({{ type }}) on virheellinen. Sallittuja tiedostotyyppejä ovat {{ types }}. + + + This value should be {{ limit }} or less. + Arvon tulee olla {{ limit }} tai vähemmän. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Liian pitkä syöte. Syöte saa olla enintään {{ limit }} merkkiä. + + + This value should be {{ limit }} or more. + Arvon tulee olla {{ limit }} tai enemmän. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Liian lyhyt syöte. Syötteen tulee olla vähintään {{ limit }} merkkiä. + + + This value should not be blank. + Kenttä ei voi olla tyhjä. + + + This value should not be null. + Syöte ei voi olla null. + + + This value should be null. + Syötteen tulee olla null. + + + This value is not valid. + Virheellinen arvo. + + + This value is not a valid time. + Annettu arvo ei ole kelvollinen kellonaika. + + + This value is not a valid URL. + Annettu arvo ei ole kelvollinen URL-osoite. + + + The two values should be equal. + Kahden annetun arvon tulee olla samat. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Annettu tiedosto on liian iso. Suurin sallittu tiedostokoko on {{ limit }} {{ suffix }}. + + + The file is too large. + Tiedosto on liian iso. + + + The file could not be uploaded. + Tiedoston siirto epäonnistui. + + + This value should be a valid number. + Tämän arvon tulee olla numero. + + + This file is not a valid image. + Tämä tiedosto ei ole kelvollinen kuva. + + + This is not a valid IP address. + Tämä ei ole kelvollinen IP-osoite. + + + This value is not a valid language. + Tämä arvo ei ole kelvollinen kieli. + + + This value is not a valid locale. + Tämä arvo ei ole kelvollinen kieli- ja alueasetus (locale). + + + This value is not a valid country. + Tämä arvo ei ole kelvollinen maa. + + + This value is already used. + Tämä arvo on jo käytetty. + + + The size of the image could not be detected. + Kuvan kokoa ei voitu tunnistaa. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Kuva on liian leveä ({{ width }}px). Sallittu maksimileveys on {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Kuva on liian kapea ({{ width }}px). Leveyden tulisi olla vähintään {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Kuva on liian korkea ({{ width }}px). Sallittu maksimikorkeus on {{ max_width }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Kuva on liian matala ({{ height }}px). Korkeuden tulisi olla vähintään {{ min_height }}px. + + + This value should be the user's current password. + Tämän arvon tulisi olla käyttäjän tämänhetkinen salasana. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Tämän arvon tulisi olla tasan yhden merkin pituinen.|Tämän arvon tulisi olla tasan {{ limit }} merkkiä pitkä. + + + The file was only partially uploaded. + Tiedosto ladattiin vain osittain. + + + No file was uploaded. + Tiedostoa ei ladattu. + + + No temporary folder was configured in php.ini. + Väliaikaishakemistoa ei ole asetettu php.ini -tiedostoon. + + + Cannot write temporary file to disk. + Väliaikaistiedostoa ei voitu kirjoittaa levylle. + + + A PHP extension caused the upload to fail. + PHP-laajennoksen vuoksi tiedoston lataus epäonnistui. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Tässä ryhmässä tulisi olla yksi tai useampi elementti.|Tässä ryhmässä tulisi olla vähintään {{ limit }} elementtiä. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Tässä ryhmässä tulisi olla enintään yksi elementti.|Tässä ryhmässä tulisi olla enintään {{ limit }} elementtiä. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Tässä ryhmässä tulisi olla tasan yksi elementti.|Tässä ryhmässä tulisi olla enintään {{ limit }} elementtiä. + + + Invalid card number. + Virheellinen korttinumero. + + + Unsupported card type or invalid card number. + Tätä korttityyppiä ei tueta tai korttinumero on virheellinen. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.fr.xlf b/core/vendor/symfony/validator/Resources/translations/validators.fr.xlf new file mode 100644 index 0000000..b50ecbc --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.fr.xlf @@ -0,0 +1,315 @@ + + + + + + This value should be false. + Cette valeur doit être fausse. + + + This value should be true. + Cette valeur doit être vraie. + + + This value should be of type {{ type }}. + Cette valeur doit être de type {{ type }}. + + + This value should be blank. + Cette valeur doit être vide. + + + The value you selected is not a valid choice. + Cette valeur doit être l'un des choix proposés. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Vous devez sélectionner au moins {{ limit }} choix.|Vous devez sélectionner au moins {{ limit }} choix. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Vous devez sélectionner au maximum {{ limit }} choix.|Vous devez sélectionner au maximum {{ limit }} choix. + + + One or more of the given values is invalid. + Une ou plusieurs des valeurs soumises sont invalides. + + + This field was not expected. + Ce champ n'a pas été prévu. + + + This field is missing. + Ce champ est manquant. + + + This value is not a valid date. + Cette valeur n'est pas une date valide. + + + This value is not a valid datetime. + Cette valeur n'est pas une date valide. + + + This value is not a valid email address. + Cette valeur n'est pas une adresse email valide. + + + The file could not be found. + Le fichier n'a pas été trouvé. + + + The file is not readable. + Le fichier n'est pas lisible. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Le fichier est trop volumineux ({{ size }} {{ suffix }}). Sa taille ne doit pas dépasser {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Le type du fichier est invalide ({{ type }}). Les types autorisés sont {{ types }}. + + + This value should be {{ limit }} or less. + Cette valeur doit être inférieure ou égale à {{ limit }}. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Cette chaine est trop longue. Elle doit avoir au maximum {{ limit }} caractère.|Cette chaine est trop longue. Elle doit avoir au maximum {{ limit }} caractères. + + + This value should be {{ limit }} or more. + Cette valeur doit être supérieure ou égale à {{ limit }}. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Cette chaine est trop courte. Elle doit avoir au minimum {{ limit }} caractère.|Cette chaine est trop courte. Elle doit avoir au minimum {{ limit }} caractères. + + + This value should not be blank. + Cette valeur ne doit pas être vide. + + + This value should not be null. + Cette valeur ne doit pas être nulle. + + + This value should be null. + Cette valeur doit être nulle. + + + This value is not valid. + Cette valeur n'est pas valide. + + + This value is not a valid time. + Cette valeur n'est pas une heure valide. + + + This value is not a valid URL. + Cette valeur n'est pas une URL valide. + + + The two values should be equal. + Les deux valeurs doivent être identiques. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Le fichier est trop volumineux. Sa taille ne doit pas dépasser {{ limit }} {{ suffix }}. + + + The file is too large. + Le fichier est trop volumineux. + + + The file could not be uploaded. + Le téléchargement de ce fichier est impossible. + + + This value should be a valid number. + Cette valeur doit être un nombre. + + + This file is not a valid image. + Ce fichier n'est pas une image valide. + + + This is not a valid IP address. + Cette adresse IP n'est pas valide. + + + This value is not a valid language. + Cette langue n'est pas valide. + + + This value is not a valid locale. + Ce paramètre régional n'est pas valide. + + + This value is not a valid country. + Ce pays n'est pas valide. + + + This value is already used. + Cette valeur est déjà utilisée. + + + The size of the image could not be detected. + La taille de l'image n'a pas pu être détectée. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + La largeur de l'image est trop grande ({{ width }}px). La largeur maximale autorisée est de {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + La largeur de l'image est trop petite ({{ width }}px). La largeur minimale attendue est de {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + La hauteur de l'image est trop grande ({{ height }}px). La hauteur maximale autorisée est de {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + La hauteur de l'image est trop petite ({{ height }}px). La hauteur minimale attendue est de {{ min_height }}px. + + + This value should be the user's current password. + Cette valeur doit être le mot de passe actuel de l'utilisateur. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Cette chaine doit avoir exactement {{ limit }} caractère.|Cette chaine doit avoir exactement {{ limit }} caractères. + + + The file was only partially uploaded. + Le fichier a été partiellement transféré. + + + No file was uploaded. + Aucun fichier n'a été transféré. + + + No temporary folder was configured in php.ini. + Aucun répertoire temporaire n'a été configuré dans le php.ini. + + + Cannot write temporary file to disk. + Impossible d'écrire le fichier temporaire sur le disque. + + + A PHP extension caused the upload to fail. + Une extension PHP a empêché le transfert du fichier. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Cette collection doit contenir {{ limit }} élément ou plus.|Cette collection doit contenir {{ limit }} éléments ou plus. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Cette collection doit contenir {{ limit }} élément ou moins.|Cette collection doit contenir {{ limit }} éléments ou moins. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Cette collection doit contenir exactement {{ limit }} élément.|Cette collection doit contenir exactement {{ limit }} éléments. + + + Invalid card number. + Numéro de carte invalide. + + + Unsupported card type or invalid card number. + Type de carte non supporté ou numéro invalide. + + + This is not a valid International Bank Account Number (IBAN). + Le numéro IBAN (International Bank Account Number) saisi n'est pas valide. + + + This value is not a valid ISBN-10. + Cette valeur n'est pas un code ISBN-10 valide. + + + This value is not a valid ISBN-13. + Cette valeur n'est pas un code ISBN-13 valide. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Cette valeur n'est ni un code ISBN-10, ni un code ISBN-13 valide. + + + This value is not a valid ISSN. + Cette valeur n'est pas un code ISSN valide. + + + This value is not a valid currency. + Cette valeur n'est pas une devise valide. + + + This value should be equal to {{ compared_value }}. + Cette valeur doit être égale à {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Cette valeur doit être supérieure à {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Cette valeur doit être supérieure ou égale à {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Cette valeur doit être identique à {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Cette valeur doit être inférieure à {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Cette valeur doit être inférieure ou égale à {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Cette valeur ne doit pas être égale à {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Cette valeur ne doit pas être identique à {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Le rapport largeur/hauteur de l'image est trop grand ({{ ratio }}). Le rapport maximal autorisé est {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Le rapport largeur/hauteur de l'image est trop petit ({{ ratio }}). Le rapport minimal attendu est {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + L'image est carrée ({{ width }}x{{ height }}px). Les images carrées ne sont pas autorisées. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + L'image est au format paysage ({{ width }}x{{ height }}px). Les images au format paysage ne sont pas autorisées. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + L'image est au format portrait ({{ width }}x{{ height }}px). Les images au format portrait ne sont pas autorisées. + + + An empty file is not allowed. + Un fichier vide n'est pas autorisé. + + + The host could not be resolved. + Le nom de domaine n'a pas pu être résolu. + + + This value does not match the expected {{ charset }} charset. + Cette valeur ne correspond pas au jeu de caractères {{ charset }} attendu. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.gl.xlf b/core/vendor/symfony/validator/Resources/translations/validators.gl.xlf new file mode 100644 index 0000000..1d0cc13 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.gl.xlf @@ -0,0 +1,315 @@ + + + + + + This value should be false. + Este valor debería ser falso. + + + This value should be true. + Este valor debería ser verdadeiro. + + + This value should be of type {{ type }}. + Este valor debería ser de tipo {{ type }}. + + + This value should be blank. + Este valor debería estar baleiro. + + + The value you selected is not a valid choice. + O valor seleccionado non é unha opción válida. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Debe seleccionar polo menos {{ limit }} opción.|Debe seleccionar polo menos {{ limit }} opcions. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Debe seleccionar como máximo {{ limit }} opción.|Debe seleccionar como máximo {{ limit }} opcions. + + + One or more of the given values is invalid. + Un ou máis dos valores indicados non son válidos. + + + This field was not expected. + Este campo non era esperado. + + + This field is missing. + Este campo falta. + + + This value is not a valid date. + Este valor non é unha data válida. + + + This value is not a valid datetime. + Este valor non é unha data e hora válidas. + + + This value is not a valid email address. + Este valor non é unha dirección de correo electrónico válida. + + + The file could not be found. + Non se puido atopar o arquivo. + + + The file is not readable. + O arquivo non se pode ler. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + O arquivo é demasiado grande ({{ size }} {{ suffix }}). O tamaño máximo permitido é {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + O tipo mime do arquivo non é válido ({{ type }}). Os tipos mime válidos son {{ types }}. + + + This value should be {{ limit }} or less. + Este valor debería ser {{ limit }} ou menos. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Este valor é demasiado longo. Debería ter {{ limit }} carácter ou menos.|Este valor é demasiado longo. Debería ter {{ limit }} caracteres ou menos. + + + This value should be {{ limit }} or more. + Este valor debería ser {{ limit }} ou máis. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Este valor é demasiado curto. Debería ter {{ limit }} carácter ou máis.|Este valor é demasiado corto. Debería ter {{ limit }} caracteres ou máis. + + + This value should not be blank. + Este valor non debería estar baleiro. + + + This value should not be null. + Este valor non debería ser null. + + + This value should be null. + Este valor debería ser null. + + + This value is not valid. + Este valor non é válido. + + + This value is not a valid time. + Este valor non é unha hora válida. + + + This value is not a valid URL. + Este valor non é unha URL válida. + + + The two values should be equal. + Os dous valores deberían ser iguais. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + O arquivo é demasiado grande. O tamaño máximo permitido é {{ limit }} {{ suffix }}. + + + The file is too large. + O arquivo é demasiado grande. + + + The file could not be uploaded. + No se puido cargar o arquivo. + + + This value should be a valid number. + Este valor debería ser un número válido. + + + This file is not a valid image. + O arquivo non é unha imaxe válida. + + + This is not a valid IP address. + Isto non é unha dirección IP válida. + + + This value is not a valid language. + Este valor non é un idioma válido. + + + This value is not a valid locale. + Este valor non é unha localización válida. + + + This value is not a valid country. + Este valor non é un país válido. + + + This value is already used. + Este valor xa está a ser empregado. + + + The size of the image could not be detected. + Non se puido determinar o tamaño da imaxe. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + A largura da imaxe é demasiado grande ({{ width }}px). A largura máxima permitida son {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + A largura da imaxe é demasiado pequena ({{ width }}px). A largura mínima requerida son {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + A altura da imaxe é demasiado grande ({{ height }}px). A altura máxima permitida son {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + A altura da imaxe é demasiado pequena ({{ height }}px). A altura mínima requerida son {{ min_height }}px. + + + This value should be the user's current password. + Este valor debería ser a contrasinal actual do usuario. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Este valor debería ter exactamente {{ limit }} carácter.|Este valor debería ter exactamente {{ limit }} caracteres. + + + The file was only partially uploaded. + O arquivo foi só subido parcialmente. + + + No file was uploaded. + Non se subiu ningún arquivo. + + + No temporary folder was configured in php.ini. + Ningunha carpeta temporal foi configurada en php.ini. + + + Cannot write temporary file to disk. + Non se puido escribir o arquivo temporal no disco. + + + A PHP extension caused the upload to fail. + Unha extensión de PHP provocou que a subida fallara. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Esta colección debe conter {{ limit }} elemento ou máis.|Esta colección debe conter {{ limit }} elementos ou máis. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Esta colección debe conter {{ limit }} elemento ou menos.|Esta colección debe conter {{ limit }} elementos ou menos. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Esta colección debe conter exactamente {{ limit }} elemento.|Esta colección debe conter exactamente {{ limit }} elementos. + + + Invalid card number. + Número de tarxeta non válido. + + + Unsupported card type or invalid card number. + Tipo de tarxeta non soportado ou número de tarxeta non válido. + + + This is not a valid International Bank Account Number (IBAN). + Este valor non é un International Bank Account Number (IBAN) válido. + + + This value is not a valid ISBN-10. + Este valor non é un ISBN-10 válido. + + + This value is not a valid ISBN-13. + Este valor non é un ISBN-13 válido. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Este valor non é nin un ISBN-10 válido nin un ISBN-13 válido. + + + This value is not a valid ISSN. + Este valor non é un ISSN válido. + + + This value is not a valid currency. + Este valor non é unha moeda válida. + + + This value should be equal to {{ compared_value }}. + Este valor debería ser igual a {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Este valor debería ser maior que {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Este valor debería ser maior ou igual que {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Este valor debería ser identico a {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Este valor debería ser menor que {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Este valor debería ser menor ou igual que {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Este valor non debería ser igual a {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Este valor non debería ser identico a {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + A proporción da imaxe é demasiado grande ({{ ratio }}). A proporción máxima permitida é {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + A proporción da é demasiado pequena ({{ ratio }}). A proporción mínima permitida é {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + A imaxe é cadrada ({{ width }}x{{ height }}px). As imáxenes cadradas non están permitidas. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + A imaxe está orientada horizontalmente ({{ width }}x{{ height }}px). As imáxenes orientadas horizontalmente non están permitidas. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + A imaxe está orientada verticalmente ({{ width }}x{{ height }}px). As imáxenes orientadas verticalmente non están permitidas. + + + An empty file is not allowed. + Non está permitido un arquivo baleiro. + + + The host could not be resolved. + Non se puido resolver o host. + + + This value does not match the expected {{ charset }} charset. + A codificación de caracteres para este valor debería ser {{ charset }}. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.he.xlf b/core/vendor/symfony/validator/Resources/translations/validators.he.xlf new file mode 100644 index 0000000..6510514 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.he.xlf @@ -0,0 +1,307 @@ + + + + + + This value should be false. + הערך צריך להיות שקר. + + + This value should be true. + הערך צריך להיות ×מת. + + + This value should be of type {{ type }}. + הערך צריך להיות מסוג {{ type }}. + + + This value should be blank. + הערך צריך להיות ריק. + + + The value you selected is not a valid choice. + הערך שבחרת ×ינו חוקי. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + ×תה צריך לבחור לפחות {{ limit }} ×פשרויות.|×תה צריך לבחור לפחות {{ limit }} ×פשרויות. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + ×תה צריך לבחור לכל היותר {{ limit }} ×פשרויות.|×תה צריך לבחור לכל היותר {{ limit }} ×פשרויות. + + + One or more of the given values is invalid. + ×חד ×ו יותר ×ž×”×¢×¨×›×™× ×ינו חוקי. + + + This field was not expected. + שדה ×–×” ×œ× ×”×™×” צפוי + + + This field is missing. + שדה ×–×” חסר. + + + This value is not a valid date. + הערך ×ינו ת×ריך חוקי. + + + This value is not a valid datetime. + הערך ×ינו ת×ריך ושעה חוקיי×. + + + This value is not a valid email address. + כתובת המייל ××™× ×” תקינה. + + + The file could not be found. + הקובץ ×œ× × ×ž×¦×. + + + The file is not readable. + ×œ× × ×™×ª×Ÿ ×œ×§×¨×•× ×ת הקובץ. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + הקובץ גדול מדי ({{ size }} {{ suffix }}). הגודל המרבי המותר ×”×•× {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + סוג MIME של הקובץ ×ינו חוקי ({{ type }}). ×ž×•×ª×¨×™× ×¡×•×’×™ MIME {{ types }}. + + + This value should be {{ limit }} or less. + הערך צריל להכיל {{ limit }} ×ª×•×•×™× ×œ×›×œ היותר. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + הערך ×רוך מידי. ×”×•× ×¦×¨×™×š להכיל {{ limit }} ×ª×•×•×™× ×œ×›×œ היותר.|הערך ×רוך מידי. ×”×•× ×¦×¨×™×š להכיל {{ limit }} ×ª×•×•×™× ×œ×›×œ היותר. + + + This value should be {{ limit }} or more. + הערך צריך להכיל {{ limit }} ×ª×•×•×™× ×œ×¤×—×•×ª. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + הערך קצר מידיץ ×”×•× ×¦×¨×™×š להכיל {{ limit }} ×ª×•×•×™× ×œ×¤×—×•×ª.|הערך קצר מידיץ ×”×•× ×¦×¨×™×š להכיל {{ limit }} ×ª×•×•×™× ×œ×¤×—×•×ª. + + + This value should not be blank. + הערך ×œ× ×מור להיות ריק. + + + This value should not be null. + הערך ×œ× ×מור להיות ריק. + + + This value should be null. + הערך צריך להיות ריק. + + + This value is not valid. + הערך ×ינו חוקי. + + + This value is not a valid time. + הערך ×ינו זמן תקין. + + + This value is not a valid URL. + ×–×ת ××™× ×” כתובת ×תר תקינה. + + + The two values should be equal. + שני ×”×¢×¨×›×™× ×¦×¨×™×›×™× ×œ×”×™×•×ª שווי×. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + הקובץ גדול מדי. הגודל המרבי המותר ×”×•× {{ limit }} {{ suffix }}. + + + The file is too large. + הקובץ גדול מדי. + + + The file could not be uploaded. + ×œ× × ×™×ª×Ÿ לעלות ×ת הקובץ. + + + This value should be a valid number. + הערך צריך להיות מספר חוקי. + + + This file is not a valid image. + הקובץ ×”×–×” ×ינו תמונה תקינה. + + + This is not a valid IP address. + זו ××™× ×” כתובת IP חוקית. + + + This value is not a valid language. + הערך ×ינו שפה חוקית. + + + This value is not a valid locale. + הערך ×ינו ×זור תקף. + + + This value is not a valid country. + הערך ×ינו ×רץ חוקית. + + + This value is already used. + הערך כבר בשימוש. + + + The size of the image could not be detected. + ×œ× × ×™×ª×Ÿ לקבוע ×ת גודל התמונה. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + רוחב התמונה גדול מדי ({{ width }}px). הרוחב המקסימלי ×”×•× {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + רוחב התמונה קטן מדי ({{ width }}px). הרוחב המינימלי ×”×•× {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + גובה התמונה גדול מדי ({{ height }}px). הגובה המקסימלי ×”×•× {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + גובה התמונה קטן מדי ({{ height }}px). הגובה המינימלי ×”×•× {{ min_height }}px. + + + This value should be the user's current password. + הערך צריך להיות סיסמת המשתמש הנוכחי. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + הערך צריך להיות בדיוק {{ limit }} תווי×.|הערך צריך להיות בדיוק {{ limit }} תווי×. + + + The file was only partially uploaded. + הקובץ הועלה ב×ופן חלקי. + + + No file was uploaded. + הקובץ ×œ× ×”×•×¢×œ×”. + + + No temporary folder was configured in php.ini. + ×œ× ×”×•×’×“×¨×” תיקייה זמנית ב php.ini. + + + Cannot write temporary file to disk. + ×œ× × ×™×ª×Ÿ לכתוב קובץ זמני לדיסק. + + + A PHP extension caused the upload to fail. + סיומת PHP ×’×¨× ×œ×”×¢×œ××” להיכשל. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + ×”×וסף ×מור להכיל {{ limit }} ××œ×ž× ×˜×™× ×ו יותר.|×”×וסף ×מור להכיל {{ limit }} ××œ×ž× ×˜×™× ×ו יותר. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + ×”×וסף ×מור להכיל {{ limit }} ××œ×ž× ×˜×™× ×ו פחות.|×”×וסף ×מור להכיל {{ limit }} ××œ×ž× ×˜×™× ×ו פחות. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + ×”×וסף צריך להכיל בדיוק {{ limit }} ×למנטי×.|×”×וסף צריך להכיל בדיוק {{ limit }} ×למנטי×. + + + Invalid card number. + מספר הכרטיס ×ינו חוקי. + + + Unsupported card type or invalid card number. + סוג הכרטיס ×ינו נתמך ×ו ×œ× ×—×•×§×™. + + + This is not a valid International Bank Account Number (IBAN). + This is not a valid International Bank Account Number (IBAN). + + + This value is not a valid ISBN-10. + This value is not a valid ISBN-10. + + + This value is not a valid ISBN-13. + This value is not a valid ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + This value is neither a valid ISBN-10 nor a valid ISBN-13. + + + This value is not a valid ISSN. + This value is not a valid ISSN. + + + This value is not a valid currency. + This value is not a valid currency. + + + This value should be equal to {{ compared_value }}. + This value should be equal to {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + This value should be greater than {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + This value should be greater than or equal to {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + This value should be less than {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + This value should be less than or equal to {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + This value should not be equal to {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + + + An empty file is not allowed. + An empty file is not allowed. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.hr.xlf b/core/vendor/symfony/validator/Resources/translations/validators.hr.xlf new file mode 100644 index 0000000..a11e825 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.hr.xlf @@ -0,0 +1,283 @@ + + + + + + This value should be false. + Ova vrijednost treba biti netoÄna (false). + + + This value should be true. + Ova vrijednost treba biti toÄna (true). + + + This value should be of type {{ type }}. + Ova vrijednost treba biti tipa {{ type }}. + + + This value should be blank. + Ova vrijednost treba biti prazna. + + + The value you selected is not a valid choice. + Ova vrijednost treba biti jedna od ponuÄ‘enih. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Izaberite barem {{ limit }} mogućnosti. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Izaberite najviÅ¡e {{ limit }} mogućnosti. + + + One or more of the given values is invalid. + Jedna ili viÅ¡e danih vrijednosti nije ispravna. + + + This field was not expected. + Ovo polje nije oÄekivalo. + + + This field is missing. + Ovo polje nedostaje. + + + This value is not a valid date. + Ova vrijednost nije ispravan datum. + + + This value is not a valid datetime. + Ova vrijednost nije ispravan datum-vrijeme. + + + This value is not a valid email address. + Ova vrijednost nije ispravna e-mail adresa. + + + The file could not be found. + Datoteka ne može biti pronaÄ‘ena. + + + The file is not readable. + Datoteka nije Äitljiva. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Datoteka je prevelika ({{ size }} {{ suffix }}). Najveća dozvoljena veliÄina je {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Mime tip datoteke nije ispravan ({{ type }}). Dozvoljeni mime tipovi su {{ types }}. + + + This value should be {{ limit }} or less. + Ova vrijednost treba biti {{ limit }} ili manje. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Ova vrijednost je predugaÄka. Treba imati {{ limit }} znakova ili manje. + + + This value should be {{ limit }} or more. + Ova vrijednost treba biti {{ limit }} ili viÅ¡e. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Ova vrijednost je prekratka. Treba imati {{ limit }} znakova ili viÅ¡e. + + + This value should not be blank. + Ova vrijednost ne smije biti prazna. + + + This value should not be null. + Ova vrijednost ne smije biti null. + + + This value should be null. + Ova vrijednost treba biti null. + + + This value is not valid. + Ova vrijednost nije ispravna. + + + This value is not a valid time. + Ova vrijednost nije ispravno vrijeme. + + + This value is not a valid URL. + Ova vrijednost nije ispravan URL. + + + The two values should be equal. + Obje vrijednosti trebaju biti jednake. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Ova datoteka je prevelika. Najveća dozvoljena veliÄina je {{ limit }} {{ suffix }}. + + + The file is too large. + Ova datoteka je prevelika. + + + The file could not be uploaded. + Ova datoteka ne može biti prenesena. + + + This value should be a valid number. + Ova vrijednost treba biti ispravan broj. + + + This file is not a valid image. + Ova datoteka nije ispravna slika. + + + This is not a valid IP address. + Ovo nije ispravna IP adresa. + + + This value is not a valid language. + Ova vrijednost nije ispravan jezik. + + + This value is not a valid locale. + Ova vrijednost nije ispravana regionalna oznaka. + + + This value is not a valid country. + Ova vrijednost nije ispravna zemlja. + + + This value is already used. + Ova vrijednost je već iskoriÅ¡tena. + + + The size of the image could not be detected. + VeliÄina slike se ne može odrediti. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Å irina slike je prevelika ({{ width }}px). Najveća dozvoljena Å¡irina je {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Å irina slike je premala ({{ width }}px). Najmanja dozvoljena Å¡irina je {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Visina slike je prevelika ({{ height }}px). Najveća dozvoljena visina je {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Visina slike je premala ({{ height }}px). Najmanja dozvoljena visina je {{ min_height }}px. + + + This value should be the user's current password. + Ova vrijednost treba biti trenutna korisniÄka lozinka. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Ova vrijednost treba imati toÄno {{ limit }} znakova. + + + The file was only partially uploaded. + Datoteka je samo djelomiÄno prenesena. + + + No file was uploaded. + Niti jedna datoteka nije prenesena. + + + No temporary folder was configured in php.ini. + U php.ini datoteci nije konfiguriran privremeni folder. + + + Cannot write temporary file to disk. + Ne mogu zapisati privremenu datoteku na disk. + + + A PHP extension caused the upload to fail. + Prijenos datoteke nije uspio zbog PHP ekstenzije. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ova kolekcija treba sadržavati {{ limit }} ili viÅ¡e elemenata.|Ova kolekcija treba sadržavati {{ limit }} ili viÅ¡e elemenata.|Ova kolekcija treba sadržavati {{ limit }} ili viÅ¡e elemenata. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ova kolekcija treba sadržavati {{ limit }} ili manje elemenata.|Ova kolekcija treba sadržavati {{ limit }} ili manje elemenata.|Ova kolekcija treba sadržavati {{ limit }} ili manje elemenata. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ova kolekcija treba sadržavati toÄno {{ limit }} element.|Ova kolekcija treba sadržavati toÄno {{ limit }} elementa.|Ova kolekcija treba sadržavati toÄno {{ limit }} elemenata. + + + Invalid card number. + Neispravan broj kartice. + + + Unsupported card type or invalid card number. + Neispravan broj kartice ili tip kartice nije podržan. + + + This is not a valid International Bank Account Number (IBAN). + Ova vrijednost nije ispravan meÄ‘unarodni broj bankovnog raÄuna (IBAN). + + + This value is not a valid ISBN-10. + Ova vrijednost nije ispravan ISBN-10. + + + This value is not a valid ISBN-13. + Ova vrijednost nije ispravan ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Ova vrijednost nije ispravan ISBN-10 niti ISBN-13. + + + This value is not a valid ISSN. + Ova vrijednost nije ispravan ISSN. + + + This value is not a valid currency. + Ova vrijednost nije ispravna valuta. + + + This value should be equal to {{ compared_value }}. + Ova vrijednost bi trebala biti jednaka {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Ova vrijednost bi trebala biti veća od {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Ova vrijednost bi trebala biti veća ili jednaka od {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Ova vrijednost bi trebala biti {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Ova vrijednost bi trebala biti manja od {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Ova vrijednost bi trebala biti manja ili jednaka {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Ova vrijednost ne bi trebala biti {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Ova vrijednost ne bi trebala biti {{ compared_value_type }} {{ compared_value }}. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.hu.xlf b/core/vendor/symfony/validator/Resources/translations/validators.hu.xlf new file mode 100644 index 0000000..a972c02 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.hu.xlf @@ -0,0 +1,315 @@ + + + + + + This value should be false. + Ennek az értéknek hamisnak kell lennie. + + + This value should be true. + Ennek az értéknek igaznak kell lennie. + + + This value should be of type {{ type }}. + Ennek az értéknek {{ type }} típusúnak kell lennie. + + + This value should be blank. + Ennek az értéknek üresnek kell lennie. + + + The value you selected is not a valid choice. + A választott érték érvénytelen. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Legalább {{ limit }} értéket kell kiválasztani.|Legalább {{ limit }} értéket kell kiválasztani. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Legfeljebb {{ limit }} értéket lehet kiválasztani.|Legfeljebb {{ limit }} értéket lehet kiválasztani. + + + One or more of the given values is invalid. + A megadott értékek közül legalább egy érvénytelen. + + + This field was not expected. + Nem várt mezÅ‘. + + + This field is missing. + Ez a mezÅ‘ hiányzik. + + + This value is not a valid date. + Ez az érték nem egy érvényes dátum. + + + This value is not a valid datetime. + Ez az érték nem egy érvényes idÅ‘pont. + + + This value is not a valid email address. + Ez az érték nem egy érvényes e-mail cím. + + + The file could not be found. + A fájl nem található. + + + The file is not readable. + A fájl nem olvasható. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + A fájl túl nagy ({{ size }} {{ suffix }}). A legnagyobb megengedett méret {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + A fájl MIME típusa érvénytelen ({{ type }}). Az engedélyezett MIME típusok: {{ types }}. + + + This value should be {{ limit }} or less. + Ez az érték legfeljebb {{ limit }} lehet. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Ez az érték túl hosszú. Legfeljebb {{ limit }} karaktert tartalmazhat.|Ez az érték túl hosszú. Legfeljebb {{ limit }} karaktert tartalmazhat. + + + This value should be {{ limit }} or more. + Ez az érték legalább {{ limit }} kell, hogy legyen. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Ez az érték túl rövid. Legalább {{ limit }} karaktert kell tartalmaznia.|Ez az érték túl rövid. Legalább {{ limit }} karaktert kell tartalmaznia. + + + This value should not be blank. + Ez az érték nem lehet üres. + + + This value should not be null. + Ez az érték nem lehet null. + + + This value should be null. + Ennek az értéknek nullnak kell lennie. + + + This value is not valid. + Ez az érték nem érvényes. + + + This value is not a valid time. + Ez az érték nem egy érvényes idÅ‘pont. + + + This value is not a valid URL. + Ez az érték nem egy érvényes URL. + + + The two values should be equal. + A két értéknek azonosnak kell lennie. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + A fájl túl nagy. A megengedett maximális méret: {{ limit }} {{ suffix }}. + + + The file is too large. + A fájl túl nagy. + + + The file could not be uploaded. + A fájl nem tölthetÅ‘ fel. + + + This value should be a valid number. + Ennek az értéknek érvényes számnak kell lennie. + + + This file is not a valid image. + Ez a fájl nem egy érvényes kép. + + + This is not a valid IP address. + Ez az érték nem egy érvényes IP cím. + + + This value is not a valid language. + Ez az érték nem egy érvényes nyelv. + + + This value is not a valid locale. + Ez az érték nem egy érvényes területi beállítás. + + + This value is not a valid country. + Ez az érték nem egy érvényes ország. + + + This value is already used. + Ez az érték már használatban van. + + + The size of the image could not be detected. + A kép méretét nem lehet megállapítani. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + A kép szélessége túl nagy ({{ width }}px). A megengedett legnagyobb szélesség {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + A kép szélessége túl kicsi ({{ width }}px). Az elvárt legkisebb szélesség {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + A kép magassága túl nagy ({{ height }}px). A megengedett legnagyobb magasság {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + A kép magassága túl kicsi ({{ height }}px). Az elvárt legkisebb magasság {{ min_height }}px. + + + This value should be the user's current password. + Ez az érték a felhasználó jelenlegi jelszavával kell megegyezzen. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Ennek az értéknek pontosan {{ limit }} karaktert kell tartalmaznia.|Ennek az értéknek pontosan {{ limit }} karaktert kell tartalmaznia. + + + The file was only partially uploaded. + A fájl csak részben lett feltöltve. + + + No file was uploaded. + Nem lett fájl feltöltve. + + + No temporary folder was configured in php.ini. + Nincs ideiglenes könyvtár beállítva a php.ini-ben. + + + Cannot write temporary file to disk. + Az ideiglenes fájl nem írható a lemezre. + + + A PHP extension caused the upload to fail. + Egy PHP bÅ‘vítmény miatt a feltöltés nem sikerült. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ennek a gyűjteménynek legalább {{ limit }} elemet kell tartalmaznia.|Ennek a gyűjteménynek legalább {{ limit }} elemet kell tartalmaznia. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ez a gyűjtemény legfeljebb {{ limit }} elemet tartalmazhat.|Ez a gyűjtemény legfeljebb {{ limit }} elemet tartalmazhat. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ennek a gyűjteménynek pontosan {{ limit }} elemet kell tartalmaznia.|Ennek a gyűjteménynek pontosan {{ limit }} elemet kell tartalmaznia. + + + Invalid card number. + Érvénytelen kártyaszám. + + + Unsupported card type or invalid card number. + Nem támogatott kártyatípus vagy érvénytelen kártyaszám. + + + This is not a valid International Bank Account Number (IBAN). + Érvénytelen nemzetközi bankszámlaszám (IBAN). + + + This value is not a valid ISBN-10. + Ez az érték nem egy érvényes ISBN-10. + + + This value is not a valid ISBN-13. + Ez az érték nem egy érvényes ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Ez az érték nem egy érvényes ISBN-10 vagy ISBN-13. + + + This value is not a valid ISSN. + Ez az érték nem egy érvényes ISSN. + + + This value is not a valid currency. + Ez az érték nem egy érvényes pénznem. + + + This value should be equal to {{ compared_value }}. + Ez az érték legyen {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Ez az érték nagyobb legyen, mint {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Ez az érték nagyobb vagy egyenlÅ‘ legyen, mint {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Ez az érték ugyanolyan legyen, mint {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Ez az érték kisebb legyen, mint {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Ez az érték kisebb vagy egyenlÅ‘ legyen, mint {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Ez az érték ne legyen {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Ez az érték ne legyen ugyanolyan, mint {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + A képarány túl nagy ({{ ratio }}). A megengedett legnagyobb képarány {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + A képarány túl kicsi ({{ ratio }}). A megengedett legkisebb képarány {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + A kép négyzet alakú ({{ width }}x{{ height }}px). A négyzet alakú képek nem engedélyezettek. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + A kép fekvÅ‘ tájolású ({{ width }}x{{ height }}px). A fekvÅ‘ tájolású képek nem engedélyezettek. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + A kép álló tájolású ({{ width }}x{{ height }}px). Az álló tájolású képek nem engedélyezettek. + + + An empty file is not allowed. + Ãœres fájl nem megengedett. + + + The host could not be resolved. + Az állomásnevet nem lehet feloldani. + + + This value does not match the expected {{ charset }} charset. + Ez az érték nem az elvárt {{ charset }} karakterkódolást használja. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.hy.xlf b/core/vendor/symfony/validator/Resources/translations/validators.hy.xlf new file mode 100644 index 0000000..664c085 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.hy.xlf @@ -0,0 +1,187 @@ + + + + + + This value should be false. + Ô±Ö€ÕªÕ¥Ö„Õ¨ ÕºÕ¥Õ¿Ö„ Õ§ Õ¬Õ«Õ¶Õ« Õ¯Õ¥Õ²Õ®. + + + This value should be true. + Ô±Ö€ÕªÕ¥Ö„Õ¨ ÕºÕ¥Õ¿Ö„ Õ§ Õ¬Õ«Õ¶Õ« Õ³Õ·Õ´Õ¡Ö€Õ«Õ¿. + + + This value should be of type {{ type }}. + Ô±Ö€ÕªÕ¥Ö„Õ¨ ÕºÕ¥Õ¿Ö„ Õ§ Õ¬Õ«Õ¶Õ« {{ type }} Õ¿Õ¥Õ½Õ¡Õ¯Õ«. + + + This value should be blank. + Ô±Ö€ÕªÕ¥Ö„Õ¨ ÕºÕ¥Õ¿Ö„ Õ§ Õ¬Õ«Õ¶Õ« Õ¤Õ¡Õ¿Õ¡Ö€Õ¯. + + + The value you selected is not a valid choice. + ÕÕ¥Ö€ Õ¨Õ¶Õ¿Ö€Õ¡Õ® Õ¡Ö€ÕªÕ¥Ö„Õ¨ Õ¡Õ¶Õ©Õ¸Ö‚ÕµÕ¬Õ¡Õ¿Ö€Õ¥Õ¬Õ« Õ§. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Ô´Õ¸Ö‚Ö„ ÕºÕ¥Õ¿Ö„ Õ§ Õ¨Õ¶Õ¿Ö€Õ¥Ö„ Õ¡Õ´Õ¥Õ¶Õ¡Ö„Õ«Õ¹Õ¨ {{ limit }} Õ¿Õ¡Ö€Õ¢Õ¥Ö€Õ¡Õ¯Õ¶Õ¥Ö€. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Ô´Õ¸Ö‚Ö„ ÕºÕ¥Õ¿Ö„ Õ§ Õ¨Õ¶Õ¿Ö€Õ¥Ö„ Õ¸Õ¹ Õ¡Õ¾Õ¥Õ¬Õ« Ö„Õ¡Õ¶ {{ limit }} Õ¿Õ¡Ö€Õ¢Õ¥Ö€Õ¡Õ¯Õ¶Õ¥Ö€. + + + One or more of the given values is invalid. + Õ„Õ¥Õ¯ Õ¯Õ¡Õ´ Õ¡Õ¾Õ¥Õ¬Õ« Õ¿Ö€Õ¾Õ¡Õ® Õ¡Ö€ÕªÕ¥Ö„Õ¶Õ¥Ö€Õ¨ Õ¡Õ¶Õ©Õ¸Ö‚ÕµÕ¬Õ¡Õ¿Ö€Õ¥Õ¬Õ« Õ¥Õ¶. + + + This field was not expected. + Ô±ÕµÕ½ Õ¤Õ¡Õ·Õ¿Õ¨ Õ¹Õ« Õ½ÕºÕ¡Õ½Õ¾Õ¸Ö‚Õ´. + + + This field is missing. + Ô±ÕµÕ½ Õ¤Õ¡Õ·Õ¿Õ¨ Õ¢Õ¡ÖÕ¡Õ¯Õ¡ÕµÕ¸Ö‚Õ´ Õ§. + + + This value is not a valid date. + Ô±Ö€ÕªÕ¥Ö„Õ¨ Õ½Õ­Õ¡Õ¬ Õ¡Õ´Õ½Õ¡Õ©Õ«Õ¾ Õ§. + + + This value is not a valid datetime. + Ô±Õ´Õ½Õ¡Õ©Õ¾Õ« Ö‡ ÕªÕ¡Õ´Õ¡Õ¶Õ¡Õ¯Õ« Õ¡Ö€ÕªÕ¥Ö„Õ¨ Õ¡Õ¶Õ©Õ¸Ö‚ÕµÕ¬Õ¡Õ¿Ö€Õ¥Õ¬Õ« Õ§. + + + This value is not a valid email address. + Ô·Õ¬-ÖƒÕ¸Õ½Õ¿Õ« Õ¡Ö€ÕªÕ¥Ö„Õ¨ Õ¡Õ¶Õ©Õ¸Ö‚ÕµÕ¬Õ¡Õ¿Ö€Õ¥Õ¬Õ« Õ§. + + + The file could not be found. + Õ–Õ¡ÕµÕ¬Õ¨ Õ¹Õ« Õ£Õ¿Õ¶Õ¾Õ¥Õ¬. + + + The file is not readable. + Õ–Õ¡ÕµÕ¬Õ¨ Õ¡Õ¶Õ¨Õ¶Õ©Õ¥Õ¼Õ¶Õ¥Õ¬Õ« Õ§. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Õ–Õ¡ÕµÕ¬Õ¨ Õ¹Õ¡ÖƒÕ¡Õ¦Õ¡Õ¶Ö Õ´Õ¥Õ® Õ§ ({{ size }} {{ suffix }}): Õ„Õ¡Ö„Õ½Õ«Õ´Õ¡Õ¬ Õ©Õ¸Ö‚ÕµÕ¬Õ¡Õ¿Ö€Õ¥Õ¬Õ« Õ¹Õ¡ÖƒÕ½Õ¨Õ {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + MIME-Õ¿Õ¥Õ½Õ¡Õ¯Õ¨ Õ¡Õ¶Õ©Õ¸Ö‚ÕµÕ¬Õ¡Õ¿Ö€Õ¥Õ¬Õ« Õ§({{ type }}): Õ–Õ¡ÕµÕ¬Õ¥Ö€Õ« Õ©Õ¸Ö‚ÕµÕ¬Õ¡Õ¿Ö€Õ¥Õ¬Õ« MIME-Õ¿Õ¥Õ½Õ¡Õ¯Õ¶Õ¥Ö€Õ¶ Õ¥Õ¶: {{ types }}. + + + This value should be {{ limit }} or less. + Ô±Ö€ÕªÕ¥Ö„Õ¨ ÕºÕ¥Õ¿Ö„ Õ§ Õ¬Õ«Õ¶Õ« {{ limit }} Õ¯Õ¡Õ´ ÖƒÕ¸Ö„Ö€. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Ô±Ö€ÕªÕ¥Ö„Õ¨ Õ¹Õ¡ÖƒÕ¡Õ¦Õ¡Õ¶Ö Õ¥Ö€Õ¯Õ¡Ö€ Õ§: ÕŠÕ¥Õ¿Ö„ Õ§ Õ¬Õ«Õ¶Õ« {{ limit }} Õ¯Õ¡Õ´ Õ¡Õ¾Õ¥Õ¬ Õ½Õ«Õ´Õ¾Õ¸Õ¬Õ¶Õ¥Ö€. + + + This value should be {{ limit }} or more. + Ô±Ö€ÕªÕ¥Ö„Õ¨ ÕºÕ¥Õ¿ Õ§ Õ¬Õ«Õ¶Õ« {{ limit }} Õ¯Õ¡Õ´ Õ·Õ¡Õ¿. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Ô±Ö€ÕªÕ¥Ö„Õ¨ Õ¹Õ¡ÖƒÕ¡Õ¦Õ¡Õ¶Ö Õ¯Õ¡Ö€Õ³ Õ§: ÕŠÕ¥Õ¿Ö„ Õ§ Õ¬Õ«Õ¶Õ« {{ limit }} Õ¯Õ¡Õ´ Õ¡Õ¾Õ¥Õ¬Õ« Õ½Õ«Õ´Õ¾Õ¸Õ¬Õ¶Õ¥Ö€. + + + This value should not be blank. + Ô±Ö€ÕªÕ¥Ö„Õ¨ Õ¹ÕºÕ¥Õ¿Ö„ Õ§ Õ¤Õ¡Õ¿Õ¡Ö€Õ¯ Õ¬Õ«Õ¶Õ«. + + + This value should not be null. + Ô±Ö€ÕªÕ¥Ö„Õ¨ Õ¹ÕºÕ¥Õ¿Ö„ Õ§ Õ¬Õ«Õ¶Õ« null. + + + This value should be null. + Ô±Ö€ÕªÕ¥Ö„Õ¨ ÕºÕ¥Õ¿Ö„ Õ§ Õ¬Õ«Õ¶Õ« null. + + + This value is not valid. + Ô±Õ¶Õ©Õ¸Ö‚ÕµÕ¬Õ¡Õ¿Ö€Õ¥Õ¬Õ« Õ¡Ö€ÕªÕ¥Ö„. + + + This value is not a valid time. + ÔºÕ¡Õ´Õ¡Õ¶Õ¡Õ¯Õ« Õ¡Ö€ÕªÕ¥Ö„Õ¨ Õ¡Õ¶Õ©Õ¸Ö‚ÕµÕ¬Õ¡Õ¿Ö€Õ¥Õ¬Õ« Õ§. + + + This value is not a valid URL. + Ô±Ö€ÕªÕ¥Ö„Õ¨ URL Õ¹Õ§. + + + The two values should be equal. + ÔµÖ€Õ¯Õ¸Ö‚ Õ¡Ö€ÕªÕ¥Ö„Õ¶Õ¥Ö€Õ¨ ÕºÕ¥Õ¿Ö„ Õ§ Õ¶Õ¸Ö‚ÕµÕ¶Õ¨ Õ¬Õ«Õ¶Õ¥Õ¶. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Õ–Õ¡ÕµÕ¬Õ¨ Õ¹Õ¡ÖƒÕ¡Õ¦Õ¡Õ¶Ö Õ´Õ¥Õ® Õ§: Õ„Õ¡Ö„Õ½Õ«Õ´Õ¡Õ¬ Õ©Õ¸Ö‚ÕµÕ¬Õ¡Õ¿Ö€Õ¥Õ¬Õ« Õ¹Õ¡ÖƒÕ½Õ¨ {{ limit }} {{ suffix }} Õ§. + + + The file is too large. + Õ–Õ¡ÕµÕ¬Õ¨ Õ¹Õ¡ÖƒÕ¡Õ¦Õ¡Õ¶Ö Õ´Õ¥Õ® Õ§. + + + The file could not be uploaded. + Õ–Õ¡ÕµÕ¬Õ¨ Õ¹Õ« Õ¯Õ¡Ö€Õ¸Õ² Õ¢Õ¥Õ¼Õ¶Õ¾Õ¥Õ¬. + + + This value should be a valid number. + Ô±Ö€ÕªÕ¥Ö„Õ¨ ÕºÕ¥Õ¿Ö„ Õ§ Õ¬Õ«Õ¶Õ« Õ©Õ«Õ¾. + + + This value is not a valid country. + Ô±Ö€ÕªÕ¥Ö„Õ¨ ÕºÕ¥Õ¿Ö„ Õ§ Õ¬Õ«Õ¶Õ« Õ¥Ö€Õ¯Õ«Ö€. + + + This file is not a valid image. + Õ–Õ¡ÕµÕ¬Õ¨ Õ¶Õ¯Õ¡Ö€Õ« Õ©Õ¸Ö‚ÕµÕ¬Õ¡Õ¿Ö€Õ¥Õ¬Õ« Ö†Õ¸Ö€Õ´Õ¡Õ¿ Õ¹Õ§. + + + This is not a valid IP address. + Ô±Ö€ÕªÕ¥Ö„Õ¨ Õ©Õ¸Ö‚ÕµÕ¬Õ¡Õ¿Ö€Õ¥Õ¬Õ« IP Õ°Õ¡Õ½ÖÕ¥ Õ¹Õ§. + + + This value is not a valid language. + Ô±Ö€ÕªÕ¥Ö„Õ¨ Õ©Õ¸Ö‚ÕµÕ¬Õ¡Õ¿Ö€Õ¥Õ¬Õ« Õ¬Õ¥Õ¦Õ¸Ö‚ Õ¹Õ§. + + + This value is not a valid locale. + Ô±Ö€ÕªÕ¥Ö„Õ¨ Õ¹Õ« Õ°Õ¡Õ¶Õ¤Õ«Õ½Õ¡Õ¶Õ¸Ö‚Õ´ Õ©Õ¸Ö‚ÕµÕ¬Õ¡Õ¿Ö€Õ¥Õ¬Õ« Õ¿Õ¥Õ²Õ¡ÕµÕ¶Õ¡ÖÕ¸Ö‚Õ´. + + + This value is already used. + Ô±ÕµÕ¤ Õ¡Ö€ÕªÕ¥Ö„Õ¨ Õ¡Ö€Õ¤Õ¥Õ¶ Ö…Õ£Õ¿Õ¡Õ£Õ¸Ö€Õ®Õ¾Õ¸Ö‚Õ´ Õ§. + + + The size of the image could not be detected. + Õ†Õ¯Õ¡Ö€Õ« Õ¹Õ¡ÖƒÕ½Õ¥Ö€Õ¨ Õ¹Õ½Õ¿Õ¡ÖÕ¾Õ¥Ö Õ¸Ö€Õ¸Õ·Õ¥Õ¬. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Õ†Õ¯Õ¡Ö€Õ« Õ¬Õ¡ÕµÕ¶Õ¸Ö‚Õ©ÕµÕ¸Ö‚Õ¶Õ¨ Õ¹Õ¡ÖƒÕ¡Õ¦Õ¡Õ¶Ö Õ´Õ¥Õ® Õ§({{ width }}px). Õ„Õ¡Ö„Õ½Õ«Õ´Õ¡Õ¬ Õ¹Õ¡ÖƒÕ¶ Õ§ {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Õ†Õ¯Õ¡Ö€Õ« Õ¬Õ¡ÕµÕ¶Õ¸Ö‚Õ©ÕµÕ¸Ö‚Õ¶Õ¨ Õ¹Õ¡ÖƒÕ¡Õ¦Õ¡Õ¶Ö ÖƒÕ¸Ö„Ö€ Õ§ ({{ width }}px). Õ„Õ«Õ¶Õ«Õ´Õ¡Õ¬ Õ¹Õ¡ÖƒÕ¶ Õ§ {{ min_ width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Õ†Õ¯Õ¡Ö€Õ« Õ¢Õ¡Ö€Õ±Ö€Õ¸Ö‚Õ©ÕµÕ¸Ö‚Õ¶Õ¨ Õ¹Õ¡ÖƒÕ¡Õ¦Õ¡Õ¶Ö Õ´Õ¥Õ® Õ§ ({{ height }}px). Õ„Õ¡Ö„Õ½Õ«Õ´Õ¡Õ¬ Õ¹Õ¡ÖƒÕ¶ Õ§ {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Õ†Õ¯Õ¡Ö€Õ« Õ¢Õ¡Ö€Õ±Ö€Õ¸Ö‚Õ©ÕµÕ¸Ö‚Õ¶Õ¨ Õ¹Õ¡ÖƒÕ¡Õ¦Õ¡Õ¶Ö ÖƒÕ¸Ö„Ö€ Õ§ ({{ height }}px). Õ„Õ«Õ¶Õ«Õ´Õ¡Õ¬ Õ¹Õ¡ÖƒÕ¶ Õ§ {{ min_height }}px. + + + This value should be the user's current password. + Ô±ÕµÕ½ Õ¡Ö€ÕªÕ¥Ö„Õ¨ ÕºÕ¥Õ¿Ö„ Õ§ Õ¬Õ«Õ¶Õ« Ö…Õ£Õ¿Õ¡Õ£Õ¸Ö€Õ®Õ¸Õ²Õ« Õ¶Õ¥Ö€Õ¯Õ¡ Õ®Õ¡Õ®Õ¯Õ¡Õ£Õ«Ö€Õ¨. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Ô±ÕµÕ½ Õ¡Ö€ÕªÕ¥Ö„Õ¨ ÕºÕ¥Õ¿Ö„ Õ§ Õ¸Ö‚Õ¶Õ¥Õ¶Õ¡ Õ³Õ«Õ·Õ¿ {{ limit }} Õ½Õ«Õ´Õ¾Õ¸Õ¬Õ¶Õ¥Ö€. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.id.xlf b/core/vendor/symfony/validator/Resources/translations/validators.id.xlf new file mode 100644 index 0000000..742f4a1 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.id.xlf @@ -0,0 +1,283 @@ + + + + + + This value should be false. + Nilai ini harus bernilai salah. + + + This value should be true. + Nilai ini harus bernilai benar. + + + This value should be of type {{ type }}. + Nilai ini harus bertipe {{ type }}. + + + This value should be blank. + Nilai ini harus kosong. + + + The value you selected is not a valid choice. + Nilai yang dipilih tidak tepat. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Anda harus memilih paling tidak {{ limit }} pilihan. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Anda harus memilih paling banyak {{ limit }} pilihan. + + + One or more of the given values is invalid. + Satu atau lebih nilai yang diberikan tidak sah. + + + This field was not expected. + Bidang ini tidak diharapkan. + + + This field is missing. + Bidang ini hilang. + + + This value is not a valid date. + Nilai ini bukan merupakan tanggal yang sah. + + + This value is not a valid datetime. + Nilai ini bukan merupakan tanggal dan waktu yang sah. + + + This value is not a valid email address. + Nilai ini bukan alamat email yang sah. + + + The file could not be found. + Berkas tidak ditemukan. + + + The file is not readable. + Berkas tidak bisa dibaca. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Ukuran berkas terlalu besar ({{ size }} {{ suffix }}). Ukuran maksimum yang diizinkan adalah {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Jenis berkas ({{ type }}) tidak sah. Jenis berkas yang diijinkan adalah {{ types }}. + + + This value should be {{ limit }} or less. + Nilai ini harus {{ limit }} atau kurang. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Nilai ini terlalu panjang. Seharusnya {{ limit }} karakter atau kurang. + + + This value should be {{ limit }} or more. + Nilai ini harus {{ limit }} atau lebih. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Nilai ini terlalu pendek. Seharusnya {{ limit }} karakter atau lebih. + + + This value should not be blank. + Nilai ini tidak boleh kosong. + + + This value should not be null. + Nilai ini tidak boleh 'null'. + + + This value should be null. + Nilai ini harus 'null'. + + + This value is not valid. + Nilai ini tidak sah. + + + This value is not a valid time. + Nilai ini bukan merupakan waktu yang sah. + + + This value is not a valid URL. + Nilai ini bukan URL yang sah. + + + The two values should be equal. + Isi keduanya harus sama. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Ukuran berkas terlalu besar. Ukuran maksimum yang diijinkan adalah {{ limit }} {{ suffix }}. + + + The file is too large. + Ukuran berkas terlalu besar. + + + The file could not be uploaded. + Berkas tidak dapat diunggah. + + + This value should be a valid number. + Nilai ini harus angka yang sah. + + + This file is not a valid image. + Berkas ini tidak termasuk gambar. + + + This is not a valid IP address. + Ini bukan alamat IP yang sah. + + + This value is not a valid language. + Nilai ini bukan bahasa yang sah. + + + This value is not a valid locale. + Nilai ini bukan lokal yang sah. + + + This value is not a valid country. + Nilai ini bukan negara yang sah. + + + This value is already used. + Nilai ini sudah digunakan. + + + The size of the image could not be detected. + Ukuran dari gambar tidak bisa dideteksi. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Lebar gambar terlalu besar ({{ width }}px). Ukuran lebar maksimum adalah {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Lebar gambar terlalu kecil ({{ width }}px). Ukuran lebar minimum yang diharapkan adalah {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Tinggi gambar terlalu besar ({{ height }}px). Ukuran tinggi maksimum adalah {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Tinggi gambar terlalu kecil ({{ height }}px). Ukuran tinggi minimum yang diharapkan adalah {{ min_height }}px. + + + This value should be the user's current password. + Nilai ini harus kata sandi pengguna saat ini. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Nilai ini harus memiliki tepat {{ limit }} karakter. + + + The file was only partially uploaded. + Berkas hanya terunggah sebagian. + + + No file was uploaded. + Tidak ada berkas terunggah. + + + No temporary folder was configured in php.ini. + Direktori sementara tidak dikonfiguasi pada php.ini. + + + Cannot write temporary file to disk. + Tidak dapat menuliskan berkas sementara ke dalam media penyimpanan. + + + A PHP extension caused the upload to fail. + Sebuah ekstensi PHP menyebabkan kegagalan unggah. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Kumpulan ini harus memiliki {{ limit }} elemen atau lebih. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Kumpulan ini harus memiliki kurang dari {{ limit }} elemen. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Kumpulan ini harus memiliki tepat {{ limit }} elemen. + + + Invalid card number. + Nomor kartu tidak sah. + + + Unsupported card type or invalid card number. + Jenis kartu tidak didukung atau nomor kartu tidak sah. + + + This is not a valid International Bank Account Number (IBAN). + Ini bukan Nomor Rekening Bank Internasional (IBAN) yang sah. + + + This value is not a valid ISBN-10. + Nilai ini bukan ISBN-10 yang sah. + + + This value is not a valid ISBN-13. + Nilai ini bukan ISBN-13 yang sah. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Nilai ini bukan ISBN-10 maupun ISBN-13 yang sah. + + + This value is not a valid ISSN. + Nilai ini bukan ISSN yang sah. + + + This value is not a valid currency. + Nilai ini bukan mata uang yang sah. + + + This value should be equal to {{ compared_value }}. + Nilai ini seharusnya sama dengan {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Nilai ini seharusnya lebih dari {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Nilai ini seharusnya lebih dari atau sama dengan {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Nilai ini seharusnya identik dengan {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Nilai ini seharusnya kurang dari {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Nilai ini seharusnya kurang dari atau sama dengan {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Nilai ini seharusnya tidak sama dengan {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Nilai ini seharusnya tidak identik dengan {{ compared_value_type }} {{ compared_value }}. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.it.xlf b/core/vendor/symfony/validator/Resources/translations/validators.it.xlf new file mode 100644 index 0000000..5a411ea --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.it.xlf @@ -0,0 +1,307 @@ + + + + + + This value should be false. + Questo valore dovrebbe essere falso. + + + This value should be true. + Questo valore dovrebbe essere vero. + + + This value should be of type {{ type }}. + Questo valore dovrebbe essere di tipo {{ type }}. + + + This value should be blank. + Questo valore dovrebbe essere vuoto. + + + The value you selected is not a valid choice. + Questo valore dovrebbe essere una delle opzioni disponibili. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Si dovrebbe selezionare almeno {{ limit }} opzione.|Si dovrebbero selezionare almeno {{ limit }} opzioni. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Si dovrebbe selezionare al massimo {{ limit }} opzione.|Si dovrebbero selezionare al massimo {{ limit }} opzioni. + + + One or more of the given values is invalid. + Uno o più valori inseriti non sono validi. + + + This field was not expected. + Questo campo non è stato previsto. + + + This field is missing. + Questo campo è manca. + + + This value is not a valid date. + Questo valore non è una data valida. + + + This value is not a valid datetime. + Questo valore non è una data e ora valida. + + + This value is not a valid email address. + Questo valore non è un indirizzo email valido. + + + The file could not be found. + Non è stato possibile trovare il file. + + + The file is not readable. + Il file non è leggibile. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Il file è troppo grande ({{ size }} {{ suffix }}). La dimensione massima consentita è {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Il mime type del file non è valido ({{ type }}). I tipi permessi sono {{ types }}. + + + This value should be {{ limit }} or less. + Questo valore dovrebbe essere {{ limit }} o inferiore. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Questo valore è troppo lungo. Dovrebbe essere al massimo di {{ limit }} carattere.|Questo valore è troppo lungo. Dovrebbe essere al massimo di {{ limit }} caratteri. + + + This value should be {{ limit }} or more. + Questo valore dovrebbe essere {{ limit }} o superiore. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Questo valore è troppo corto. Dovrebbe essere almeno di {{ limit }} carattere.|Questo valore è troppo corto. Dovrebbe essere almeno di {{ limit }} caratteri. + + + This value should not be blank. + Questo valore non dovrebbe essere vuoto. + + + This value should not be null. + Questo valore non dovrebbe essere nullo. + + + This value should be null. + Questo valore dovrebbe essere nullo. + + + This value is not valid. + Questo valore non è valido. + + + This value is not a valid time. + Questo valore non è un'ora valida. + + + This value is not a valid URL. + Questo valore non è un URL valido. + + + The two values should be equal. + I due valori dovrebbero essere uguali. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Il file è troppo grande. La dimensione massima è {{ limit }} {{ suffix }}. + + + The file is too large. + Il file è troppo grande. + + + The file could not be uploaded. + Il file non può essere caricato. + + + This value should be a valid number. + Questo valore dovrebbe essere un numero. + + + This file is not a valid image. + Questo file non è una immagine valida. + + + This is not a valid IP address. + Questo valore non è un indirizzo IP valido. + + + This value is not a valid language. + Questo valore non è una lingua valida. + + + This value is not a valid locale. + Questo valore non è una impostazione regionale valida. + + + This value is not a valid country. + Questo valore non è una nazione valida. + + + This value is already used. + Questo valore è già stato utilizzato. + + + The size of the image could not be detected. + La dimensione dell'immagine non può essere determinata. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + La larghezza dell'immagine è troppo grande ({{ width }}px). La larghezza massima è di {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + La larghezza dell'immagine è troppo piccola ({{ width }}px). La larghezza minima è di {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + L'altezza dell'immagine è troppo grande ({{ height }}px). L'altezza massima è di {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + L'altezza dell'immagine è troppo piccola ({{ height }}px). L'altezza minima è di {{ min_height }}px. + + + This value should be the user's current password. + Questo valore dovrebbe essere la password attuale dell'utente. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Questo valore dovrebbe contenere esattamente {{ limit }} carattere.|Questo valore dovrebbe contenere esattamente {{ limit }} caratteri. + + + The file was only partially uploaded. + Il file è stato caricato solo parzialmente. + + + No file was uploaded. + Nessun file è stato caricato. + + + No temporary folder was configured in php.ini. + Nessuna cartella temporanea è stata configurata nel php.ini. + + + Cannot write temporary file to disk. + Impossibile scrivere il file temporaneo sul disco. + + + A PHP extension caused the upload to fail. + Un'estensione PHP ha causato il fallimento del caricamento. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Questa collezione dovrebbe contenere almeno {{ limit }} elemento.|Questa collezione dovrebbe contenere almeno {{ limit }} elementi. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Questa collezione dovrebbe contenere massimo {{ limit }} elemento.|Questa collezione dovrebbe contenere massimo {{ limit }} elementi. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Questa collezione dovrebbe contenere esattamente {{ limit }} elemento.|Questa collezione dovrebbe contenere esattamente {{ limit }} elementi. + + + Invalid card number. + Numero di carta non valido. + + + Unsupported card type or invalid card number. + Tipo di carta non supportato o numero non valido. + + + This is not a valid International Bank Account Number (IBAN). + Questo valore non è un IBAN (International Bank Account Number) valido. + + + This value is not a valid ISBN-10. + Questo valore non è un codice ISBN-10 valido. + + + This value is not a valid ISBN-13. + Questo valore non è un codice ISBN-13 valido. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Questo valore non è un codice ISBN-10 o ISBN-13 valido. + + + This value is not a valid ISSN. + Questo valore non è un codice ISSN valido. + + + This value is not a valid currency. + Questo valore non è una valuta valida. + + + This value should be equal to {{ compared_value }}. + Questo valore dovrebbe essere uguale a {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Questo valore dovrebbe essere maggiore di {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Questo valore dovrebbe essere maggiore o uguale a {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Questo valore dovrebbe essere identico a {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Questo valore dovrebbe essere minore di {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Questo valore dovrebbe essere minore o uguale a {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Questo valore dovrebbe essere diverso da {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Questo valore dovrebbe essere diverso da {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Il rapporto di aspetto dell'immagine è troppo grande ({{ ratio }}). Il rapporto massimo consentito è {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Il rapporto di aspetto dell'immagine è troppo piccolo ({{ ratio }}). Il rapporto minimo consentito è {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + L'immagine è quadrata ({{ width }}x{{ height }}px). Le immagini quadrate non sono consentite. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + L'immagine è orizzontale ({{ width }}x{{ height }}px). Le immagini orizzontali non sono consentite. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + L'immagine è verticale ({{ width }}x{{ height }}px). Le immagini verticali non sono consentite. + + + An empty file is not allowed. + Un file vuoto non è consentito. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.ja.xlf b/core/vendor/symfony/validator/Resources/translations/validators.ja.xlf new file mode 100644 index 0000000..63eecc0e1 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.ja.xlf @@ -0,0 +1,315 @@ + + + + + + This value should be false. + falseã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + This value should be true. + trueã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + This value should be of type {{ type }}. + åž‹ã¯{{ type }}ã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + This value should be blank. + 空ã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + The value you selected is not a valid choice. + 有効ãªé¸æŠžè‚¢ã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + {{ limit }}個以上é¸æŠžã—ã¦ãã ã•ã„。 + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + {{ limit }}個以内ã§é¸æŠžã—ã¦ãã ã•ã„。 + + + One or more of the given values is invalid. + 無効ãªé¸æŠžè‚¢ãŒå«ã¾ã‚Œã¦ã„ã¾ã™ã€‚ + + + This field was not expected. + ã“ã®ãƒ•ã‚£ãƒ¼ãƒ«ãƒ‰ã¯äºˆæœŸã•ã‚Œã¦ã„ã¾ã›ã‚“ã§ã—ãŸã€‚ + + + This field is missing. + ã“ã®ãƒ•ã‚£ãƒ¼ãƒ«ãƒ‰ã¯ã€æ¬ è½ã—ã¦ã„ã¾ã™ã€‚ + + + This value is not a valid date. + 有効ãªæ—¥ä»˜ã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + This value is not a valid datetime. + 有効ãªæ—¥æ™‚ã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + This value is not a valid email address. + 有効ãªãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + The file could not be found. + ファイルãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“。 + + + The file is not readable. + ファイルを読ã¿è¾¼ã‚ã¾ã›ã‚“。 + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + ファイルã®ã‚µã‚¤ã‚ºãŒå¤§ãã™ãŽã¾ã™({{ size }} {{ suffix }})。有効ãªæœ€å¤§ã‚µã‚¤ã‚ºã¯{{ limit }} {{ suffix }}ã§ã™ã€‚ + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + ファイルã®MIMEタイプãŒç„¡åŠ¹ã§ã™({{ type }})。有効ãªMIMEタイプã¯{{ types }}ã§ã™ã€‚ + + + This value should be {{ limit }} or less. + {{ limit }}以下ã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + 値ãŒé•·ã™ãŽã¾ã™ã€‚{{ limit }}文字以内ã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + This value should be {{ limit }} or more. + {{ limit }}以上ã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + 値ãŒçŸ­ã™ãŽã¾ã™ã€‚{{ limit }}文字以上ã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + This value should not be blank. + 空ã§ã‚ã£ã¦ã¯ãªã‚Šã¾ã›ã‚“。 + + + This value should not be null. + nullã§ã‚ã£ã¦ã¯ãªã‚Šã¾ã›ã‚“。 + + + This value should be null. + nullã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + This value is not valid. + 有効ãªå€¤ã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + This value is not a valid time. + 有効ãªæ™‚刻ã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + This value is not a valid URL. + 有効ãªURLã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + The two values should be equal. + 2ã¤ã®å€¤ãŒåŒã˜ã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + ファイルã®ã‚µã‚¤ã‚ºãŒå¤§ãã™ãŽã¾ã™ã€‚有効ãªæœ€å¤§ã‚µã‚¤ã‚ºã¯{{ limit }} {{ suffix }}ã§ã™ã€‚ + + + The file is too large. + ファイルã®ã‚µã‚¤ã‚ºãŒå¤§ãã™ãŽã¾ã™ã€‚ + + + The file could not be uploaded. + ファイルをアップロードã§ãã¾ã›ã‚“ã§ã—ãŸã€‚ + + + This value should be a valid number. + 有効ãªæ•°å­—ã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + This file is not a valid image. + ファイルãŒç”»åƒã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + This is not a valid IP address. + 有効ãªIPアドレスã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + This value is not a valid language. + 有効ãªè¨€èªžåã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + This value is not a valid locale. + 有効ãªãƒ­ã‚±ãƒ¼ãƒ«ã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + This value is not a valid country. + 有効ãªå›½åã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + This value is already used. + æ—¢ã«ä½¿ç”¨ã•ã‚Œã¦ã„ã¾ã™ã€‚ + + + The size of the image could not be detected. + ç”»åƒã®ã‚µã‚¤ã‚ºãŒæ¤œå‡ºã§ãã¾ã›ã‚“。 + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + ç”»åƒã®å¹…ãŒå¤§ãã™ãŽã¾ã™({{ width }}ピクセル)。{{ max_width }}ピクセルã¾ã§ã«ã—ã¦ãã ã•ã„。 + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + ç”»åƒã®å¹…ãŒå°ã•ã™ãŽã¾ã™({{ width }}ピクセル)。{{ min_width }}ピクセル以上ã«ã—ã¦ãã ã•ã„。 + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + ç”»åƒã®é«˜ã•ãŒå¤§ãã™ãŽã¾ã™({{ height }}ピクセル)。{{ max_height }}ピクセルã¾ã§ã«ã—ã¦ãã ã•ã„。 + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + ç”»åƒã®é«˜ã•ãŒå°ã•ã™ãŽã¾ã™({{ height }}ピクセル)。{{ min_height }}ピクセル以上ã«ã—ã¦ãã ã•ã„。 + + + This value should be the user current password. + ユーザーã®ç¾åœ¨ã®ãƒ‘スワードã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + ã¡ã‚‡ã†ã©{{ limit }}文字ã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + The file was only partially uploaded. + ファイルã®ã‚¢ãƒƒãƒ—ロードã¯å®Œå…¨ã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + No file was uploaded. + ファイルãŒã‚¢ãƒƒãƒ—ロードã•ã‚Œã¦ã„ã¾ã›ã‚“。 + + + No temporary folder was configured in php.ini. + php.iniã§ä¸€æ™‚フォルダãŒè¨­å®šã•ã‚Œã¦ã„ã¾ã›ã‚“。 + + + Cannot write temporary file to disk. + 一時ファイルをディスクã«æ›¸ã込むã“ã¨ãŒã§ãã¾ã›ã‚“。 + + + A PHP extension caused the upload to fail. + PHPæ‹¡å¼µã«ã‚ˆã£ã¦ã‚¢ãƒƒãƒ—ロードã«å¤±æ•—ã—ã¾ã—ãŸã€‚ + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + {{ limit }}個以上ã®è¦ç´ ã‚’å«ã‚“ã§ãªã‘ã‚Œã°ã„ã‘ã¾ã›ã‚“。 + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + è¦ç´ ã¯{{ limit }}個ã¾ã§ã§ã™ã€‚ + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + è¦ç´ ã¯ã¡ã‚‡ã†ã©{{ limit }}個ã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + Invalid card number. + 無効ãªã‚«ãƒ¼ãƒ‰ç•ªå·ã§ã™ã€‚ + + + Unsupported card type or invalid card number. + 未対応ã®ã‚«ãƒ¼ãƒ‰ç¨®é¡žåˆã¯ç„¡åŠ¹ãªã‚«ãƒ¼ãƒ‰ç•ªå·ã§ã™ã€‚ + + + This is not a valid International Bank Account Number (IBAN). + 有効ãªIBANコードã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + This value is not a valid ISBN-10. + 有効ãªISBN-10コードã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + This value is not a valid ISBN-13. + 有効ãªISBN-13コードã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + 有効ãªISBN-10コードåˆã¯ISBN-13コードã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + This value is not a valid ISSN. + 有効ãªISSNコードã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + This value is not a valid currency. + 有効ãªè²¨å¹£ã§ã¯ã‚ã‚Šã¾ã›ã‚“。 + + + This value should be equal to {{ compared_value }}. + {{ compared_value }}ã¨ç­‰ã—ããªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + This value should be greater than {{ compared_value }}. + {{ compared_value }}より大ãããªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + This value should be greater than or equal to {{ compared_value }}. + {{ compared_value }}以上ã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + {{ compared_value_type }}ã¨ã—ã¦ã®{{ compared_value }}ã¨ç­‰ã—ããªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + This value should be less than {{ compared_value }}. + {{ compared_value }}未満ã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + This value should be less than or equal to {{ compared_value }}. + {{ compared_value }}以下ã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 + + + This value should not be equal to {{ compared_value }}. + {{ compared_value }}ã¨ç­‰ã—ãã¦ã¯ã„ã‘ã¾ã›ã‚“。 + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + {{ compared_value_type }}ã¨ã—ã¦ã®{{ compared_value }}ã¨ç­‰ã—ãã¦ã¯ã„ã‘ã¾ã›ã‚“。 + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + ç”»åƒã®ã‚¢ã‚¹ãƒšã‚¯ãƒˆæ¯”ãŒå¤§ãã™ãŽã¾ã™({{ ratio }})。{{ max_ratio }}ã¾ã§ã«ã—ã¦ãã ã•ã„。 + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + ç”»åƒã®ã‚¢ã‚¹ãƒšã‚¯ãƒˆæ¯”ãŒå°ã•ã™ãŽã¾ã™({{ ratio }})。{{ min_ratio }}以上ã«ã—ã¦ãã ã•ã„。 + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + ç”»åƒãŒæ­£æ–¹å½¢ã«ãªã£ã¦ã„ã¾ã™({{ width }}x{{ height }}ピクセル)。正方形ã®ç”»åƒã¯è¨±å¯ã•ã‚Œã¦ã„ã¾ã›ã‚“。 + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + ç”»åƒãŒæ¨ªå‘ãã«ãªã£ã¦ã„ã¾ã™({{ width }}x{{ height }}ピクセル)。横å‘ãã®ç”»åƒã¯è¨±å¯ã•ã‚Œã¦ã„ã¾ã›ã‚“。 + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + ç”»åƒãŒç¸¦å‘ãã«ãªã£ã¦ã„ã¾ã™({{ width }}x{{ height }}ピクセル)。縦å‘ãã®ç”»åƒã¯è¨±å¯ã•ã‚Œã¦ã„ã¾ã›ã‚“。 + + + An empty file is not allowed. + 空ã®ãƒ•ã‚¡ã‚¤ãƒ«ã¯è¨±å¯ã•ã‚Œã¦ã„ã¾ã›ã‚“。 + + + The host could not be resolved. + ホストを解決ã§ãã¾ã›ã‚“ã§ã—ãŸã€‚ + + + This value does not match the expected {{ charset }} charset. + ã“ã®å€¤ã¯äºˆæœŸã•ã‚Œã‚‹æ–‡å­—コード({{ charset }})ã¨ç•°ãªã‚Šã¾ã™ã€‚ + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.lb.xlf b/core/vendor/symfony/validator/Resources/translations/validators.lb.xlf new file mode 100644 index 0000000..8281c7c --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.lb.xlf @@ -0,0 +1,303 @@ + + + + + + This value should be false. + Dëse Wäert sollt falsch sinn. + + + This value should be true. + Dëse Wäert sollt wouer sinn. + + + This value should be of type {{ type }}. + Dëse Wäert sollt vum Typ {{ type }} sinn. + + + This value should be blank. + Dëse Wäert sollt eidel sinn. + + + The value you selected is not a valid choice. + Dëse Wäert sollt enger vun de Wielméiglechkeeten entspriechen. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Dir sollt mindestens {{ limit }} Méiglechkeete wielen. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Dir sollt héchstens {{ limit }} Méiglechkeete wielen. + + + One or more of the given values is invalid. + Een oder méi vun de Wäerter ass ongëlteg. + + + The fields {{ fields }} were not expected. + D'Felder {{ fields }} goufen net erwaart. + + + The fields {{ fields }} are missing. + D'Felder {{ fields }} feelen. + + + This value is not a valid date. + Dëse Wäert entsprécht kenger gëlteger Datumsangab. + + + This value is not a valid datetime. + Dëse Wäert entsprécht kenger gëlteger Datums- an Zäitangab. + + + This value is not a valid email address. + Dëse Wäert ass keng gëlteg Email-Adress. + + + The file could not be found. + De Fichier gouf net fonnt. + + + The file is not readable. + De Fichier ass net liesbar. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + De Fichier ass ze grouss ({{ size }} {{ suffix }}). Déi zougeloosse Maximalgréisst bedréit {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Den Typ vum Fichier ass ongëlteg ({{ type }}). Erlaabten Type sinn {{ types }}. + + + This value should be {{ limit }} or less. + Dëse Wäert soll méi kleng oder gläich {{ limit }} sinn. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Dës Zeecheketten ass ze laang. Se sollt héchstens {{ limit }} Zeechen hunn. + + + This value should be {{ limit }} or more. + Dëse Wäert sollt méi grouss oder gläich {{ limit }} sinn. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Dës Zeecheketten ass ze kuerz. Se sollt mindestens {{ limit }} Zeechen hunn. + + + This value should not be blank. + Dëse Wäert sollt net eidel sinn. + + + This value should not be null. + Dëst sollt keen Null-Wäert sinn. + + + This value should be null. + Dëst sollt keen Null-Wäert sinn. + + + This value is not valid. + Dëse Wäert ass net gëlteg. + + + This value is not a valid time. + Dëse Wäert entsprécht kenger gëlteger Zäitangab. + + + This value is not a valid URL. + Dëse Wäert ass keng gëlteg URL. + + + The two values should be equal. + Béid Wäerter sollten identesch sinn. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + De fichier ass ze grouss. Déi maximal Gréisst dierf {{ limit }} {{ suffix }} net depasséieren. + + + The file is too large. + De Fichier ass ze grouss. + + + The file could not be uploaded. + De Fichier konnt net eropgeluede ginn. + + + This value should be a valid number. + Dëse Wäert sollt eng gëlteg Zuel sinn. + + + This file is not a valid image. + Dëse Fichier ass kee gëltegt Bild. + + + This is not a valid IP address. + Dëst ass keng gëlteg IP-Adress. + + + This value is not a valid language. + Dëse Wäert aentsprécht kenger gëlteger Sprooch. + + + This value is not a valid locale. + Dëse Wäert entsprécht kengem gëltege Gebittsschema. + + + This value is not a valid country. + Dëse Wäert entsprécht kengem gëltege Land. + + + This value is already used. + Dëse Wäert gëtt scho benotzt. + + + The size of the image could not be detected. + D'Gréisst vum Bild konnt net detektéiert ginn. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + D'Breet vum Bild ass ze grouss ({{ width }}px). Déi erlaabte maximal Breet ass {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + D'Breet vum Bild ass ze kleng ({{ width }}px). Déi minimal Breet ass {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + D'Héicht vum Bild ass ze grouss ({{ height }}px). Déi erlaabte maximal Héicht ass {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + D'Héicht vum Bild ass ze kleng ({{ height }}px). Déi minimal Héicht ass {{ min_height }}px. + + + This value should be the user's current password. + Dëse Wäert sollt dem aktuelle Benotzerpasswuert entspriechen. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Dëse Wäert sollt exactly {{ limit }} Buschtaf hunn.|Dëse Wäert sollt exakt {{ limit }} Buschtawen hunn. + + + The file was only partially uploaded. + De Fichier gouf just deelweis eropgelueden. + + + No file was uploaded. + Et gouf kee Fichier eropgelueden. + + + No temporary folder was configured in php.ini. + Et gouf keen temporären Dossier an der php.ini konfiguréiert. + + + Cannot write temporary file to disk. + Den temporäre Fichier kann net gespäichert ginn. + + + A PHP extension caused the upload to fail. + Eng PHP-Erweiderung huet den Upload verhënnert. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Dës Sammlung sollt {{ limit }} oder méi Elementer hunn. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Dës Sammlung sollt {{ limit }} oder manner Elementer hunn. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Dës Sammlung sollt exakt {{ limit }} Element hunn.|Dës Sammlung sollt exakt {{ limit }} Elementer hunn. + + + Invalid card number. + Ongëlteg Kaartennummer. + + + Unsupported card type or invalid card number. + Net ënnerstëtzte Kaartentyp oder ongëlteg Kaartennummer. + + + This is not a valid International Bank Account Number (IBAN). + Dëst ass keng gëlteg IBAN-Kontonummer. + + + This value is not a valid ISBN-10. + Dëse Wäert ass keng gëlteg ISBN-10. + + + This value is not a valid ISBN-13. + Dëse Wäert ass keng gëlteg ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Dëse Wäert ass weder eng gëlteg ISBN-10 nach eng gëlteg ISBN-13. + + + This value is not a valid ISSN. + Dëse Wäert ass keng gëlteg ISSN. + + + This value is not a valid currency. + Dëse Wäert ass keng gëlteg Währung. + + + This value should be equal to {{ compared_value }}. + Dëse Wäert sollt {{ compared_value }} sinn. + + + This value should be greater than {{ compared_value }}. + Dëse Wäert sollt méi grouss wéi {{ compared_value }} sinn. + + + This value should be greater than or equal to {{ compared_value }}. + Dëse Wäert sollt méi grouss wéi oder gläich {{ compared_value }} sinn. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Dëse Wäert sollt identesch si mat {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Dëse Wäert sollt méi kleng wéi {{ compared_value }} sinn. + + + This value should be less than or equal to {{ compared_value }}. + Dëse Wäert sollt méi kleng wéi oder gläich {{ compared_value }} sinn. + + + This value should not be equal to {{ compared_value }}. + Dëse Wäert sollt net {{ compared_value }} sinn. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Dëse Wäert sollt net identesch si mat {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + D'Säiteverhältnis vum Bild ass ze grouss ({{ ratio }}). Den erlaabte Maximalwäert ass {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + D'Säiteverhältnis vum Bild ass ze kleng ({{ ratio }}). Den erwaarte Minimalwäert ass {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + D'Bild ass quadratesch ({{ width }}x{{ height }}px). Quadratesch Biller sinn net erlaabt. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + D'Bild ass am Queeschformat ({{ width }}x{{ height }}px). Biller am Queeschformat sinn net erlaabt. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + D'Bild ass am Héichformat ({{ width }}x{{ height }}px). Biller am Héichformat sinn net erlaabt. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.lt.xlf b/core/vendor/symfony/validator/Resources/translations/validators.lt.xlf new file mode 100644 index 0000000..a556c45 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.lt.xlf @@ -0,0 +1,307 @@ + + + + + + This value should be false. + ReikÅ¡mÄ— turi bÅ«ti neigiama. + + + This value should be true. + ReikÅ¡mÄ— turi bÅ«ti teigiama. + + + This value should be of type {{ type }}. + Å ios reikÅ¡mÄ—s tipas turi bÅ«ti {{ type }}. + + + This value should be blank. + Å i reikÅ¡mÄ— turi bÅ«ti tuÅ¡Äia. + + + The value you selected is not a valid choice. + Neteisingas pasirinkimas. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Turite pasirinkti bent {{ limit }} variantÄ….|Turite pasirinkti bent {{ limit }} variantus.|Turite pasirinkti bent {{ limit }} variantų. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Turite pasirinkti ne daugiau kaip {{ limit }} variantÄ….|Turite pasirinkti ne daugiau kaip {{ limit }} variantus.|Turite pasirinkti ne daugiau kaip {{ limit }} variantų. + + + One or more of the given values is invalid. + Viena ar daugiau įvestų reikÅ¡mių yra netinkamos. + + + This field was not expected. + Nebuvo tikimasi Å is laukas. + + + This field is missing. + Å iame lauke yra dingÄ™s. + + + This value is not a valid date. + Å i reikÅ¡mÄ— nÄ—ra data. + + + This value is not a valid datetime. + Å i reikÅ¡mÄ— nera data ir laikas. + + + This value is not a valid email address. + Å i reikÅ¡mÄ— nÄ—ra tinkamas el. paÅ¡to adresas. + + + The file could not be found. + Byla nerasta. + + + The file is not readable. + Negalima nuskaityti bylos. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Byla yra per didelÄ— ({{ size }} {{ suffix }}). Maksimalus dydis {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Netinkamas bylos tipas (mime type) ({{ type }}). Galimi bylų tipai {{ types }}. + + + This value should be {{ limit }} or less. + ReikÅ¡mÄ— turi bÅ«ti {{ limit }} arba mažiau. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Per didelis simbolių skaiÄius. Turi susidaryti iÅ¡ {{ limit }} arba mažiau simbolių.|Per didelis simbolių skaiÄius. Turi susidaryti iÅ¡ {{ limit }} arba mažiau simbolių.|Per didelis simbolių skaiÄius. Turi susidaryti iÅ¡ {{ limit }} arba mažiau simbolių. + + + This value should be {{ limit }} or more. + ReikÅ¡mÄ— turi bÅ«ti {{ limit }} arba daugiau. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Per mažas simbolių skaiÄius. Turi susidaryti iÅ¡ {{ limit }} arba daugiau simbolių.|Per mažas simbolių skaiÄius. Turi susidaryti iÅ¡ {{ limit }} arba daugiau simbolių.|Per mažas simbolių skaiÄius. Turi susidaryti iÅ¡ {{ limit }} arba daugiau simbolių. + + + This value should not be blank. + Å i reikÅ¡mÄ— negali bÅ«ti tuÅ¡Äia. + + + This value should not be null. + Å i reikÅ¡mÄ— negali bÅ«ti null. + + + This value should be null. + Å i reikÅ¡mÄ— turi bÅ«ti null. + + + This value is not valid. + Netinkama reikÅ¡mÄ—. + + + This value is not a valid time. + Å i reikÅ¡mÄ— nÄ—ra laikas. + + + This value is not a valid URL. + Å i reikÅ¡mÄ— nÄ—ra tinkamas interneto adresas. + + + The two values should be equal. + Abi reikÅ¡mÄ—s turi bÅ«ti identiÅ¡kos. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Byla yra per didelÄ—. Maksimalus dydis yra {{ limit }} {{ suffix }}. + + + The file is too large. + Byla per didelÄ—. + + + The file could not be uploaded. + Byla negali bÅ«ti įkelta. + + + This value should be a valid number. + Å i reikÅ¡mÄ— turi bÅ«ti skaiÄius. + + + This value is not a valid country. + Å i reikÅ¡mÄ— nÄ—ra tinkama Å¡alis. + + + This file is not a valid image. + Byla nÄ—ra paveikslÄ—lis. + + + This is not a valid IP address. + Å i reikÅ¡mÄ— nÄ—ra tinkamas IP adresas. + + + This value is not a valid language. + Å i reikÅ¡mÄ— nÄ—ra tinkama kalba. + + + This value is not a valid locale. + Å i reikÅ¡mÄ— nÄ—ra tinkama lokalÄ—. + + + This value is already used. + Å i reikÅ¡mÄ— jau yra naudojama. + + + The size of the image could not be detected. + Nepavyko nustatyti nuotraukos dydžio. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Nuotraukos plotis per didelis ({{ width }}px). Maksimalus leidžiamas plotis yra {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Nuotraukos plotis per mažas ({{ width }}px). Minimalus leidžiamas plotis yra {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Nuotraukos aukÅ¡tis per didelis ({{ height }}px). Maksimalus leidžiamas aukÅ¡tis yra {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Nuotraukos aukÅ¡tis per mažas ({{ height }}px). Minimalus leidžiamas aukÅ¡tis yra {{ min_height }}px. + + + This value should be the user's current password. + Å i reikÅ¡mÄ— turi sutapti su dabartiniu naudotojo slaptažodžiu. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Å i reikÅ¡mÄ— turi turÄ—ti lygiai {{ limit }} simbolį.|Å i reikÅ¡mÄ— turi turÄ—ti lygiai {{ limit }} simbolius.|Å i reikÅ¡mÄ— turi turÄ—ti lygiai {{ limit }} simbolių. + + + The file was only partially uploaded. + Failas buvo tik dalinai įkeltas. + + + No file was uploaded. + Nebuvo įkelta jokių failų. + + + No temporary folder was configured in php.ini. + NÄ—ra sukonfiguruoto jokio laikino katalogo php.ini faile. + + + Cannot write temporary file to disk. + Nepavyko iÅ¡saugoti laikino failo. + + + A PHP extension caused the upload to fail. + PHP plÄ—tinys sutrukdÄ— failo įkÄ—limÄ… ir jis nepavyko. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + SÄ…raÅ¡e turi bÅ«ti {{ limit }} arba daugiau įrašų.|SÄ…raÅ¡e turi bÅ«ti {{ limit }} arba daugiau įrašų.|SÄ…raÅ¡e turi bÅ«ti {{ limit }} arba daugiau įrašų. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + SÄ…raÅ¡e turi bÅ«ti {{ limit }} arba mažiau įrašų.|SÄ…raÅ¡e turi bÅ«ti {{ limit }} arba mažiau įrašų.|SÄ…raÅ¡e turi bÅ«ti {{ limit }} arba mažiau įrašų. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + SÄ…raÅ¡e turi bÅ«ti lygiai {{ limit }} įraÅ¡as.|SÄ…raÅ¡e turi bÅ«ti lygiai {{ limit }} įraÅ¡ai.|SÄ…raÅ¡e turi bÅ«ti lygiai {{ limit }} įrašų. + + + Invalid card number. + Klaidingas kortelÄ—s numeris. + + + Unsupported card type or invalid card number. + KortelÄ—s tipas nepalaikomas arba klaidingas kortelÄ—s numeris. + + + This is not a valid International Bank Account Number (IBAN). + Å i reiÅ¡mÄ— neatitinka tarptautinio banko sÄ…skaitos numerio formato (IBAN). + + + This value is not a valid ISBN-10. + Å i reikÅ¡mÄ— neatitinka ISBN-10 formato. + + + This value is not a valid ISBN-13. + Å i reikÅ¡mÄ— neatitinka ISBN-13 formato. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Å i reikÅ¡mÄ— neatitinka nei ISBN-10, nei ISBN-13 formato. + + + This value is not a valid ISSN. + Å i reiÅ¡mÄ— neatitinka ISSN formato. + + + This value is not a valid currency. + Netinkamas valiutos formatas. + + + This value should be equal to {{ compared_value }}. + Å i reikÅ¡mÄ— turi bÅ«ti lygi {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Å i reikÅ¡mÄ— turi bÅ«ti didesnÄ— už {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Å i reikÅ¡mÄ— turi bÅ«ti didesnÄ— už arba lygi {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Å i reikÅ¡mÄ— turi bÅ«ti identiÅ¡ka {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Å i reikÅ¡mÄ— turi bÅ«ti mažesnÄ— už {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Å i reikÅ¡mÄ— turi bÅ«ti mažesnÄ— už arba lygi {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Å i reikÅ¡mÄ— neturi bÅ«ti lygi {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Å i reikÅ¡mÄ— neturi bÅ«ti identiÅ¡ka {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Nuotraukos santykis yra per didelis ({{ ratio }}). Didžiausias leistinas santykis yra {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Nuotraukos santykis yra per mažas ({{ ratio }}). Mažiausias leistinas santykis yra {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Nuotrauka yra kvadratinÄ— ({{ width }}x{{ height }}px). KvadratinÄ—s nuotraukos nÄ—ra leistinos. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Nuotrauka orientuota į plotį ({{ width }}x{{ height }}px). Nuotraukos orientuotos į plotį nÄ—ra leistinos. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Nuotrauka orientuota į aukÅ¡tį ({{ width }}x{{ height }}px). Nuotraukos orientuotos į aukÅ¡tį nÄ—ra leistinos. + + + An empty file is not allowed. + Failas negali bÅ«ti tuÅ¡Äias. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.mn.xlf b/core/vendor/symfony/validator/Resources/translations/validators.mn.xlf new file mode 100644 index 0000000..dfe7eeb --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.mn.xlf @@ -0,0 +1,151 @@ + + + + + + This value should be false. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° буруу байх Ñ‘Ñтой. + + + This value should be true. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° үнÑн байх Ñ‘Ñтой. + + + This value should be of type {{ type }}. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° {{ type }} -н төрөл байх Ñ‘Ñтой. + + + This value should be blank. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° хооÑон байх Ñ‘Ñтой. + + + The value you selected is not a valid choice. + СонгоÑон утга буруу байна. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Хамгийн багадаа {{ limit }} утга ÑонгогдÑон байх Ñ‘Ñтой. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Хамгийн ихдÑÑ {{ limit }} утга Ñонгогдох боломжтой. + + + One or more of the given values is invalid. + ӨгөгдÑөн нÑг ÑÑвÑл нÑгÑÑÑ Ð¾Ð»Ð¾Ð½ утга буруу байна. + + + This field was not expected. + Ð­Ð½Ñ Ñ‚Ð°Ð»Ð±Ð°Ñ€ нь хүлÑÑгдÑж байÑан юм. + + + This field is missing. + Ð­Ð½Ñ Ñ‚Ð°Ð»Ð±Ð°Ñ€ нь алга болÑон байна. + + + This value is not a valid date. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° буруу date төрөл байна . + + + This value is not a valid datetime. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° буруу цаг төрөл байна. + + + This value is not a valid email address. + И-майл хаÑг буруу байна. + + + The file could not be found. + Файл олдÑонгүй. + + + The file is not readable. + Файл уншигдахуйц биш байна. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Файл Ñ…ÑÑ‚Ñрхий том байна ({{ size }} {{ suffix }}). Зөвшөөрөгдөх дÑÑд Ñ…ÑмжÑÑ {{ limit }} {{ suffix }} байна. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Файлын MIME-төрөл нь буруу байна ({{ type }}). Зөвшөөрөгдөх MIME-төрлүүд {{ types }}. + + + This value should be {{ limit }} or less. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° {{ limit }} юмуу ÑÑвÑл бага байна. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° Ñ…ÑÑ‚Ñрхий урт байна. {{ limit }} Ñ‚ÑмдÑгтийн урттай юмуу ÑÑвÑл бага байна. + + + This value should be {{ limit }} or more. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° {{ limit }} юмуу ÑÑвÑл их байна. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° Ñ…ÑÑ‚Ñрхий богино байна. {{ limit }} Ñ‚ÑмдÑгт ÑÑвÑл их байна. + + + This value should not be blank. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° хооÑон байж болохгүй. + + + This value should not be null. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° null байж болохгүй. + + + This value should be null. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° null байна. + + + This value is not valid. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° буруу байна. + + + This value is not a valid time. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° буруу цаг төрөл байна. + + + This value is not a valid URL. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° буруу URL байна . + + + The two values should be equal. + Хоёр утгууд ижил байх Ñ‘Ñтой. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Файл Ñ…ÑÑ‚Ñрхий том байна. Зөвшөөрөгдөх дÑÑд Ñ…ÑмжÑÑ Ð½ÑŒ {{ limit }} {{ suffix }} байна. + + + The file is too large. + Файл Ñ…ÑÑ‚Ñрхий том байна. + + + The file could not be uploaded. + Файл upload хийгдÑÑнгүй. + + + This value should be a valid number. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° зөвхөн тоо байна. + + + This value is not a valid country. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° үнÑн бодит ÑƒÐ»Ñ Ð±Ð¸Ñˆ байна. + + + This file is not a valid image. + Файл зураг биш байна. + + + This is not a valid IP address. + IP хаÑг зөв биш байна. + + + This value is not a valid language. + Ð­Ð½Ñ ÑƒÑ‚Ð³Ð° үнÑн зөв Ñ…Ñл биш байна . + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.nb.xlf b/core/vendor/symfony/validator/Resources/translations/validators.nb.xlf new file mode 100644 index 0000000..a8b790c --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.nb.xlf @@ -0,0 +1,155 @@ + + + + + + This value should be false. + Verdien skal være falsk. + + + This value should be true. + Verdien skal være sann. + + + This value should be of type {{ type }}. + Verdien skal være av typen {{ type }}. + + + This value should be blank. + Verdien skal være blank. + + + The value you selected is not a valid choice. + Verdien skal være en av de gitte valg. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Du skal velge minst {{ limit }} valg. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Du kan maks velge {{ limit }} valg. + + + One or more of the given values is invalid. + En eller flere av de oppgitte verdier er ugyldige. + + + This field was not expected. + Dette feltet ikke var forventet. + + + This field is missing. + Dette feltet mangler. + + + This value is not a valid date. + Verdien er ikke en gyldig dato. + + + This value is not a valid datetime. + Verdien er ikke en gyldig dato og tid. + + + This value is not a valid email address. + Verdien er ikke en gyldig e-mail adresse. + + + The file could not be found. + Filen kunne ikke finnes. + + + The file is not readable. + Filen kan ikke leses. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Filen er for stor ({{ size }} {{ suffix }}). Tilatte maksimale størrelse {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Mimetypen av filen er ugyldig ({{ type }}). Tilatte mimetyper er {{ types }}. + + + This value should be {{ limit }} or less. + Verdien skal være {{ limit }} eller mindre. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Verdien er for lang. Den skal ha {{ limit }} bokstaver eller mindre. + + + This value should be {{ limit }} or more. + Verdien skal være {{ limit }} eller mer. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Verdien er for kort. Den skal ha {{ limit }} tegn eller flere. + + + This value should not be blank. + Verdien mÃ¥ ikke være blank. + + + This value should not be null. + Verdien mÃ¥ ikke være tom (null). + + + This value should be null. + Verdien skal være tom (null). + + + This value is not valid. + Verdien er ikke gyldig. + + + This value is not a valid time. + Verdien er ikke en gyldig tid. + + + This value is not a valid URL. + Verdien er ikke en gyldig URL. + + + The two values should be equal. + De to verdier skal være ens. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Filen er for stor. Den maksimale størrelse er {{ limit }} {{ suffix }}. + + + The file is too large. + Filen er for stor. + + + The file could not be uploaded. + Filen kunne ikke lastes opp. + + + This value should be a valid number. + Denne verdi skal være et gyldig tall. + + + This file is not a valid image. + Denne filen er ikke et gyldig bilde. + + + This is not a valid IP address. + Dette er ikke en gyldig IP adresse. + + + This value is not a valid language. + Denne verdi er ikke et gyldig sprÃ¥k. + + + This value is not a valid locale. + Denne verdi er ikke en gyldig lokalitet. + + + This value is not a valid country. + Denne verdi er ikke et gyldig land. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.nl.xlf b/core/vendor/symfony/validator/Resources/translations/validators.nl.xlf new file mode 100644 index 0000000..c2372c9 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.nl.xlf @@ -0,0 +1,311 @@ + + + + + + This value should be false. + Deze waarde mag niet waar zijn. + + + This value should be true. + Deze waarde moet waar zijn. + + + This value should be of type {{ type }}. + Deze waarde moet van het type {{ type }} zijn. + + + This value should be blank. + Deze waarde moet leeg zijn. + + + The value you selected is not a valid choice. + De geselecteerde waarde is geen geldige optie. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Selecteer ten minste {{ limit }} optie.|Selecteer ten minste {{ limit }} opties. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Selecteer maximaal {{ limit }} optie.|Selecteer maximaal {{ limit }} opties. + + + One or more of the given values is invalid. + Eén of meer van de ingegeven waarden zijn ongeldig. + + + This field was not expected. + Dit veld was niet verwacht. + + + This field is missing. + Dit veld ontbreekt. + + + This value is not a valid date. + Deze waarde is geen geldige datum. + + + This value is not a valid datetime. + Deze waarde is geen geldige datum en tijd. + + + This value is not a valid email address. + Deze waarde is geen geldig e-mailadres. + + + The file could not be found. + Het bestand is niet gevonden. + + + The file is not readable. + Het bestand is niet leesbaar. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Het bestand is te groot ({{ size }} {{ suffix }}). Toegestane maximum grootte is {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Het mime type van het bestand is ongeldig ({{ type }}). Toegestane mime types zijn {{ types }}. + + + This value should be {{ limit }} or less. + Deze waarde moet {{ limit }} of minder zijn. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Deze waarde is te lang. Hij mag maximaal {{ limit }} teken bevatten.|Deze waarde is te lang. Hij mag maximaal {{ limit }} tekens bevatten. + + + This value should be {{ limit }} or more. + Deze waarde moet {{ limit }} of meer zijn. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Deze waarde is te kort. Hij moet tenminste {{ limit }} teken bevatten.|Deze waarde is te kort. Hij moet tenminste {{ limit }} tekens bevatten. + + + This value should not be blank. + Deze waarde mag niet leeg zijn. + + + This value should not be null. + Deze waarde mag niet null zijn. + + + This value should be null. + Deze waarde moet null zijn. + + + This value is not valid. + Deze waarde is ongeldig. + + + This value is not a valid time. + Deze waarde is geen geldige tijd. + + + This value is not a valid URL. + Deze waarde is geen geldige URL. + + + The two values should be equal. + De twee waarden moeten gelijk zijn. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Het bestand is te groot. Toegestane maximum grootte is {{ limit }} {{ suffix }}. + + + The file is too large. + Het bestand is te groot. + + + The file could not be uploaded. + Het bestand kon niet geüpload worden. + + + This value should be a valid number. + Deze waarde moet een geldig getal zijn. + + + This file is not a valid image. + Dit bestand is geen geldige afbeelding. + + + This is not a valid IP address. + Dit is geen geldig IP-adres. + + + This value is not a valid language. + Deze waarde representeert geen geldige taal. + + + This value is not a valid locale. + Deze waarde representeert geen geldige lokalisering. + + + This value is not a valid country. + Deze waarde representeert geen geldig land. + + + This value is already used. + Deze waarde wordt al gebruikt. + + + The size of the image could not be detected. + De grootte van de afbeelding kon niet bepaald worden. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + De afbeelding is te breed ({{ width }}px). De maximaal toegestane breedte is {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + De afbeelding is niet breed genoeg ({{ width }}px). De minimaal verwachte breedte is {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + De afbeelding is te hoog ({{ height }}px). De maximaal toegestane hoogte is {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + De afbeelding is niet hoog genoeg ({{ height }}px). De minimaal verwachte hoogte is {{ min_height }}px. + + + This value should be the user's current password. + Deze waarde moet het huidige wachtwoord van de gebruiker zijn. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Deze waarde moet exact {{ limit }} teken lang zijn.|Deze waarde moet exact {{ limit }} tekens lang zijn. + + + The file was only partially uploaded. + Het bestand is niet geheel geüpload. + + + No file was uploaded. + Er is geen bestand geüpload. + + + No temporary folder was configured in php.ini. + Er is geen tijdelijke map geconfigureerd in php.ini. + + + Cannot write temporary file to disk. + Kan het tijdelijke bestand niet wegschrijven op disk. + + + A PHP extension caused the upload to fail. + De upload is mislukt vanwege een PHP-extensie. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Deze collectie moet {{ limit }} element of meer bevatten.|Deze collectie moet {{ limit }} elementen of meer bevatten. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Deze collectie moet {{ limit }} element of minder bevatten.|Deze collectie moet {{ limit }} elementen of minder bevatten. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Deze collectie moet exact {{ limit }} element bevatten.|Deze collectie moet exact {{ limit }} elementen bevatten. + + + Invalid card number. + Ongeldig creditcardnummer. + + + Unsupported card type or invalid card number. + Niet-ondersteund type creditcard of ongeldig nummer. + + + This is not a valid International Bank Account Number (IBAN). + Dit is geen geldig internationaal bankrekeningnummer (IBAN). + + + This value is not a valid ISBN-10. + Deze waarde is geen geldige ISBN-10. + + + This value is not a valid ISBN-13. + Deze waarde is geen geldige ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Deze waarde is geen geldige ISBN-10 of ISBN-13 waarde. + + + This value is not a valid ISSN. + Deze waarde is geen geldige ISSN waarde. + + + This value is not a valid currency. + Deze waarde is geen geldige valuta. + + + This value should be equal to {{ compared_value }}. + Deze waarde moet gelijk zijn aan {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Deze waarde moet groter zijn dan {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Deze waarde moet groter dan of gelijk aan {{ compared_value }} zijn. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Deze waarde moet identiek zijn aan {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Deze waarde moet minder zijn dan {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Deze waarde moet minder dan of gelijk aan {{ compared_value }} zijn. + + + This value should not be equal to {{ compared_value }}. + Deze waarde mag niet gelijk zijn aan {{ compared_value }}. + + + This value should not be identical to {{ compared_value }}. + Deze waarde mag niet identiek zijn aan {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + De afbeeldingsverhouding is te groot ({{ ratio }}). Maximale verhouding is {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + De afbeeldingsverhouding is te klein ({{ ratio }}). Minimale verhouding is {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + De afbeelding is vierkant ({{ width }}x{{ height }}px). Vierkante afbeeldingen zijn niet toegestaan. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + De afbeelding is liggend ({{ width }}x{{ height }}px). Liggende afbeeldingen zijn niet toegestaan. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + De afbeelding is staand ({{ width }}x{{ height }}px). Staande afbeeldingen zijn niet toegestaan. + + + An empty file is not allowed. + Lege bestanden zijn niet toegestaan. + + + This value does not match the expected {{ charset }} charset. + Deze waarde is niet in de verwachte tekencodering {{ charset }}. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.no.xlf b/core/vendor/symfony/validator/Resources/translations/validators.no.xlf new file mode 100644 index 0000000..ea01c63 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.no.xlf @@ -0,0 +1,227 @@ + + + + + + This value should be false. + Verdien skulle ha vore tom/nei. + + + This value should be true. + Verdien skulla ha vore satt/ja. + + + This value should be of type {{ type }}. + Verdien mÃ¥ vere av typen {{ type }}. + + + This value should be blank. + Verdien skal vere blank. + + + The value you selected is not a valid choice. + Verdien du valgte er ikkje gyldig. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Du mÃ¥ velge minst {{ limit }} valg. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Du kan maksimalt gjere {{ limit }} valg. + + + One or more of the given values is invalid. + Ein eller fleire av dei opplyste verdiane er ugyldige. + + + This field was not expected. + Dette feltet var ikke forventet. + + + This field is missing. + Dette feltet mangler. + + + This value is not a valid date. + Verdien er ikkje ein gyldig dato. + + + This value is not a valid datetime. + Verdien er ikkje ein gyldig dato og tid. + + + This value is not a valid email address. + Verdien er ikkje ei gyldig e-postadresse. + + + The file could not be found. + Fila kunne ikkje finnes. + + + The file is not readable. + Fila kan ikkje lesast. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Fila er for stor ({{ size }} {{ suffix }}). Tillatt maksimal størrelse er {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Mime-typen av fila er ugyldig ({{ type }}). Tillatte mime-typar er {{ types }}. + + + This value should be {{ limit }} or less. + Verdien mÃ¥ vere {{ limit }} eller mindre. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Verdien er for lang. Den mÃ¥ vere {{ limit }} bokstavar eller mindre. + + + This value should be {{ limit }} or more. + Verdien mÃ¥ vere {{ limit }} eller meir. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Verdien er for kort. Den mÃ¥ ha {{ limit }} teikn eller fleire. + + + This value should not be blank. + Verdien mÃ¥ ikkje vere blank. + + + This value should not be null. + Verdien mÃ¥ ikkje vere tom (null). + + + This value should be null. + Verdien mÃ¥ vere tom (null). + + + This value is not valid. + Verdien er ikkje gyldig. + + + This value is not a valid time. + Verdien er ikkje gyldig tidseining. + + + This value is not a valid URL. + Verdien er ikkje ein gyldig URL. + + + The two values should be equal. + Dei to verdiane mÃ¥ vere like. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Fila er for stor. Den maksimale storleik er {{ limit }} {{ suffix }}. + + + The file is too large. + Fila er for stor. + + + The file could not be uploaded. + Fila kunne ikkje bli lasta opp. + + + This value should be a valid number. + Verdien mÃ¥ vere eit gyldig tal. + + + This file is not a valid image. + Fila er ikkje eit gyldig bilete. + + + This is not a valid IP address. + Dette er ikkje ei gyldig IP-adresse. + + + This value is not a valid language. + Verdien er ikkje eit gyldig sprÃ¥k. + + + This value is not a valid locale. + Verdien er ikkje ein gyldig lokalitet (sprÃ¥k/region). + + + This value is not a valid country. + Verdien er ikkje eit gyldig land. + + + This value is already used. + Verdien er allereie i bruk. + + + The size of the image could not be detected. + Storleiken pÃ¥ biletet kunne ikkje oppdagast. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Biletbreidda er for stor, ({{ width }} pikslar). Tillatt maksimumsbreidde er {{ max_width }} pikslar. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Biletbreidda er for liten, ({{ width }} pikslar). Forventa minimumsbreidde er {{ min_width }} pikslar. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Bilethøgda er for stor, ({{ height }} pikslar). Tillatt maksimumshøgde er {{ max_height }} pikslar. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Billethøgda er for lÃ¥g, ({{ height }} pikslar). Forventa minimumshøgde er {{ min_height }} pikslar. + + + This value should be the user's current password. + Verdien mÃ¥ vere brukaren sitt noverande passord. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Verdien mÃ¥ vere nøyaktig {{ limit }} teikn. + + + The file was only partially uploaded. + Fila vart kun delvis opplasta. + + + No file was uploaded. + Inga fil vart lasta opp. + + + No temporary folder was configured in php.ini. + Førebels mappe (tmp) er ikkje konfigurert i php.ini. + + + Cannot write temporary file to disk. + Kan ikkje skrive førebels fil til disk. + + + A PHP extension caused the upload to fail. + Ei PHP-udviding forÃ¥rsaka feil under opplasting. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Denne samlinga mÃ¥ innehalde {{ limit }} element eller meir.|Denne samlinga mÃ¥ innehalde {{ limit }} element eller meir. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Denne samlinga mÃ¥ innehalde {{ limit }} element eller færre.|Denne samlinga mÃ¥ innehalde {{ limit }} element eller færre. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Denne samlinga mÃ¥ innehalde nøyaktig {{ limit }} element.|Denne samlinga mÃ¥ innehalde nøyaktig {{ limit }} element. + + + Invalid card number. + Ugyldig kortnummer. + + + Unsupported card type or invalid card number. + Korttypen er ikkje støtta eller ugyldig kortnummer. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.pl.xlf b/core/vendor/symfony/validator/Resources/translations/validators.pl.xlf new file mode 100644 index 0000000..1d6875f --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.pl.xlf @@ -0,0 +1,315 @@ + + + + + + This value should be false. + Ta wartość powinna być faÅ‚szem. + + + This value should be true. + Ta wartość powinna być prawdÄ…. + + + This value should be of type {{ type }}. + Ta wartość powinna być typu {{ type }}. + + + This value should be blank. + Ta wartość powinna być pusta. + + + The value you selected is not a valid choice. + Ta wartość powinna być jednÄ… z podanych opcji. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + PowinieneÅ› wybrać co najmniej {{ limit }} opcjÄ™.|PowinieneÅ› wybrać co najmniej {{ limit }} opcje.|PowinieneÅ› wybrać co najmniej {{ limit }} opcji. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + PowinieneÅ› wybrać maksymalnie {{ limit }} opcjÄ™.|PowinieneÅ› wybrać maksymalnie {{ limit }} opcje.|PowinieneÅ› wybrać maksymalnie {{ limit }} opcji. + + + One or more of the given values is invalid. + Jedna lub wiÄ™cej z podanych wartoÅ›ci jest nieprawidÅ‚owa. + + + This field was not expected. + To pole nie spodziewano. + + + This field is missing. + To pole jest chybianie. + + + This value is not a valid date. + Ta wartość nie jest prawidÅ‚owÄ… datÄ…. + + + This value is not a valid datetime. + Ta wartość nie jest prawidÅ‚owÄ… datÄ… i czasem. + + + This value is not a valid email address. + Ta wartość nie jest prawidÅ‚owym adresem email. + + + The file could not be found. + Plik nie mógÅ‚ zostać odnaleziony. + + + The file is not readable. + Nie można odczytać pliku. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Plik jest za duży ({{ size }} {{ suffix }}). Maksymalny dozwolony rozmiar to {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + NieprawidÅ‚owy typ mime pliku ({{ type }}). Dozwolone typy mime to {{ types }}. + + + This value should be {{ limit }} or less. + Ta wartość powinna wynosić {{ limit }} lub mniej. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Ta wartość jest zbyt dÅ‚uga. Powinna mieć {{ limit }} lub mniej znaków.|Ta wartość jest zbyt dÅ‚uga. Powinna mieć {{ limit }} lub mniej znaków.|Ta wartość jest zbyt dÅ‚uga. Powinna mieć {{ limit }} lub mniej znaków. + + + This value should be {{ limit }} or more. + Ta wartość powinna wynosić {{ limit }} lub wiÄ™cej. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Ta wartość jest zbyt krótka. Powinna mieć {{ limit }} lub wiÄ™cej znaków.|Ta wartość jest zbyt krótka. Powinna mieć {{ limit }} lub wiÄ™cej znaków.|Ta wartość jest zbyt krótka. Powinna mieć {{ limit }} lub wiÄ™cej znaków. + + + This value should not be blank. + Ta wartość nie powinna być pusta. + + + This value should not be null. + Ta wartość nie powinna być nullem. + + + This value should be null. + Ta wartość powinna być nullem. + + + This value is not valid. + Ta wartość jest nieprawidÅ‚owa. + + + This value is not a valid time. + Ta wartość nie jest prawidÅ‚owym czasem. + + + This value is not a valid URL. + Ta wartość nie jest prawidÅ‚owym adresem URL. + + + The two values should be equal. + Obie wartoÅ›ci powinny być równe. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Plik jest za duży. Maksymalny dozwolony rozmiar to {{ limit }} {{ suffix }}. + + + The file is too large. + Plik jest za duży. + + + The file could not be uploaded. + Plik nie mógÅ‚ być wgrany. + + + This value should be a valid number. + Ta wartość powinna być prawidÅ‚owÄ… liczbÄ…. + + + This file is not a valid image. + Ten plik nie jest obrazem. + + + This is not a valid IP address. + To nie jest prawidÅ‚owy adres IP. + + + This value is not a valid language. + Ta wartość nie jest prawidÅ‚owym jÄ™zykiem. + + + This value is not a valid locale. + Ta wartość nie jest prawidÅ‚owÄ… lokalizacjÄ…. + + + This value is not a valid country. + Ta wartość nie jest prawidÅ‚owÄ… nazwÄ… kraju. + + + This value is already used. + Ta wartość jest już wykorzystywana. + + + The size of the image could not be detected. + Nie można wykryć rozmiaru obrazka. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Szerokość obrazka jest zbyt duża ({{ width }}px). Maksymalna dopuszczalna szerokość to {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Szerokość obrazka jest zbyt maÅ‚a ({{ width }}px). Oczekiwana minimalna szerokość to {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Wysokość obrazka jest zbyt duża ({{ height }}px). Maksymalna dopuszczalna wysokość to {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Wysokość obrazka jest zbyt maÅ‚a ({{ height }}px). Oczekiwana minimalna wysokość to {{ min_height }}px. + + + This value should be the user's current password. + Ta wartość powinna być aktualnym hasÅ‚em użytkownika. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Ta wartość powinna mieć dokÅ‚adnie {{ limit }} znak.|Ta wartość powinna mieć dokÅ‚adnie {{ limit }} znaki.|Ta wartość powinna mieć dokÅ‚adnie {{ limit }} znaków. + + + The file was only partially uploaded. + Plik zostaÅ‚ wgrany tylko częściowo. + + + No file was uploaded. + Å»aden plik nie zostaÅ‚ wgrany. + + + No temporary folder was configured in php.ini. + Nie skonfigurowano folderu tymczasowego w php.ini. + + + Cannot write temporary file to disk. + Nie można zapisać pliku tymczasowego na dysku. + + + A PHP extension caused the upload to fail. + Rozszerzenie PHP spowodowaÅ‚o bÅ‚Ä…d podczas wgrywania. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ten zbiór powinien zawierać {{ limit }} lub wiÄ™cej elementów. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ten zbiór powinien zawierać {{ limit }} lub mniej elementów. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ten zbiór powinien zawierać dokÅ‚adnie {{ limit }} element.|Ten zbiór powinien zawierać dokÅ‚adnie {{ limit }} elementy.|Ten zbiór powinien zawierać dokÅ‚adnie {{ limit }} elementów. + + + Invalid card number. + NieprawidÅ‚owy numer karty. + + + Unsupported card type or invalid card number. + NieobsÅ‚ugiwany rodzaj karty lub nieprawidÅ‚owy numer karty. + + + This is not a valid International Bank Account Number (IBAN). + NieprawidÅ‚owy miÄ™dzynarodowy numer rachunku bankowego (IBAN). + + + This value is not a valid ISBN-10. + Ta wartość nie jest prawidÅ‚owym numerem ISBN-10. + + + This value is not a valid ISBN-13. + Ta wartość nie jest prawidÅ‚owym numerem ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Ta wartość nie jest prawidÅ‚owym numerem ISBN-10 ani ISBN-13. + + + This value is not a valid ISSN. + Ta wartość nie jest prawidÅ‚owym numerem ISSN. + + + This value is not a valid currency. + Ta wartość nie jest prawidÅ‚owÄ… walutÄ…. + + + This value should be equal to {{ compared_value }}. + Ta wartość powinna być równa {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Ta wartość powinna być wiÄ™ksza niż {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Ta wartość powinna być wiÄ™ksza bÄ…dź równa {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Ta wartość powinna być identycznego typu {{ compared_value_type }} oraz wartoÅ›ci {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Ta wartość powinna być mniejsza niż {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Ta wartość powinna być mniejsza bÄ…dź równa {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Ta wartość nie powinna być równa {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Ta wartość nie powinna być identycznego typu {{ compared_value_type }} oraz wartoÅ›ci {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Proporcje obrazu sÄ… zbyt duże ({{ ratio }}). Maksymalne proporcje to {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Proporcje obrazu sÄ… zbyt maÅ‚e ({{ ratio }}). Minimalne proporcje to {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Obraz jest kwadratem ({{ width }}x{{ height }}px). Kwadratowe obrazy nie sÄ… akceptowane. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Obraz jest panoramiczny ({{ width }}x{{ height }}px). Panoramiczne zdjÄ™cia nie sÄ… akceptowane. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Obraz jest portretowy ({{ width }}x{{ height }}px). Portretowe zdjÄ™cia nie sÄ… akceptowane. + + + An empty file is not allowed. + Plik nie może być pusty. + + + The host could not be resolved. + Nazwa hosta nie zostaÅ‚a rozpoznana. + + + This value does not match the expected {{ charset }} charset. + Ta wartość nie pasuje do oczekiwanego zestawu znaków {{ charset }}. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.pt.xlf b/core/vendor/symfony/validator/Resources/translations/validators.pt.xlf new file mode 100644 index 0000000..d563c92 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.pt.xlf @@ -0,0 +1,307 @@ + + + + + + This value should be false. + Este valor deveria ser falso. + + + This value should be true. + Este valor deveria ser verdadeiro. + + + This value should be of type {{ type }}. + Este valor deveria ser do tipo {{ type }}. + + + This value should be blank. + Este valor deveria ser vazio. + + + The value you selected is not a valid choice. + O valor selecionado não é uma opção válida. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Você deveria selecionar {{ limit }} opção no mínimo.|Você deveria selecionar {{ limit }} opções no mínimo. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Você deve selecionar, no máximo {{ limit }} opção.|Você deve selecionar, no máximo {{ limit }} opções. + + + One or more of the given values is invalid. + Um ou mais dos valores introduzidos não são válidos. + + + This field was not expected. + Este campo não era esperado. + + + This field is missing. + Este campo está faltando. + + + This value is not a valid date. + Este valor não é uma data válida. + + + This value is not a valid datetime. + Este valor não é uma data-hora válida. + + + This value is not a valid email address. + Este valor não é um endereço de e-mail válido. + + + The file could not be found. + O arquivo não pôde ser encontrado. + + + The file is not readable. + O arquivo não pôde ser lido. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + O arquivo é muito grande ({{ size }} {{ suffix }}). O tamanho máximo permitido é de {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + O tipo mime do arquivo é inválido ({{ type }}). Os tipos mime permitidos são {{ types }}. + + + This value should be {{ limit }} or less. + Este valor deveria ser {{ limit }} ou menor. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + O valor é muito longo. Deveria ter {{ limit }} caracteres ou menos. + + + This value should be {{ limit }} or more. + Este valor deveria ser {{ limit }} ou mais. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + O valor é muito curto. Deveria de ter {{ limit }} caractere ou mais.|O valor é muito curto. Deveria de ter {{ limit }} caracteres ou mais. + + + This value should not be blank. + Este valor não deveria ser branco/vazio. + + + This value should not be null. + Este valor não deveria ser nulo. + + + This value should be null. + Este valor deveria ser nulo. + + + This value is not valid. + Este valor não é válido. + + + This value is not a valid time. + Este valor não é uma hora válida. + + + This value is not a valid URL. + Este valor não é um URL válido. + + + The two values should be equal. + Os dois valores deveriam ser iguais. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + O arquivo é muito grande. O tamanho máximo permitido é de {{ limit }} {{ suffix }}. + + + The file is too large. + O ficheiro é muito grande. + + + The file could not be uploaded. + Não foi possível carregar o ficheiro. + + + This value should be a valid number. + Este valor deveria de ser um número válido. + + + This file is not a valid image. + Este ficheiro não é uma imagem. + + + This is not a valid IP address. + Este endereço de IP não é válido. + + + This value is not a valid language. + Este valor não é uma linguagem válida. + + + This value is not a valid locale. + Este valor não é um 'locale' válido. + + + This value is not a valid country. + Este valor não é um País válido. + + + This value is already used. + Este valor já está a ser usado. + + + The size of the image could not be detected. + O tamanho da imagem não foi detetado. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + A largura da imagem ({{ width }}px) é muito grande. A largura máxima da imagem é: {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + A largura da imagem ({{ width }}px) é muito pequena. A largura miníma da imagem é de: {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + A altura da imagem ({{ height }}px) é muito grande. A altura máxima da imagem é de: {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + A altura da imagem ({{ height }}px) é muito pequena. A altura miníma da imagem é de: {{ min_height }}px. + + + This value should be the user's current password. + Este valor deveria de ser a password atual do utilizador. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Este valor tem de ter exatamente {{ limit }} carateres. + + + The file was only partially uploaded. + Só foi enviado parte do ficheiro. + + + No file was uploaded. + Nenhum ficheiro foi enviado. + + + No temporary folder was configured in php.ini. + Não existe nenhum directório temporária configurado no ficheiro php.ini. + + + Cannot write temporary file to disk. + Não foi possível escrever ficheiros temporários no disco. + + + A PHP extension caused the upload to fail. + Uma extensão PHP causou a falha no envio. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Esta coleção deve conter {{ limit }} elemento ou mais.|Esta coleção deve conter {{ limit }} elementos ou mais. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Esta coleção deve conter {{ limit }} elemento ou menos.|Esta coleção deve conter {{ limit }} elementos ou menos. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Esta coleção deve conter exatamente {{ limit }} elemento.|Esta coleção deve conter exatamente {{ limit }} elementos. + + + Invalid card number. + Número de cartão inválido. + + + Unsupported card type or invalid card number. + Tipo de cartão não suportado ou número de cartão inválido. + + + This is not a valid International Bank Account Number (IBAN). + Este não é um Número Internacional de Conta Bancária (IBAN) válido. + + + This value is not a valid ISBN-10. + Este valor não é um ISBN-10 válido. + + + This value is not a valid ISBN-13. + Este valor não é um ISBN-13 válido. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Este valor não é um ISBN-10 ou ISBN-13 válido. + + + This value is not a valid ISSN. + Este valor não é um ISSN válido. + + + This value is not a valid currency. + Este não é um valor monetário válido. + + + This value should be equal to {{ compared_value }}. + Este valor deve ser igual a {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Este valor deve ser superior a {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Este valor deve ser igual ou superior a {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Este valor deve ser idêntico a {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Este valor deve ser inferior a {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Este valor deve ser igual ou inferior a {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Este valor não deve ser igual a {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Este valor não deve ser idêntico a {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + O formato da imagem é muito grande ({{ ratio }}). O formato máximo é {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + O formato da imagem é muito pequeno ({{ ratio }}). O formato mínimo esperado é {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + A imagem é um quadrado ({{ width }}x{{ height }}px). Imagens quadradas não são permitidas. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + A imagem está orientada à paisagem ({{ width }}x{{ height }}px). Imagens orientadas à paisagem não são permitidas. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + A imagem está orientada ao retrato ({{ width }}x{{ height }}px). Imagens orientadas ao retrato não são permitidas. + + + An empty file is not allowed. + Ficheiro vazio não é permitido. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.pt_BR.xlf b/core/vendor/symfony/validator/Resources/translations/validators.pt_BR.xlf new file mode 100644 index 0000000..bff91e3 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.pt_BR.xlf @@ -0,0 +1,315 @@ + + + + + + This value should be false. + Este valor deve ser falso. + + + This value should be true. + Este valor deve ser verdadeiro. + + + This value should be of type {{ type }}. + Este valor deve ser do tipo {{ type }}. + + + This value should be blank. + Este valor deve ser vazio. + + + The value you selected is not a valid choice. + O valor selecionado não é uma opção válida. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Você deve selecionar, no mínimo, {{ limit }} opção.|Você deve selecionar, no mínimo, {{ limit }} opções. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Você deve selecionar, no máximo, {{ limit }} opção.|Você deve selecionar, no máximo, {{ limit }} opções. + + + One or more of the given values is invalid. + Um ou mais valores informados são inválidos. + + + This field was not expected. + Este campo não era esperado. + + + This field is missing. + Este campo está ausente. + + + This value is not a valid date. + Este valor não é uma data válida. + + + This value is not a valid datetime. + Este valor não é uma data e hora válida. + + + This value is not a valid email address. + Este valor não é um endereço de e-mail válido. + + + The file could not be found. + O arquivo não foi encontrado. + + + The file is not readable. + O arquivo não pode ser lido. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + O arquivo é muito grande ({{ size }} {{ suffix }}). O tamanho máximo permitido é {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + O tipo mime do arquivo é inválido ({{ type }}). Os tipos mime permitidos são {{ types }}. + + + This value should be {{ limit }} or less. + Este valor deve ser {{ limit }} ou menos. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Este valor é muito longo. Deve ter {{ limit }} caractere ou menos.|Este valor é muito longo. Deve ter {{ limit }} caracteres ou menos. + + + This value should be {{ limit }} or more. + Este valor deve ser {{ limit }} ou mais. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Este valor é muito curto. Deve ter {{ limit }} caractere ou mais.|Este valor é muito curto. Deve ter {{ limit }} caracteres ou mais. + + + This value should not be blank. + Este valor não deve ser vazio. + + + This value should not be null. + Este valor não deve ser nulo. + + + This value should be null. + Este valor deve ser nulo. + + + This value is not valid. + Este valor não é válido. + + + This value is not a valid time. + Este valor não é uma hora válida. + + + This value is not a valid URL. + Este valor não é uma URL válida. + + + The two values should be equal. + Os dois valores devem ser iguais. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + O arquivo é muito grande. O tamanho máximo permitido é de {{ limit }} {{ suffix }}. + + + The file is too large. + O arquivo é muito grande. + + + The file could not be uploaded. + O arquivo não pode ser enviado. + + + This value should be a valid number. + Este valor deve ser um número válido. + + + This file is not a valid image. + Este arquivo não é uma imagem válida. + + + This is not a valid IP address. + Este não é um endereço de IP válido. + + + This value is not a valid language. + Este valor não é um idioma válido. + + + This value is not a valid locale. + Este valor não é uma localidade válida. + + + This value is not a valid country. + Este valor não é um país válido. + + + This value is already used. + Este valor já está sendo usado. + + + The size of the image could not be detected. + O tamanho da imagem não pode ser detectado. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + A largura da imagem é muito grande ({{ width }}px). A largura máxima permitida é de {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + A largura da imagem é muito pequena ({{ width }}px). A largura mínima esperada é de {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + A altura da imagem é muito grande ({{ height }}px). A altura máxima permitida é de {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + A altura da imagem é muito pequena ({{ height }}px). A altura mínima esperada é de {{ min_height }}px. + + + This value should be the user's current password. + Este valor deve ser a senha atual do usuário. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Este valor deve ter exatamente {{ limit }} caractere.|Este valor deve ter exatamente {{ limit }} caracteres. + + + The file was only partially uploaded. + O arquivo foi enviado apenas parcialmente. + + + No file was uploaded. + Nenhum arquivo foi enviado. + + + No temporary folder was configured in php.ini. + Nenhum diretório temporário foi configurado no php.ini. + + + Cannot write temporary file to disk. + Não foi possível escrever o arquivo temporário no disco. + + + A PHP extension caused the upload to fail. + Uma extensão PHP fez com que o envio falhasse. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Esta coleção deve conter {{ limit }} elemento ou mais.|Esta coleção deve conter {{ limit }} elementos ou mais. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Esta coleção deve conter {{ limit }} elemento ou menos.|Esta coleção deve conter {{ limit }} elementos ou menos. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Esta coleção deve conter exatamente {{ limit }} elemento.|Esta coleção deve conter exatamente {{ limit }} elementos. + + + Invalid card number. + Número de cartão inválido. + + + Unsupported card type or invalid card number. + Tipo de cartão não suportado ou número de cartão inválido. + + + This is not a valid International Bank Account Number (IBAN). + Este não é um Número Internacional de Conta Bancária (IBAN) válido. + + + This value is not a valid ISBN-10. + Este valor não é um ISBN-10 válido. + + + This value is not a valid ISBN-13. + Este valor não é um ISBN-13 válido. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Este valor não é um ISBN-10 e nem um ISBN-13 válido. + + + This value is not a valid ISSN. + Este valor não é um ISSN válido. + + + This value is not a valid currency. + Este não é um valor monetário válido. + + + This value should be equal to {{ compared_value }}. + Este valor deve ser igual a {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Este valor deve ser maior que {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Este valor deve ser maior ou igual a {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Este valor deve ser idêntico a {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Este valor deve ser menor que {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Este valor deve ser menor ou igual a {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Este valor não deve ser igual a {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Este valor não deve ser idêntico a {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + A proporção da imagem é muito grande ({{ ratio }}). A proporção máxima permitida é {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + A proporção da imagem é muito pequena ({{ ratio }}). A proporção mínima esperada é {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + A imagem está num formato quadrado ({{ width }}x{{ height }}px). Imagens com formato quadrado não são permitidas. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + A imagem está orientada à paisagem ({{ width }}x{{ height }}px). Imagens orientadas à paisagem não são permitidas. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + A imagem está orientada ao retrato ({{ width }}x{{ height }}px). Imagens orientadas ao retrato não são permitidas. + + + An empty file is not allowed. + Arquivo vazio não é permitido. + + + The host could not be resolved. + O host não pôde ser resolvido. + + + This value does not match the expected {{ charset }} charset. + Este valor não corresponde ao charset {{ charset }} esperado. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.ro.xlf b/core/vendor/symfony/validator/Resources/translations/validators.ro.xlf new file mode 100644 index 0000000..27346a9 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.ro.xlf @@ -0,0 +1,283 @@ + + + + + + This value should be false. + Această valoare ar trebui să fie falsă (false). + + + This value should be true. + Această valoare ar trebui să fie adevărată (true). + + + This value should be of type {{ type }}. + Această valoare ar trebui să fie de tipul {{ type }}. + + + This value should be blank. + Această valoare ar trebui sa fie goală. + + + The value you selected is not a valid choice. + Valoarea selectată nu este o opÈ›iune validă. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Trebuie să selectaÈ›i cel puÈ›in {{ limit }} opÈ›iune.|Trebuie să selectaÈ›i cel puÈ›in {{ limit }} opÈ›iuni.|Trebuie să selectaÈ›i cel puÈ›in {{ limit }} de opÈ›iuni + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Trebuie să selectaÈ›i cel mult {{ limit }} opÈ›iune.|Trebuie să selectaÈ›i cel mult {{ limit }} opÈ›iuni.|Trebuie să selectaÈ›i cel mult {{ limit }} de opÈ›iuni. + + + One or more of the given values is invalid. + Una sau mai multe dintre valorile furnizate sunt invalide. + + + This field was not expected. + Acest câmp nu era de aÅŸteptat. + + + This field is missing. + Acest câmp este lipsă. + + + This value is not a valid date. + Această valoare nu reprezintă o dată validă. + + + This value is not a valid datetime. + Această valoare nu reprezintă o dată È™i oră validă. + + + This value is not a valid email address. + Această valoare nu reprezintă o adresă de e-mail validă. + + + The file could not be found. + FiÈ™ierul nu a putut fi găsit. + + + The file is not readable. + FiÈ™ierul nu poate fi citit. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + FiÈ™ierul este prea mare ({{ size }} {{ suffix }}). Dimensiunea maximă permisă este {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Tipul fiÈ™ierului este invalid ({{ type }}). Tipurile permise de fiÈ™iere sunt ({{ types }}). + + + This value should be {{ limit }} or less. + Această valoare ar trebui să fie cel mult {{ limit }}. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Această valoare este prea lungă. Ar trebui să aibă maxim {{ limit }} caracter.|Această valoare este prea lungă. Ar trebui să aibă maxim {{ limit }} caractere.|Această valoare este prea lungă. Ar trebui să aibă maxim {{ limit }} de caractere. + + + This value should be {{ limit }} or more. + Această valoare ar trebui să fie cel puÈ›in {{ limit }}. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Această valoare este prea scurtă. Ar trebui să aibă minim {{ limit }} caracter.|Această valoare este prea scurtă. Ar trebui să aibă minim {{ limit }} caractere.|Această valoare este prea scurtă. Ar trebui să aibă minim {{ limit }} de caractere. + + + This value should not be blank. + Această valoare nu ar trebui să fie goală. + + + This value should not be null. + Această valoare nu ar trebui să fie nulă (null). + + + This value should be null. + Această valoare ar trebui să fie nulă (null). + + + This value is not valid. + Această valoare nu este validă. + + + This value is not a valid time. + Această valoare nu reprezintă o oră validă. + + + This value is not a valid URL. + Această valoare nu reprezintă un URL (link) valid. + + + The two values should be equal. + Cele două valori ar trebui să fie egale. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + FiÈ™ierul este prea mare. Mărimea maximă permisă este {{ limit }} {{ suffix }}. + + + The file is too large. + FiÈ™ierul este prea mare. + + + The file could not be uploaded. + FiÈ™ierul nu a putut fi încărcat. + + + This value should be a valid number. + Această valoare nu reprezintă un număr valid. + + + This file is not a valid image. + Acest fiÈ™ier nu este o imagine validă. + + + This is not a valid IP address. + Această valoare nu este o adresă IP validă. + + + This value is not a valid language. + Această valoare nu reprezintă o limbă corectă. + + + This value is not a valid locale. + Această valoare nu reprezintă un dialect (o limbă) corect. + + + This value is not a valid country. + Această valoare nu este o È›ară validă. + + + This value is already used. + Această valoare este folosită deja. + + + The size of the image could not be detected. + Mărimea imaginii nu a putut fi detectată. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Lățimea imaginii este prea mare ({{ width }}px). Lățimea maximă permisă este de {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Lățimea imaginii este prea mică ({{ width }}px). Lățimea minimă permisă este de {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + ÃŽnălÈ›imea imaginii este prea mare ({{ height }}px). ÃŽnălÈ›imea maximă permisă este de {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + ÃŽnălÈ›imea imaginii este prea mică ({{ height }}px). ÃŽnălÈ›imea minimă permisă este de {{ min_height }}px. + + + This value should be the user's current password. + Această valoare trebuie să fie parola curentă a utilizatorului. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Această valoare trebuie să conÈ›ină exact {{ limit }} caracter.|Această valoare trebuie să conÈ›ină exact {{ limit }} caractere.|Această valoare trebuie să conÈ›ină exact {{ limit }} de caractere. + + + The file was only partially uploaded. + FiÈ™ierul a fost încărcat parÈ›ial. + + + No file was uploaded. + Nu a fost încărcat nici un fiÈ™ier. + + + No temporary folder was configured in php.ini. + Nu este configurat nici un director temporar in php.ini. + + + Cannot write temporary file to disk. + Nu a fost posibilă scrierea fiÈ™ierului temporar pe disk. + + + A PHP extension caused the upload to fail. + O extensie PHP a prevenit încărcarea cu succes a fiÈ™ierului. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Această colecÈ›ie trebuie să conÈ›ină cel puÈ›in {{ limit }} element.|Această colecÈ›ie trebuie să conÈ›ină cel puÈ›in {{ limit }} elemente.|Această colecÈ›ie trebuie să conÈ›ină cel puÈ›in {{ limit }} de elemente. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Această colecÈ›ie trebuie să conÈ›ină cel mult {{ limit }} element.|Această colecÈ›ie trebuie să conÈ›ină cel mult {{ limit }} elemente.|Această colecÈ›ie trebuie să conÈ›ină cel mult {{ limit }} de elemente. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Această colecÈ›ie trebuie să conÈ›ină {{ limit }} element.|Această colecÈ›ie trebuie să conÈ›ină {{ limit }} elemente.|Această colecÈ›ie trebuie să conÈ›ină {{ limit }} de elemente. + + + Invalid card number. + Numărul card invalid. + + + Unsupported card type or invalid card number. + Tipul sau numărul cardului nu sunt valide. + + + This is not a valid International Bank Account Number (IBAN). + Acesta nu este un cod IBAN (International Bank Account Number) valid. + + + This value is not a valid ISBN-10. + Această valoare nu este un cod ISBN-10 valid. + + + This value is not a valid ISBN-13. + Această valoare nu este un cod ISBN-13 valid. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Această valoare nu este un cod ISBN-10 sau ISBN-13 valid. + + + This value is not a valid ISSN. + Această valoare nu este un cod ISSN valid. + + + This value is not a valid currency. + Această valoare nu este o monedă validă. + + + This value should be equal to {{ compared_value }}. + Această valoare trebuie să fie egală cu {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Această valoare trebuie să fie mai mare de {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Această valoare trebuie să fie mai mare sau egală cu {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Această valoare trebuie identică cu {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Această valoare trebuie să fie mai mică de {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Această valoare trebuie să fie mai mică sau egală cu {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Această valoare nu trebuie să fie egală cu {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Această valoare nu trebuie să fie identică cu {{ compared_value_type }} {{ compared_value }}. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.ru.xlf b/core/vendor/symfony/validator/Resources/translations/validators.ru.xlf new file mode 100644 index 0000000..d7a90c9 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.ru.xlf @@ -0,0 +1,315 @@ + + + + + + This value should be false. + Значение должно быть ложным. + + + This value should be true. + Значение должно быть иÑтинным. + + + This value should be of type {{ type }}. + Тип Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð´Ð¾Ð»Ð¶ÐµÐ½ быть {{ type }}. + + + This value should be blank. + Значение должно быть пуÑтым. + + + The value you selected is not a valid choice. + Выбранное Вами значение недопуÑтимо. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Ð’Ñ‹ должны выбрать Ñ…Ð¾Ñ‚Ñ Ð±Ñ‹ {{ limit }} вариант.|Ð’Ñ‹ должны выбрать Ñ…Ð¾Ñ‚Ñ Ð±Ñ‹ {{ limit }} варианта.|Ð’Ñ‹ должны выбрать Ñ…Ð¾Ñ‚Ñ Ð±Ñ‹ {{ limit }} вариантов. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Ð’Ñ‹ должны выбрать не более чем {{ limit }} вариант.|Ð’Ñ‹ должны выбрать не более чем {{ limit }} варианта.|Ð’Ñ‹ должны выбрать не более чем {{ limit }} вариантов. + + + One or more of the given values is invalid. + Одно или неÑколько заданных значений недопуÑтимо. + + + This field was not expected. + Это поле не ожидалоÑÑŒ. + + + This field is missing. + Это поле отÑутÑтвует. + + + This value is not a valid date. + Значение не ÑвлÑетÑÑ Ð¿Ñ€Ð°Ð²Ð¸Ð»ÑŒÐ½Ð¾Ð¹ датой. + + + This value is not a valid datetime. + Значение даты и времени недопуÑтимо. + + + This value is not a valid email address. + Значение адреÑа Ñлектронной почты недопуÑтимо. + + + The file could not be found. + Файл не может быть найден. + + + The file is not readable. + Файл не может быть прочитан. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Файл Ñлишком большой ({{ size }} {{ suffix }}). МакÑимально допуÑтимый размер {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + MIME-тип файла недопуÑтим ({{ type }}). ДопуÑтимы MIME-типы файлов {{ types }}. + + + This value should be {{ limit }} or less. + Значение должно быть {{ limit }} или меньше. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Значение Ñлишком длинное. Должно быть равно {{ limit }} Ñимволу или меньше.|Значение Ñлишком длинное. Должно быть равно {{ limit }} Ñимволам или меньше.|Значение Ñлишком длинное. Должно быть равно {{ limit }} Ñимволам или меньше. + + + This value should be {{ limit }} or more. + Значение должно быть {{ limit }} или больше. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Значение Ñлишком короткое. Должно быть равно {{ limit }} Ñимволу или больше.|Значение Ñлишком короткое. Должно быть равно {{ limit }} Ñимволам или больше.|Значение Ñлишком короткое. Должно быть равно {{ limit }} Ñимволам или больше. + + + This value should not be blank. + Значение не должно быть пуÑтым. + + + This value should not be null. + Значение не должно быть null. + + + This value should be null. + Значение должно быть null. + + + This value is not valid. + Значение недопуÑтимо. + + + This value is not a valid time. + Значение времени недопуÑтимо. + + + This value is not a valid URL. + Значение не ÑвлÑетÑÑ Ð´Ð¾Ð¿ÑƒÑтимым URL. + + + The two values should be equal. + Оба Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð´Ð¾Ð»Ð¶Ð½Ñ‹ быть одинаковыми. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Файл Ñлишком большой. МакÑимально допуÑтимый размер {{ limit }} {{ suffix }}. + + + The file is too large. + Файл Ñлишком большой. + + + The file could not be uploaded. + Файл не может быть загружен. + + + This value should be a valid number. + Значение должно быть чиÑлом. + + + This value is not a valid country. + Значение не ÑвлÑетÑÑ Ð´Ð¾Ð¿ÑƒÑтимой Ñтраной. + + + This file is not a valid image. + Файл не ÑвлÑетÑÑ Ð´Ð¾Ð¿ÑƒÑтимым форматом изображениÑ. + + + This is not a valid IP address. + Значение не ÑвлÑетÑÑ Ð´Ð¾Ð¿ÑƒÑтимым IP адреÑом. + + + This value is not a valid language. + Значение не ÑвлÑетÑÑ Ð´Ð¾Ð¿ÑƒÑтимым Ñзыком. + + + This value is not a valid locale. + Значение не ÑвлÑетÑÑ Ð´Ð¾Ð¿ÑƒÑтимой локалью. + + + This value is already used. + Это значение уже иÑпользуетÑÑ. + + + The size of the image could not be detected. + Ðе удалоÑÑŒ определить размер изображениÑ. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Ширина Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ñлишком велика ({{ width }}px). МакÑимально допуÑÑ‚Ð¸Ð¼Ð°Ñ ÑˆÐ¸Ñ€Ð¸Ð½Ð° {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Ширина Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ñлишком мала ({{ width }}px). Минимально допуÑÑ‚Ð¸Ð¼Ð°Ñ ÑˆÐ¸Ñ€Ð¸Ð½Ð° {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Ð’Ñ‹Ñота Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ñлишком велика ({{ height }}px). МакÑимально допуÑÑ‚Ð¸Ð¼Ð°Ñ Ð²Ñ‹Ñота {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Ð’Ñ‹Ñота Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ñлишком мала ({{ height }}px). Минимально допуÑÑ‚Ð¸Ð¼Ð°Ñ Ð²Ñ‹Ñота {{ min_height }}px. + + + This value should be the user's current password. + Значение должно быть текущим паролем пользователÑ. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Значение должно быть равно {{ limit }} Ñимволу.|Значение должно быть равно {{ limit }} Ñимволам.|Значение должно быть равно {{ limit }} Ñимволам. + + + The file was only partially uploaded. + Файл был загружен только чаÑтично. + + + No file was uploaded. + Файл не был загружен. + + + No temporary folder was configured in php.ini. + Ðе наÑтроена Ð²Ñ€ÐµÐ¼ÐµÐ½Ð½Ð°Ñ Ð´Ð¸Ñ€ÐµÐºÑ‚Ð¾Ñ€Ð¸Ñ Ð² php.ini. + + + Cannot write temporary file to disk. + Ðевозможно запиÑать временный файл на диÑк. + + + A PHP extension caused the upload to fail. + РаÑширение PHP вызвало ошибку при загрузке. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Эта ÐºÐ¾Ð»Ð»ÐµÐºÑ†Ð¸Ñ Ð´Ð¾Ð»Ð¶Ð½Ð° Ñодержать {{ limit }} Ñлемент или больше.|Эта ÐºÐ¾Ð»Ð»ÐµÐºÑ†Ð¸Ñ Ð´Ð¾Ð»Ð¶Ð½Ð° Ñодержать {{ limit }} Ñлемента или больше.|Эта ÐºÐ¾Ð»Ð»ÐµÐºÑ†Ð¸Ñ Ð´Ð¾Ð»Ð¶Ð½Ð° Ñодержать {{ limit }} Ñлементов или больше. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Эта ÐºÐ¾Ð»Ð»ÐµÐºÑ†Ð¸Ñ Ð´Ð¾Ð»Ð¶Ð½Ð° Ñодержать {{ limit }} Ñлемент или меньше.|Эта ÐºÐ¾Ð»Ð»ÐµÐºÑ†Ð¸Ñ Ð´Ð¾Ð»Ð¶Ð½Ð° Ñодержать {{ limit }} Ñлемента или меньше.|Эта ÐºÐ¾Ð»Ð»ÐµÐºÑ†Ð¸Ñ Ð´Ð¾Ð»Ð¶Ð½Ð° Ñодержать {{ limit }} Ñлементов или меньше. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Эта ÐºÐ¾Ð»Ð»ÐµÐºÑ†Ð¸Ñ Ð´Ð¾Ð»Ð¶Ð½Ð° Ñодержать ровно {{ limit }} Ñлемент.|Эта ÐºÐ¾Ð»Ð»ÐµÐºÑ†Ð¸Ñ Ð´Ð¾Ð»Ð¶Ð½Ð° Ñодержать ровно {{ limit }} Ñлемента.|Эта ÐºÐ¾Ð»Ð»ÐµÐºÑ†Ð¸Ñ Ð´Ð¾Ð»Ð¶Ð½Ð° Ñодержать ровно {{ limit }} Ñлементов. + + + Invalid card number. + Ðеверный номер карты. + + + Unsupported card type or invalid card number. + Ðеподдерживаемый тип или неверный номер карты. + + + This is not a valid International Bank Account Number (IBAN). + Значение не ÑвлÑетÑÑ Ð´Ð¾Ð¿ÑƒÑтимым международным номером банковÑкого Ñчета (IBAN). + + + This value is not a valid ISBN-10. + Значение имеет неверный формат ISBN-10. + + + This value is not a valid ISBN-13. + Значение имеет неверный формат ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Значение не ÑоответÑтвует форматам ISBN-10 и ISBN-13. + + + This value is not a valid ISSN. + Значение не ÑоответÑтвует формату ISSN. + + + This value is not a valid currency. + Ðекорректный формат валюты. + + + This value should be equal to {{ compared_value }}. + Значение должно быть равно {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Значение должно быть больше чем {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Значение должно быть больше или равно {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Значение должно быть идентичным {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Значение должно быть меньше чем {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Значение должно быть меньше или равно {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Значение не должно быть равно {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Значение не должно быть идентичным {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Соотношение Ñторон Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ñлишком велико ({{ ratio }}). МакÑимальное Ñоотношение Ñторон {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Соотношение Ñторон Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ñлишком мало ({{ ratio }}). Минимальное Ñоотношение Ñторон {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Изображение квадратное ({{ width }}x{{ height }}px). Квадратные Ð¸Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð½Ðµ разрешены. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Изображение в альбомной ориентации ({{ width }}x{{ height }}px). Ð˜Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð² альбомной ориентации не разрешены. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Изображение в портретной ориентации ({{ width }}x{{ height }}px). Ð˜Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð² портретной ориентации не разрешены. + + + An empty file is not allowed. + ПуÑтые файлы не разрешены. + + + The host could not be resolved. + Ð˜Ð¼Ñ Ñ…Ð¾Ñта не может быть разрешено. + + + This value does not match the expected {{ charset }} charset. + Значение не Ñовпадает Ñ Ð¾Ð¶Ð¸Ð´Ð°ÐµÐ¼Ð¾Ð¹ {{ charset }} кодировкой. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.sk.xlf b/core/vendor/symfony/validator/Resources/translations/validators.sk.xlf new file mode 100644 index 0000000..46f3ec3 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.sk.xlf @@ -0,0 +1,307 @@ + + + + + + This value should be false. + Táto hodnota by mala byÅ¥ nastavená na false. + + + This value should be true. + Táto hodnota by mala byÅ¥ nastavená na true. + + + This value should be of type {{ type }}. + Táto hodnota by mala byÅ¥ typu {{ type }}. + + + This value should be blank. + Táto hodnota by mala byÅ¥ prázdna. + + + The value you selected is not a valid choice. + Táto hodnota by mala byÅ¥ jednou z poskytnutých možností. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Mali by ste vybraÅ¥ minimálne {{ limit }} možnosÅ¥.|Mali by ste vybraÅ¥ minimálne {{ limit }} možnosti.|Mali by ste vybraÅ¥ minimálne {{ limit }} možností. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Mali by ste vybraÅ¥ najviac {{ limit }} možnosÅ¥.|Mali by ste vybraÅ¥ najviac {{ limit }} možnosti.|Mali by ste vybraÅ¥ najviac {{ limit }} možností. + + + One or more of the given values is invalid. + Niektoré z uvedených hodnôt sú neplatné. + + + This field was not expected. + Toto pole sa neoÄakáva. + + + This field is missing. + Toto pole chýba. + + + This value is not a valid date. + Tato hodnota nemá platný formát dátumu. + + + This value is not a valid datetime. + Táto hodnota nemá platný formát dátumu a Äasu. + + + This value is not a valid email address. + Táto hodnota nie je platná emailová adresa. + + + The file could not be found. + Súbor sa nenaÅ¡iel. + + + The file is not readable. + Súbor nie je Äitateľný. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Súbor je príliÅ¡ veľký ({{ size }} {{ suffix }}). Maximálna povolená veľkosÅ¥ je {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Súbor typu ({{ type }}) nie je podporovaný. Podporované typy sú {{ types }}. + + + This value should be {{ limit }} or less. + Táto hodnota by mala byÅ¥ {{ limit }} alebo menej. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Táto hodnota obsahuje viac znakov ako je povolené. Mala by obsahovaÅ¥ najviac {{ limit }} znak.|Táto hodnota obsahuje viac znakov ako je povolené. Mala by obsahovaÅ¥ najviac {{ limit }} znaky.|Táto hodnota obsahuje viac znakov ako je povolené. Mala by obsahovaÅ¥ najviac {{ limit }} znakov. + + + This value should be {{ limit }} or more. + Táto hodnota by mala byÅ¥ viac ako {{ limit }}. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Táto hodnota je príliÅ¡ krátka. Musí obsahovaÅ¥ minimálne {{ limit }} znak.|Táto hodnota je príliÅ¡ krátka. Musí obsahovaÅ¥ minimálne {{ limit }} znaky.|Táto hodnota je príliÅ¡ krátka. Minimálny poÄet znakov je {{ limit }}. + + + This value should not be blank. + Táto hodnota by mala byÅ¥ vyplnená. + + + This value should not be null. + Táto hodnota by nemala byÅ¥ null. + + + This value should be null. + Táto hodnota by mala byÅ¥ null. + + + This value is not valid. + Táto hodnota nie je platná. + + + This value is not a valid time. + Tato hodnota nemá správny formát Äasu. + + + This value is not a valid URL. + Táto hodnota nie je platnou URL adresou. + + + The two values should be equal. + Tieto dve hodnoty by mali byÅ¥ rovnaké. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Súbor je príliÅ¡ veľký. Maximálna povolená veľkosÅ¥ je {{ limit }} {{ suffix }}. + + + The file is too large. + Súbor je príliÅ¡ veľký. + + + The file could not be uploaded. + Súbor sa nepodarilo nahraÅ¥. + + + This value should be a valid number. + Táto hodnota by mala byÅ¥ Äíslo. + + + This file is not a valid image. + Tento súbor nie je obrázok. + + + This is not a valid IP address. + Toto nie je platná IP adresa. + + + This value is not a valid language. + Tento jazyk neexistuje. + + + This value is not a valid locale. + Táto lokalizácia neexistuje. + + + This value is not a valid country. + Táto krajina neexistuje. + + + This value is already used. + Táto hodnota sa už používa. + + + The size of the image could not be detected. + Nepodarilo sa zistiÅ¥ rozmery obrázku. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Obrázok je príliÅ¡ Å¡iroký ({{ width }}px). Maximálna povolená šírka obrázku je {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Obrázok je príliÅ¡ úzky ({{ width }}px). Minimálna šírka obrázku by mala byÅ¥ {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + >Obrázok je príliÅ¡ vysoký ({{ height }}px). Maximálna povolená výška obrázku je {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Obrázok je príliÅ¡ nízky ({{ height }}px). Minimálna výška obrázku by mala byÅ¥ {{ min_height }}px. + + + This value should be the user's current password. + Táto hodnota by mala byÅ¥ aktuálne heslo používateľa. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Táto hodnota by mala maÅ¥ presne {{ limit }} znak.|Táto hodnota by mala maÅ¥ presne {{ limit }} znaky.|Táto hodnota by mala maÅ¥ presne {{ limit }} znakov. + + + The file was only partially uploaded. + Bola nahraná len ÄasÅ¥ súboru. + + + No file was uploaded. + Žiadny súbor nebol nahraný. + + + No temporary folder was configured in php.ini. + V php.ini nie je nastavená cesta k adresáru pre doÄasné súbory. + + + Cannot write temporary file to disk. + DoÄasný súbor sa nepodarilo zapísaÅ¥ na disk. + + + A PHP extension caused the upload to fail. + Rozšírenie PHP zabránilo nahraniu súboru. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Táto kolekcia by mala obsahovaÅ¥ aspoň {{ limit }} prvok alebo viac.|Táto kolekcia by mala obsahovaÅ¥ aspoň {{ limit }} prvky alebo viac.|Táto kolekcia by mala obsahovaÅ¥ aspoň {{ limit }} prvkov alebo viac. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Táto kolekcia by mala maximálne {{ limit }} prvok.|Táto kolekcia by mala obsahovaÅ¥ maximálne {{ limit }} prvky.|Táto kolekcia by mala obsahovaÅ¥ maximálne {{ limit }} prvkov. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Táto kolekcia by mala obsahovaÅ¥ presne {{ limit }} prvok.|Táto kolekcia by mala obsahovaÅ¥ presne {{ limit }} prvky.|Táto kolekcia by mala obsahovaÅ¥ presne {{ limit }} prvkov. + + + Invalid card number. + Neplatné Äíslo karty. + + + Unsupported card type or invalid card number. + Nepodporovaný typ karty alebo neplatné Äíslo karty. + + + This is not a valid International Bank Account Number (IBAN). + Toto je neplatný IBAN. + + + This value is not a valid ISBN-10. + Táto hodnota je neplatné ISBN-10. + + + This value is not a valid ISBN-13. + Táto hodnota je neplatné ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Táto hodnota nie je platné ISBN-10 ani ISBN-13. + + + This value is not a valid ISSN. + Táto hodnota nie je platné ISSN. + + + This value is not a valid currency. + Táto hodnota nie je platná mena. + + + This value should be equal to {{ compared_value }}. + Táto hodnota by mala byÅ¥ rovná {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Táto hodnota by mala byÅ¥ väÄÅ¡ia ako {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Táto hodnota by mala byÅ¥ väÄÅ¡ia alebo rovná {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Táto hodnota by mala byÅ¥ typu {{ compared_value_type }} a zároveň by mala byÅ¥ rovná {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Táto hodnota by mala byÅ¥ menÅ¡ia ako {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Táto hodnota by mala byÅ¥ menÅ¡ia alebo rovná {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Táto hodnota by nemala byÅ¥ rovná {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Táto hodnota by nemala byÅ¥ typu {{ compared_value_type }} a zároveň by nemala byÅ¥ rovná {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Pomer strán obrázku je príliÅ¡ veľký ({{ ratio }}). Maximálny povolený pomer strán obrázku je {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Pomer strán obrázku je príliÅ¡ malý ({{ ratio }}). Minimálny povolený pomer strán obrázku je {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Strany obrázku sú Å¡tvorcové ({{ width }}x{{ height }}px). Å tvorcové obrázky nie sú povolené. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Obrázok je orientovaný na šírku ({{ width }}x{{ height }}px). Obrázky orientované na šírku nie sú povolené. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Obrázok je orientovaný na výšku ({{ width }}x{{ height }}px). Obrázky orientované na výšku nie sú povolené. + + + An empty file is not allowed. + Súbor nesmie byÅ¥ prázdny. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.sl.xlf b/core/vendor/symfony/validator/Resources/translations/validators.sl.xlf new file mode 100644 index 0000000..4f0e7c6 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.sl.xlf @@ -0,0 +1,315 @@ + + + + + + This value should be false. + Vrednost bi morala biti nepravilna (false). + + + This value should be true. + Vrednost bi morala biti pravilna (true). + + + This value should be of type {{ type }}. + Vrednost mora biti naslednjega tipa {{ type }}. + + + This value should be blank. + Vrednost mora biti prazna. + + + The value you selected is not a valid choice. + Vrednost, ki ste jo izbrali, ni veljavna možnost. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Izbrati morate vsaj {{ limit }} možnost.|Izbrati morate vsaj {{ limit }} možnosti.|Izbrati morate vsaj {{ limit }} možnosti.|Izbrati morate vsaj {{ limit }} možnosti. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Izberete lahko najveÄ {{ limit }} možnost.|Izberete lahko najveÄ {{ limit }} možnosti.|Izberete lahko najveÄ {{ limit }} možnosti.|Izberete lahko najveÄ {{ limit }} možnosti. + + + One or more of the given values is invalid. + Ena ali veÄ podanih vrednosti ni veljavnih. + + + This field was not expected. + To polje ni bilo priÄakovati. + + + This field is missing. + To polje manjka. + + + This value is not a valid date. + Ta vrednost ni veljaven datum. + + + This value is not a valid datetime. + Ta vrednost ni veljaven datum in Äas. + + + This value is not a valid email address. + Ta vrednost ni veljaven e-poÅ¡tni naslov. + + + The file could not be found. + Datoteke ni mogoÄe najti. + + + The file is not readable. + Datoteke ni mogoÄe prebrati. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Datoteka je prevelika ({{ size }} {{ suffix }}). NajveÄja dovoljena velikost je {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Mime tip datoteke je neveljaven ({{ type }}). Dovoljeni mime tipi so {{ types }}. + + + This value should be {{ limit }} or less. + Ta vrednost bi morala biti {{ limit }} ali manj. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Ta vrednost je predolga. Morala bi imeti {{ limit }} znak ali manj.|Ta vrednost je predolga. Morala bi imeti {{ limit }} znaka ali manj.|Ta vrednost je predolga. Morala bi imeti {{ limit }} znake ali manj.|Ta vrednost je predolga. Morala bi imeti {{ limit }} znakov ali manj. + + + This value should be {{ limit }} or more. + Ta vrednost bi morala biti {{ limit }} ali veÄ. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Ta vrednost je prekratka. Morala bi imeti {{ limit }} znak ali veÄ.|Ta vrednost je prekratka. Morala bi imeti {{ limit }} znaka ali veÄ.|Ta vrednost je prekratka. Morala bi imeti {{ limit }} znake ali veÄ.|Ta vrednost je prekratka. Morala bi imeti {{ limit }} znakov ali veÄ. + + + This value should not be blank. + Ta vrednost ne bi smela biti prazna. + + + This value should not be null. + Ta vrednost ne bi smela biti nedefinirana (null). + + + This value should be null. + Ta vrednost bi morala biti nedefinirana (null). + + + This value is not valid. + Ta vrednost ni veljavna. + + + This value is not a valid time. + Ta vrednost ni veljaven Äas. + + + This value is not a valid URL. + Ta vrednost ni veljaven URL. + + + The two values should be equal. + Ti dve vrednosti bi morali biti enaki. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Datoteka je prevelika. NajveÄja dovoljena velikost je {{ limit }} {{ suffix }}. + + + The file is too large. + Datoteka je prevelika. + + + The file could not be uploaded. + Datoteke ni bilo mogoÄe naložiti. + + + This value should be a valid number. + Ta vrednost bi morala biti veljavna Å¡tevilka. + + + This file is not a valid image. + Ta datoteka ni veljavna slika. + + + This is not a valid IP address. + To ni veljaven IP naslov. + + + This value is not a valid language. + Ta vrednost ni veljaven jezik. + + + This value is not a valid locale. + Ta vrednost ni veljavna lokalnost. + + + This value is not a valid country. + Ta vrednost ni veljavna država. + + + This value is already used. + Ta vrednost je že uporabljena. + + + The size of the image could not be detected. + Velikosti slike ni bilo mogoÄe zaznati. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Å irina slike je preÅ¡iroka ({{ width }}px). NajveÄja dovoljena Å¡irina je {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Å irina slike je premajhna ({{ width }}px). NajmanjÅ¡a predvidena Å¡irina je {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + ViÅ¡ina slike je prevelika ({{ height }}px). NajveÄja dovoljena viÅ¡ina je {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + ViÅ¡ina slike je premajhna ({{ height }}px). NajmanjÅ¡a predvidena viÅ¡ina je {{ min_height }}px. + + + This value should be the user's current password. + Ta vrednost bi morala biti trenutno uporabnikovo geslo. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Ta vrednost bi morala imeti toÄno {{ limit }} znak.|Ta vrednost bi morala imeti toÄno {{ limit }} znaka.|Ta vrednost bi morala imeti toÄno {{ limit }} znake.|Ta vrednost bi morala imeti toÄno {{ limit }} znakov. + + + The file was only partially uploaded. + Datoteka je bila le delno naložena. + + + No file was uploaded. + Nobena datoteka ni bila naložena. + + + No temporary folder was configured in php.ini. + ZaÄasna mapa ni nastavljena v php.ini. + + + Cannot write temporary file to disk. + ZaÄasne datoteke ni bilo mogoÄe zapisati na disk. + + + A PHP extension caused the upload to fail. + PHP razÅ¡iritev je vzrok, da nalaganje ni uspelo. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ta zbirka bi morala vsebovati {{ limit }} element ali veÄ.|Ta zbirka bi morala vsebovati {{ limit }} elementa ali veÄ.|Ta zbirka bi morala vsebovati {{ limit }} elemente ali veÄ.|Ta zbirka bi morala vsebovati {{ limit }} elementov ali veÄ. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ta zbirka bi morala vsebovati {{ limit }} element ali manj.|Ta zbirka bi morala vsebovati {{ limit }} elementa ali manj.|Ta zbirka bi morala vsebovati {{ limit }} elemente ali manj.|Ta zbirka bi morala vsebovati {{ limit }} elementov ali manj. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ta zbirka bi morala vsebovati toÄno {{ limit }} element.|Ta zbirka bi morala vsebovati toÄno {{ limit }} elementa.|Ta zbirka bi morala vsebovati toÄno {{ limit }} elemente.|Ta zbirka bi morala vsebovati toÄno {{ limit }} elementov. + + + Invalid card number. + Neveljavna Å¡tevilka kartice. + + + Unsupported card type or invalid card number. + Nepodprti tip kartice ali neveljavna Å¡tevilka kartice. + + + This is not a valid International Bank Account Number (IBAN). + To ni veljavna mednarodna Å¡tevilka banÄnega raÄuna (IBAN). + + + This value is not a valid ISBN-10. + Neveljavna vrednost po ISBN-10. + + + This value is not a valid ISBN-13. + Neveljavna vrednost po ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Neveljavna vrednost po ISBN-10 ali po ISBN-13. + + + This value is not a valid ISSN. + Neveljavna vrednost ISSN. + + + This value is not a valid currency. + Ta vrednost ni veljavna valuta. + + + This value should be equal to {{ compared_value }}. + Ta vrednost bi morala biti enaka {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Ta vrednost bi morala biti veÄja od {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Ta vrednost bi morala biti veÄja ali enaka {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Ta vrednost bi morala biti identiÄna {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Ta vrednost bi morala biti manjÅ¡a od {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Ta vrednost bi morala biti manjÅ¡a ali enaka {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Ta vrednost ne bi smela biti enaka {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Ta vrednost ne bi smela biti identiÄna {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Razmerje slike je preveliko ({{ ratio }}). NajveÄje dovoljeno razmerje je {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Razmerje slike je premajhno ({{ ratio }}). NajmanjÅ¡e priÄakovano razmerje je {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Slika je kvadrat ({{ width }}x{{ height }}px). Kvadratne slike niso dovoljene. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Slika je ležeÄe usmerjena ({{ width }}x{{ height }}px). LežeÄe usmerjene slike niso dovoljene. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Slika je pokonÄno usmerjena ({{ width }}x{{ height }}px). PokonÄno usmerjene slike niso dovoljene. + + + An empty file is not allowed. + Prazna datoteka ni dovoljena. + + + The host could not be resolved. + Gostitelja ni bilo mogoÄe prepoznati. + + + This value does not match the expected {{ charset }} charset. + Ta vrednost se ne ujema s priÄakovanim naborom znakov {{ charset }}. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.sq.xlf b/core/vendor/symfony/validator/Resources/translations/validators.sq.xlf new file mode 100644 index 0000000..ffc8ccf --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.sq.xlf @@ -0,0 +1,227 @@ + + + + + + This value should be false. + Kjo vlerë duhet të jetë e pavërtetë (false). + + + This value should be true. + Kjo vlerë duhet të jetë e vërtetë (true). + + + This value should be of type {{ type }}. + Kjo vlerë duhet të jetë e llojit {{ type }}. + + + This value should be blank. + Kjo vlerë duhet të jetë e zbrazët. + + + The value you selected is not a valid choice. + Vlera që keni zgjedhur nuk është alternativë e vlefshme. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Duhet të zgjedhni së paku {{ limit }} alternativa.|Duhet të zgjedhni së paku {{ limit }} alternativa. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Duhet të zgjedhni më së shumti {{ limit }} alternativa.|Duhet të zgjedhni më së shumti {{ limit }} alternativa. + + + One or more of the given values is invalid. + Një apo më shumë nga vlerat e dhëna nuk janë të sakta. + + + This field was not expected. + Kjo fushë nuk pritej. + + + This field is missing. + Kjo fushë është zhdukur. + + + This value is not a valid date. + Kjo vlerë nuk është datë e vlefshme. + + + This value is not a valid datetime. + Kjo vlerë nuk është datë-kohë e vlefshme. + + + This value is not a valid email address. + Kjo vlerë nuk është e-mail adresë e vlefshme. + + + The file could not be found. + File nuk mund të gjindej. + + + The file is not readable. + File nuk është i lexueshëm. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + File është shumë i madh ({{ size }} {{ suffix }}). Madhësia më e madhe e lejuar është {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Lloji mime i files nuk është i vlefshëm ({{ type }}). Llojet mime të lejuara janë {{ types }}. + + + This value should be {{ limit }} or less. + Kjo vlerë duhet të jetë {{ limit }} ose më pak. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Kjo vlerë është shumë e gjatë. Duhet t'i ketë {{ limit }} ose më pak karaktere.|Kjo vlerë është shumë e gjatë. Duhet t'i ketë {{ limit }} ose më pak karaktere. + + + This value should be {{ limit }} or more. + Kjo vlerë duhet të jetë {{ limit }} ose më shumë. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Kjo vlerë është shumë e shkurtër. Duhet t'i ketë {{ limit }} ose më shumë karaktere.|Kjo vlerë është shumë e shkurtër. Duhet t'i ketë {{ limit }} ose më shumë karaktere. + + + This value should not be blank. + Kjo vlerë nuk duhet të jetë e zbrazët. + + + This value should not be null. + Kjo vlerë nuk duhet të jetë null. + + + This value should be null. + Kjo vlerë duhet të jetë null. + + + This value is not valid. + Kjo vlerë nuk është e vlefshme. + + + This value is not a valid time. + Kjo vlerë nuk është kohë e vlefshme. + + + This value is not a valid URL. + Kjo vlerë nuk është URL e vlefshme. + + + The two values should be equal. + Këto dy vlera duhet të jenë të barabarta. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Ky file është shumë i madh. Madhësia maksimale e lejuar është {{ limit }} {{ suffix }}. + + + The file is too large. + Ky file është shumë i madh. + + + The file could not be uploaded. + Ky file nuk mund të ngarkohet. + + + This value should be a valid number. + Kjo vlerë duhet të jetë numër i vlefshëm. + + + This file is not a valid image. + Ky file nuk është imazh i vlefshëm. + + + This is not a valid IP address. + Kjo vlerë nuk është IP adresë e vlefshme. + + + This value is not a valid language. + Kjo vlerë nuk është gjuhë e vlefshme. + + + This value is not a valid locale. + Kjo vlerë nuk është përcaktim rajonal i vlefshëm. + + + This value is not a valid country. + Kjo vlerë nuk është shtet i vlefshëm. + + + This value is already used. + Kjo vlerë është tashmë në përdorim. + + + The size of the image could not be detected. + Madhësia e këtij imazhi nuk mund të zbulohet. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Gjerësia e imazhit është shumë e madhe ({{ width }}px). Gjerësia maksimale e lejuar është {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Gjerësia e imazhit është shumë e vogël ({{ width }}px). Gjerësia minimale e pritur është {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Gjatësia e imazhit është shumë e madhe ({{ height }}px). Gjatësia maksimale e lejuar është {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Gjatësia e imazhit është shumë e vogël ({{ height }}px). Gjatësia minimale e pritur është {{ min_height }}px. + + + This value should be the user's current password. + Kjo vlerë duhet të jetë fjalëkalimi aktual i përdoruesit. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Kjo vlerë duhet të ketë saktësisht {{ limit }} karaktere.|Kjo vlerë duhet të ketë saktësisht {{ limit }} karaktere. + + + The file was only partially uploaded. + Ky file është ngarkuar pjesërisht. + + + No file was uploaded. + Nuk është ngarkuar ndonjë file. + + + No temporary folder was configured in php.ini. + Asnjë folder i përkohshëm nuk është konfiguruar në php.ini. + + + Cannot write temporary file to disk. + Nuk mund të shkruhet file i përkohshëm në disk. + + + A PHP extension caused the upload to fail. + Një ekstenzion i PHP-së bëri të dështojë ngarkimi i files. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ky kolekcion duhet të përmbajë {{ limit }} ose më shumë elemente.|Ky kolekcion duhet të përmbajë {{ limit }} ose më shumë elemente. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ky kolekcion duhet të përmbajë {{ limit }} ose më shumë elemente.|Ky kolekcion duhet të përmbajë {{ limit }} ose më shumë elemente. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ky kolekcion duhet të përmbajë saktësisht {{ limit }} elemente.|Ky kolekcion duhet të përmbajë saktësisht {{ limit }} elemente. + + + Invalid card number. + Numër kartele i pavlefshëm. + + + Unsupported card type or invalid card number. + Lloj kartele i pambështetur ose numër kartele i pavlefshëm. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.sr_Cyrl.xlf b/core/vendor/symfony/validator/Resources/translations/validators.sr_Cyrl.xlf new file mode 100644 index 0000000..81f5210 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.sr_Cyrl.xlf @@ -0,0 +1,303 @@ + + + + + + This value should be false. + ВредноÑÑ‚ треба да буде нетачна. + + + This value should be true. + ВредноÑÑ‚ треба да буде тачна. + + + This value should be of type {{ type }}. + ВредноÑÑ‚ треба да буде типа {{ type }}. + + + This value should be blank. + ВредноÑÑ‚ треба да буде празна. + + + The value you selected is not a valid choice. + ВредноÑÑ‚ треба да буде једна од понуђених. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Изаберите бар {{ limit }} могућноÑÑ‚.|Изаберите бар {{ limit }} могућноÑти.|Изаберите бар {{ limit }} могућноÑти. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Изаберите највише {{ limit }} могућноÑÑ‚.|Изаберите највише {{ limit }} могућноÑти.|Изаберите највише {{ limit }} могућноÑти. + + + One or more of the given values is invalid. + Једна или више вредноÑти је невалидна. + + + This field was not expected. + Ово поље не очекује. + + + This field is missing. + Ово поље недоÑтаје. + + + This value is not a valid date. + ВредноÑÑ‚ није валидан датум. + + + This value is not a valid datetime. + ВредноÑÑ‚ није валидан датум-време. + + + This value is not a valid email address. + ВредноÑÑ‚ није валидна адреÑа електронÑке поште. + + + The file could not be found. + Датотека не може бити пронађена. + + + The file is not readable. + Датотека није читљива. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Датотека је превелика ({{ size }} {{ suffix }}). Ðајвећа дозвољена величина је {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Миме тип датотеке није валидан ({{ type }}). Дозвољени миме типови Ñу {{ types }}. + + + This value should be {{ limit }} or less. + ВредноÑÑ‚ треба да буде {{ limit }} или мање. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + ВредноÑÑ‚ је предугачка. Треба да има {{ limit }} карактер или мање.|ВредноÑÑ‚ је предугачка. Треба да има {{ limit }} карактера или мање.|ВредноÑÑ‚ је предугачка. Треба да има {{ limit }} карактера или мање. + + + This value should be {{ limit }} or more. + ВредноÑÑ‚ треба да буде {{ limit }} или више. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + ВредноÑÑ‚ је прекратка. Треба да има {{ limit }} карактер или више.|ВредноÑÑ‚ је прекратка. Треба да има {{ limit }} карактера или више.|ВредноÑÑ‚ је прекратка. Треба да има {{ limit }} карактера или више. + + + This value should not be blank. + ВредноÑÑ‚ не треба да буде празна. + + + This value should not be null. + ВредноÑÑ‚ не треба да буде null. + + + This value should be null. + ВредноÑÑ‚ треба да буде null. + + + This value is not valid. + ВредноÑÑ‚ је невалидна. + + + This value is not a valid time. + ВредноÑÑ‚ није валидно време. + + + This value is not a valid URL. + ВредноÑÑ‚ није валидан URL. + + + The two values should be equal. + Обе вредноÑти треба да буду једнаке. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Датотека је превелика. Ðајвећа дозвољена величина је {{ limit }} {{ suffix }}. + + + The file is too large. + Датотека је превелика. + + + The file could not be uploaded. + Датотека не може бити отпремљена. + + + This value should be a valid number. + ВредноÑÑ‚ треба да буде валидан број. + + + This file is not a valid image. + Ова датотека није валидна Ñлика. + + + This is not a valid IP address. + Ово није валидна ИП адреÑа. + + + This value is not a valid language. + ВредноÑÑ‚ није валидан језик. + + + This value is not a valid locale. + ВредноÑÑ‚ није валидан локал. + + + This value is not a valid country. + ВредноÑÑ‚ није валидна земља. + + + This value is already used. + ВредноÑÑ‚ је већ иÑкоришћена. + + + The size of the image could not be detected. + Величина Ñлике не може бити одређена. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Ширина Ñлике је превелика ({{ width }}px). Ðајећа дозвољена ширина је {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Ширина Ñлике је премала ({{ width }}px). Ðајмања дозвољена ширина је {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + ВиÑина Ñлике је превелика ({{ height }}px). Ðајећа дозвољена виÑина је {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + ВиÑина Ñлике је премала ({{ height }}px). Ðајмања дозвољена виÑина је {{ min_height }}px. + + + This value should be the user's current password. + ВредноÑÑ‚ треба да буде тренутна кориÑничка лозинка. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + ВредноÑÑ‚ треба да има тачно {{ limit }} карактер.|ВредноÑÑ‚ треба да има тачно {{ limit }} карактера.|ВредноÑÑ‚ треба да има тачно {{ limit }} карактера. + + + The file was only partially uploaded. + Датотека је Ñамо парцијално отпремљена. + + + No file was uploaded. + Датотека није отпремљена. + + + No temporary folder was configured in php.ini. + Привремени директоријум није конфигуриÑан у php.ini. + + + Cannot write temporary file to disk. + Ðемогуће пиÑање привремене датотеке на диÑк. + + + A PHP extension caused the upload to fail. + PHP екÑтензија је проузроковала неуÑпех отпремања датотеке. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ова колекција треба да Ñадржи {{ limit }} или више елемената.|Ова колекција треба да Ñадржи {{ limit }} или више елемената.|Ова колекција треба да Ñадржи {{ limit }} или више елемената. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ова колекција треба да Ñадржи {{ limit }} или мање елемената.|Ова колекција треба да Ñадржи {{ limit }} или мање елемената.|Ова колекција треба да Ñадржи {{ limit }} или мање елемената. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ова колекција треба да Ñадржи тачно {{ limit }} елемент.|Ова колекција треба да Ñадржи тачно {{ limit }} елемента.|Ова колекција треба да Ñадржи тачно {{ limit }} елемената. + + + Invalid card number. + Ðевалидан број картице. + + + Unsupported card type or invalid card number. + Ðевалидан број картице или тип картице није подржан. + + + This is not a valid International Bank Account Number (IBAN). + Ово није валидан међународни број банковног рачуна (IBAN). + + + This value is not a valid ISBN-10. + Ово није валидан ISBN-10. + + + This value is not a valid ISBN-13. + Ово није валидан ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Ово није валидан ISBN-10 или ISBN-13. + + + This value is not a valid ISSN. + Ово није валидан ISSN. + + + This value is not a valid currency. + Ово није валидна валута. + + + This value should be equal to {{ compared_value }}. + Ова вредноÑÑ‚ треба да буде {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Ова вредноÑÑ‚ треба да буде већа од {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Ова вредноÑÑ‚ треба да буде већа или једнака {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Ова вредноÑÑ‚ треба да буде идентична Ñа {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Ова вредноÑÑ‚ треба да буде мања од {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Ова вредноÑÑ‚ треба да буде мања или једнака {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Ова вредноÑÑ‚ не треба да буде једнака {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Ова вредноÑÑ‚ не треба да буде идентична Ñа {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Размера ове Ñлике је превелика ({{ ratio }}). МакÑимална дозвољена размера је {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Размера ове Ñлике је премала ({{ ratio }}). Минимална очекивана размера је {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Слика је квадратна ({{ width }}x{{ height }}px). Квадратне Ñлике ниÑу дозвољене. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Слика је оријентације пејзажа ({{ width }}x{{ height }}px). Пејзажна оријентација Ñлика није дозвољена. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Слика је оријантације портрета ({{ width }}x{{ height }}px). Портретна оријентација Ñлика није дозвољена. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.sr_Latn.xlf b/core/vendor/symfony/validator/Resources/translations/validators.sr_Latn.xlf new file mode 100644 index 0000000..60c093a --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.sr_Latn.xlf @@ -0,0 +1,303 @@ + + + + + + This value should be false. + Vrednost treba da bude netaÄna. + + + This value should be true. + Vrednost treba da bude taÄna. + + + This value should be of type {{ type }}. + Vrednost treba da bude tipa {{ type }}. + + + This value should be blank. + Vrednost treba da bude prazna. + + + The value you selected is not a valid choice. + Vrednost treba da bude jedna od ponuÄ‘enih. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Izaberite bar {{ limit }} mogućnost.|Izaberite bar {{ limit }} mogućnosti.|Izaberite bar {{ limit }} mogućnosti. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Izaberite najviÅ¡e {{ limit }} mogućnost.|Izaberite najviÅ¡e {{ limit }} mogućnosti.|Izaberite najviÅ¡e {{ limit }} mogućnosti. + + + One or more of the given values is invalid. + Jedna ili viÅ¡e vrednosti je nevalidna. + + + This field was not expected. + Ovo polje ne oÄekuje. + + + This field is missing. + Ovo polje nedostaje. + + + This value is not a valid date. + Vrednost nije validan datum. + + + This value is not a valid datetime. + Vrednost nije validan datum-vreme. + + + This value is not a valid email address. + Vrednost nije validna adresa elektronske poÅ¡te. + + + The file could not be found. + Datoteka ne može biti pronaÄ‘ena. + + + The file is not readable. + Datoteka nije Äitljiva. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Datoteka je prevelika ({{ size }} {{ suffix }}). Najveća dozvoljena veliÄina je {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Mime tip datoteke nije validan ({{ type }}). Dozvoljeni mime tipovi su {{ types }}. + + + This value should be {{ limit }} or less. + Vrednost treba da bude {{ limit }} ili manje. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Vrednost je predugaÄka. Treba da ima {{ limit }} karakter ili manje.|Vrednost je predugaÄka. Treba da ima {{ limit }} karaktera ili manje.|Vrednost je predugaÄka. Treba da ima {{ limit }} karaktera ili manje. + + + This value should be {{ limit }} or more. + Vrednost treba da bude {{ limit }} ili viÅ¡e. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Vrednost je prekratka. Treba da ima {{ limit }} karakter ili viÅ¡e.|Vrednost je prekratka. Treba da ima {{ limit }} karaktera ili viÅ¡e.|Vrednost je prekratka. Treba da ima {{ limit }} karaktera ili viÅ¡e. + + + This value should not be blank. + Vrednost ne treba da bude prazna. + + + This value should not be null. + Vrednost ne treba da bude null. + + + This value should be null. + Vrednost treba da bude null. + + + This value is not valid. + Vrednost je nevalidna. + + + This value is not a valid time. + Vrednost nije validno vreme. + + + This value is not a valid URL. + Vrednost nije validan URL. + + + The two values should be equal. + Obe vrednosti treba da budu jednake. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Datoteka je prevelika. Najveća dozvoljena veliÄina je {{ limit }} {{ suffix }}. + + + The file is too large. + Datoteka je prevelika. + + + The file could not be uploaded. + Datoteka ne može biti otpremljena. + + + This value should be a valid number. + Vrednost treba da bude validan broj. + + + This file is not a valid image. + Ova datoteka nije validna slika. + + + This is not a valid IP address. + Ovo nije validna IP adresa. + + + This value is not a valid language. + Vrednost nije validan jezik. + + + This value is not a valid locale. + Vrednost nije validan lokal. + + + This value is not a valid country. + Vrednost nije validna zemlja. + + + This value is already used. + Vrednost je već iskorišćena. + + + The size of the image could not be detected. + VeliÄina slike ne može biti odreÄ‘ena. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Å irina slike je prevelika ({{ width }}px). Najeća dozvoljena Å¡irina je {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Å irina slike je premala ({{ width }}px). Najmanja dozvoljena Å¡irina je {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Visina slike je prevelika ({{ height }}px). Najeća dozvoljena visina je {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Visina slike je premala ({{ height }}px). Najmanja dozvoljena visina je {{ min_height }}px. + + + This value should be the user's current password. + Vrednost treba da bude trenutna korisniÄka lozinka. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Vrednost treba da ima taÄno {{ limit }} karakter.|Vrednost treba da ima taÄno {{ limit }} karaktera.|Vrednost treba da ima taÄno {{ limit }} karaktera. + + + The file was only partially uploaded. + Datoteka je samo parcijalno otpremljena. + + + No file was uploaded. + Datoteka nije otpremljena. + + + No temporary folder was configured in php.ini. + Privremeni direktorijum nije konfigurisan u php.ini. + + + Cannot write temporary file to disk. + Nemoguće pisanje privremene datoteke na disk. + + + A PHP extension caused the upload to fail. + PHP ekstenzija je prouzrokovala neuspeh otpremanja datoteke. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ova kolekcija treba da sadrži {{ limit }} ili viÅ¡e elemenata.|Ova kolekcija treba da sadrži {{ limit }} ili viÅ¡e elemenata.|Ova kolekcija treba da sadrži {{ limit }} ili viÅ¡e elemenata. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ova kolekcija treba da sadrži {{ limit }} ili manje elemenata.|Ova kolekcija treba da sadrži {{ limit }} ili manje elemenata.|Ova kolekcija treba da sadrži {{ limit }} ili manje elemenata. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ova kolekcija treba da sadrži taÄno {{ limit }} element.|Ova kolekcija treba da sadrži taÄno {{ limit }} elementa.|Ova kolekcija treba da sadrži taÄno {{ limit }} elemenata. + + + Invalid card number. + Nevalidan broj kartice. + + + Unsupported card type or invalid card number. + Nevalidan broj kartice ili tip kartice nije podržan. + + + This is not a valid International Bank Account Number (IBAN). + Ovo nije validan meÄ‘unarodni broj bankovnog raÄuna (IBAN). + + + This value is not a valid ISBN-10. + Ovo nije validan ISBN-10. + + + This value is not a valid ISBN-13. + Ovo nije validan ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Ovo nije validan ISBN-10 ili ISBN-13. + + + This value is not a valid ISSN. + Ovo nije validan ISSN. + + + This value is not a valid currency. + Ovo nije validna valuta. + + + This value should be equal to {{ compared_value }}. + Ova vrednost treba da bude {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Ova vrednost treba da bude veća od {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Ova vrednost treba da bude veća ili jednaka {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Ova vrednost treba da bude identiÄna sa {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Ova vrednost treba da bude manja od {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Ova vrednost treba da bude manja ili jednaka {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Ova vrednost ne treba da bude jednaka {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Ova vrednost ne treba da bude identiÄna sa {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Razmera ove slike je prevelika ({{ ratio }}). Maksimalna dozvoljena razmera je {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Razmera ove slike je premala ({{ ratio }}). Minimalna oÄekivana razmera je {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Slika je kvadratna ({{ width }}x{{ height }}px). Kvadratne slike nisu dozvoljene. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Slika je orijentacije pejzaža ({{ width }}x{{ height }}px). Pejzažna orijentacija slika nije dozvoljena. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Slika je orijantacije portreta ({{ width }}x{{ height }}px). Portretna orijentacija slika nije dozvoljena. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.sv.xlf b/core/vendor/symfony/validator/Resources/translations/validators.sv.xlf new file mode 100644 index 0000000..fbcb5f2 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.sv.xlf @@ -0,0 +1,307 @@ + + + + + + This value should be false. + Värdet ska vara falskt. + + + This value should be true. + Värdet ska vara sant. + + + This value should be of type {{ type }}. + Värdet ska vara av typen {{ type }}. + + + This value should be blank. + Värdet ska vara tomt. + + + The value you selected is not a valid choice. + Värdet ska vara ett av de givna valen. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Du mÃ¥ste välja minst {{ limit }} val.|Du mÃ¥ste välja minst {{ limit }} val. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Du kan som mest välja {{ limit }} val.|Du kan som mest välja {{ limit }} val. + + + One or more of the given values is invalid. + Ett eller fler av de angivna värdena är ogiltigt. + + + This field was not expected. + Det här fältet förväntades inte. + + + This field is missing. + Det här fältet saknas. + + + This value is not a valid date. + Värdet är inte ett giltigt datum. + + + This value is not a valid datetime. + Värdet är inte ett giltigt datum med tid. + + + This value is not a valid email address. + Värdet är inte en giltig epost-adress. + + + The file could not be found. + Filen kunde inte hittas. + + + The file is not readable. + Filen är inte läsbar. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Filen är för stor ({{ size }} {{ suffix }}). Största tillÃ¥tna storlek är {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Filens MIME-typ ({{ type }}) är ogiltig. De tillÃ¥tna typerna är {{ types }}. + + + This value should be {{ limit }} or less. + Värdet ska vara {{ limit }} eller mindre. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Värdet är för lÃ¥ngt. Det ska ha {{ limit }} tecken eller färre.|Värdet är för lÃ¥ngt. Det ska ha {{ limit }} tecken eller färre. + + + This value should be {{ limit }} or more. + Värdet ska vara {{ limit }} eller mer. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Värdet är för kort. Det ska ha {{ limit }} tecken eller mer.|Värdet är för kort. Det ska ha {{ limit }} tecken eller mer. + + + This value should not be blank. + Värdet kan inte vara tomt. + + + This value should not be null. + Värdet kan inte vara null. + + + This value should be null. + Värdet ska vara null. + + + This value is not valid. + Värdet är inte giltigt. + + + This value is not a valid time. + Värdet är inte en giltig tid. + + + This value is not a valid URL. + Värdet är inte en giltig URL. + + + The two values should be equal. + De tvÃ¥ värdena mÃ¥ste vara lika. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Filen är för stor. TillÃ¥ten maximal storlek är {{ limit }} {{ suffix }}. + + + The file is too large. + Filen är för stor. + + + The file could not be uploaded. + Filen kunde inte laddas upp. + + + This value should be a valid number. + Värdet ska vara ett giltigt nummer. + + + This file is not a valid image. + Filen är ingen giltig bild. + + + This is not a valid IP address. + Det här är inte en giltig IP-adress. + + + This value is not a valid language. + Värdet är inte ett giltigt sprÃ¥k. + + + This value is not a valid locale. + Värdet är inte en giltig plats. + + + This value is not a valid country. + Värdet är inte ett giltigt land. + + + This value is already used. + Värdet används redan. + + + The size of the image could not be detected. + Det gick inte att fastställa storleken pÃ¥ bilden. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Bildens bredd är för stor ({{ width }}px). TillÃ¥ten maximal bredd är {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Bildens bredd är för liten ({{ width }}px). Minsta förväntade bredd är {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Bildens höjd är för stor ({{ height }}px). TillÃ¥ten maximal bredd är {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Bildens höjd är för liten ({{ height }}px). Minsta förväntade höjd är {{ min_height }}px. + + + This value should be the user's current password. + Värdet ska vara användarens nuvarande lösenord. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Värdet ska ha exakt {{ limit }} tecken.|Värdet ska ha exakt {{ limit }} tecken. + + + The file was only partially uploaded. + Filen laddades bara upp delvis. + + + No file was uploaded. + Ingen fil laddades upp. + + + No temporary folder was configured in php.ini. + Det finns ingen temporär mapp konfigurerad i php.ini. + + + Cannot write temporary file to disk. + Kan inte skriva temporär fil till disken. + + + A PHP extension caused the upload to fail. + En PHP extension gjorde att uppladdningen misslyckades. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Den här samlingen ska innehÃ¥lla {{ limit }} element eller mer.|Den här samlingen ska innehÃ¥lla {{ limit }} element eller mer. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Den här samlingen ska innehÃ¥lla {{ limit }} element eller mindre.|Den här samlingen ska innehÃ¥lla {{ limit }} element eller mindre. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Den här samlingen ska innehÃ¥lla exakt {{ limit }} element.|Den här samlingen ska innehÃ¥lla exakt {{ limit }} element. + + + Invalid card number. + Ogiltigt kortnummer. + + + Unsupported card type or invalid card number. + Okänd korttyp eller ogiltigt kortnummer. + + + This is not a valid International Bank Account Number (IBAN). + Det här är inte en giltig International Bank Account Number (IBANK). + + + This value is not a valid ISBN-10. + Värdet är inte en giltig ISBN-10. + + + This value is not a valid ISBN-13. + Värdet är inte en giltig ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Värdet är varken en giltig ISBN-10 eller en giltig ISBN-13. + + + This value is not a valid ISSN. + Värdet är inte en giltig ISSN. + + + This value is not a valid currency. + Värdet är inte en giltig valuta. + + + This value should be equal to {{ compared_value }}. + Värdet ska vara detsamma som {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Värdet ska vara större än {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Värdet ska bara större än eller detsamma som {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Värdet ska vara identiskt till {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Värdet ska vara mindre än {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Värdet ska vara mindre än eller detsamma som {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Värdet ska inte vara detsamma som {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Värdet ska inte vara identiskt med {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + FörhÃ¥llandet mellan bildens bredd och höjd är för stort ({{ ratio }}). Högsta tillÃ¥tna förhÃ¥llande är {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + FörhÃ¥llandet mellan bildens bredd och höjd är för litet ({{ ratio }}). Minsta tillÃ¥tna förhÃ¥llande är {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Bilden är kvadratisk ({{ width }}x{{ height }}px). Kvadratiska bilder tillÃ¥ts inte. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Bilden är landskapsorienterad ({{ width }}x{{ height }}px). Landskapsorienterade bilder tillÃ¥ts inte. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Bilden är porträttsorienterad ({{ width }}x{{ height }}px). Porträttsorienterade bilder tillÃ¥ts inte. + + + An empty file is not allowed. + En tom fil är inte tillÃ¥ten. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.th.xlf b/core/vendor/symfony/validator/Resources/translations/validators.th.xlf new file mode 100644 index 0000000..0237a30 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.th.xlf @@ -0,0 +1,303 @@ + + + + + + This value should be false. + ค่านี้ควรจะเป็น false + + + This value should be true. + ค่านี้ควรจะเป็น true + + + This value should be of type {{ type }}. + ค่านี้ควรจะเป็นชนิด {{ type }} + + + This value should be blank. + ควรจะเป็นค่าว่าง + + + The value you selected is not a valid choice. + คุณเลือà¸à¸„่าที่ไม่ตรงà¸à¸±à¸šà¸•à¸±à¸§à¹€à¸¥à¸·à¸­à¸ + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + คุณต้องเลือà¸à¸­à¸¢à¹ˆà¸²à¸‡à¸™à¹‰à¸­à¸¢ {{ limit }} ตัวเลือภ+ + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + คุณเลือà¸à¹„ด้มาà¸à¸—ี่สุด {{ limit }} ตัวเลือภ+ + + One or more of the given values is invalid. + มีบางค่าที่ส่งมาไม่ถูà¸à¸•à¹‰à¸­à¸‡ + + + This field was not expected. + ฟิลด์นี้ที่ไม่ได้คาดหวัง + + + This field is missing. + ฟิลด์นี้จะหายไป + + + This value is not a valid date. + ค่าของวันที่ไม่ถูà¸à¸•à¹‰à¸­à¸‡ + + + This value is not a valid datetime. + ค่าของวันที่à¹à¸¥à¸°à¹€à¸§à¸¥à¸²à¹„ม่ถูà¸à¸•à¹‰à¸­à¸‡ + + + This value is not a valid email address. + ค่าของอีเมล์ไม่ถูà¸à¸•à¹‰à¸­à¸‡ + + + The file could not be found. + ไม่พบไฟล์ + + + The file is not readable. + ไฟล์ไม่อยู่ในสถานะที่สามารถอ่านได้ + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + ไฟล์ใหà¸à¹ˆà¹€à¸à¸´à¸™ ({{ size }} {{ suffix }}) อนุà¸à¸²à¸•à¹ƒà¸«à¹‰à¹ƒà¸«à¸à¹ˆà¸—ี่สุดได้ไม่เà¸à¸´à¸™ {{ limit }} {{ suffix }} + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Mime type ของไฟล์ไม่ถูà¸à¸•à¹‰à¸­à¸‡ ({{ type }}) Mime types ที่อนุà¸à¸²à¸•à¸„ือ {{ types }} + + + This value should be {{ limit }} or less. + ค่านี้ควรจะเป็น {{ limit }} หรือน้อยà¸à¸§à¹ˆà¸²à¸™à¸±à¹‰à¸™ + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + ค่านี้ยาวเà¸à¸´à¸™à¹„ป ควรจะมีà¹à¸„่ {{ limit }} ตัวอัà¸à¸©à¸£à¸«à¸£à¸·à¸­à¸™à¹‰à¸­à¸¢à¸à¸§à¹ˆà¸²à¸™à¸±à¹‰à¸™ + + + This value should be {{ limit }} or more. + ค่านี้ควรจะมี {{ limit }} หรือมาà¸à¸à¸§à¹ˆà¸²à¸™à¸±à¹‰à¸™ + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + ค่านี้สั้นเà¸à¸´à¸™à¹„ป ควรจะมี {{ limit }} ตัวอัà¸à¸©à¸£à¸«à¸£à¸·à¸­à¸¡à¸²à¸à¸à¸§à¹ˆà¸²à¸™à¸±à¹‰à¸™ + + + This value should not be blank. + ค่านี้ไม่ควรเป็นค่าว่าง + + + This value should not be null. + ค่านี้ไม่ควรเป็นค่า null + + + This value should be null. + ค่านี้ควรเป็นค่า null + + + This value is not valid. + ค่านี้ไม่ถูà¸à¸•à¹‰à¸­à¸‡ + + + This value is not a valid time. + ค่าของเวลาไม่ถูà¸à¸•à¹‰à¸­à¸‡ + + + This value is not a valid URL. + ค่าของ URL ไม่ถูà¸à¸•à¹‰à¸­à¸‡ + + + The two values should be equal. + ค่าทั้งสองค่าควรจะเหมือนà¸à¸±à¸™ + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + ขนาดไฟล์ใหà¸à¹ˆà¹€à¸à¸´à¸™à¹„ป อนุà¸à¸²à¸•à¹ƒà¸«à¹‰à¹„ฟล์ขนาดใหà¸à¹ˆà¹„ด้ไม่เà¸à¸´à¸™ {{ limit }} {{ suffix }} + + + The file is too large. + ขนาดไฟล์ใหà¸à¹ˆà¹€à¸à¸´à¸™à¹„ป + + + The file could not be uploaded. + ไม่สามารถอัปโหลดไฟล์ได้ + + + This value should be a valid number. + ค่าของตัวเลขไม่ถูà¸à¸•à¹‰à¸­à¸‡ + + + This file is not a valid image. + ไฟล์นี้ไม่ใช่ไฟล์รูปภาพ + + + This is not a valid IP address. + ค่าของ IP ไม่ถูà¸à¸•à¹‰à¸­à¸‡ + + + This value is not a valid language. + ค่าของภาษาไม่ถูà¸à¸•à¹‰à¸­à¸‡ + + + This value is not a valid locale. + ค่าของภูมิภาค (Locale) ไม่ถูà¸à¸•à¹‰à¸­à¸‡ + + + This value is not a valid country. + ค่าของประเทศไม่ถูà¸à¸•à¹‰à¸­à¸‡ + + + This value is already used. + Tค่านี้ถูà¸à¹ƒà¸Šà¹‰à¸‡à¸²à¸™à¹„ปà¹à¸¥à¹‰à¸§ + + + The size of the image could not be detected. + ไม่สามารถตรวจสอบขนาดไฟล์ของภาพได้ + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + ความà¸à¸§à¹‰à¸²à¸‡à¸‚องภาพเà¸à¸´à¸™à¸‚นาด ({{ width }}px) อนุà¸à¸²à¸•à¹ƒà¸«à¹‰à¸à¸§à¹‰à¸²à¸‡à¹„ด้มาà¸à¸—ี่สุด {{ max_width }}px + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + ความà¸à¸§à¹‰à¸²à¸‡à¸‚องภาพไม่ได้ขนาด ({{ width }}px) อนุà¸à¸²à¸•à¹ƒà¸«à¹‰à¸ªà¸±à¹‰à¸™à¸—ี่สุด {{ min_width }}px + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + ความสูงของภาพเà¸à¸´à¸™à¸‚นาด ({{ height }}px) อนุà¸à¸²à¸•à¹ƒà¸«à¹‰à¸ªà¸¹à¸‡à¹„ด้มาà¸à¸—ี่สุด {{ max_height }}px + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + ความสูงของภาพไม่ได้ขนาด ({{ height }}px) อนุà¸à¸²à¸•à¹ƒà¸«à¹‰à¸ªà¸¹à¸‡à¸­à¸¢à¹ˆà¸²à¸‡à¸™à¹‰à¸­à¸¢à¸—ี่สุด {{ min_height }}px + + + This value should be the user current password. + ค่านี้ควรจะเป็นรหัสผ่านปัจจุบันของผู้ใช้ + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + ค่านี้ควรจะมีความยาว {{ limit }} ตัวอัà¸à¸©à¸£ + + + The file was only partially uploaded. + อัปโหลดไฟล์ได้เพียงบางส่วนเท่านั้น + + + No file was uploaded. + ไม่มีไฟล์ใดถูà¸à¸­à¸±à¸›à¹‚หลด + + + No temporary folder was configured in php.ini. + ไม่พบไฟล์ temp ควรจะà¸à¸³à¸«à¸™à¸”ใน php.ini + + + Cannot write temporary file to disk. + ไม่สามารถเขียน temp ไฟล์ลงดิสà¸à¹Œà¹„ด้ + + + A PHP extension caused the upload to fail. + PHP extension เà¸à¸µà¹ˆà¸¢à¸§à¸à¸±à¸šà¸à¸²à¸£à¸­à¸±à¸›à¹‚หลดมีปัà¸à¸«à¸² + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + คอเล็à¸à¸Šà¸±à¹ˆà¸™à¸™à¸µà¹‰à¸„วรจะประà¸à¸­à¸šà¹„ปด้วยอ่างน้อย {{ limit }} สมาชิภ+ + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + คอเล็à¸à¸Šà¸±à¹ˆà¸™à¸™à¸µà¹‰à¹„ม่ควรมีสมาชิà¸à¹€à¸à¸´à¸™ {{ limit }} + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + คอเล็à¸à¸Šà¸±à¹ˆà¸™à¸™à¸µà¹‰à¸„วรจะมีสมาชิภ{{ limit }} เท่านั้น + + + Invalid card number. + หมายเลขบัตรไม่ถูà¸à¸•à¹‰à¸­à¸‡ + + + Unsupported card type or invalid card number. + ไม่รู้จัà¸à¸›à¸£à¸°à¹€à¸ à¸—ของบัตร หรือหมายเลขบัตรไม่ถูà¸à¸•à¹‰à¸­à¸‡ + + + This is not a valid International Bank Account Number (IBAN). + นี่ไม่ถูà¸à¸•à¹‰à¸­à¸‡à¸•à¸²à¸¡ International Bank Account Number (IBAN) + + + This value is not a valid ISBN-10. + ค่านี้ไม่ถูà¸à¸•à¹‰à¸­à¸‡à¸•à¸²à¸¡ ISBN-10 + + + This value is not a valid ISBN-13. + ค่านี้ไม่ถูà¸à¸•à¹‰à¸­à¸‡à¸•à¸²à¸¡ ISBN-13 + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + ค่านี้ไม่ถูà¸à¸•à¹‰à¸­à¸‡à¸•à¸²à¸¡à¸—ั้ง ISBN-10 à¹à¸¥à¸° ISBN-13 + + + This value is not a valid ISSN. + ค่านี้ไม่ถุà¸à¸•à¹‰à¸­à¸‡à¸•à¸²à¸¡ ISSN + + + This value is not a valid currency. + ค่านี้ไม่ถูà¸à¸•à¹‰à¸­à¸‡à¸•à¸²à¸¡à¸ªà¸à¸¸à¸¥à¹€à¸‡à¸´à¸™ + + + This value should be equal to {{ compared_value }}. + ค่านี้ไม่ตรงà¸à¸±à¸š {{ compared_value }} + + + This value should be greater than {{ compared_value }}. + ค่านี้ควรจะมาà¸à¸à¸§à¹ˆà¸² {{ compared_value }} + + + This value should be greater than or equal to {{ compared_value }}. + ค่านี้ควรจะมาà¸à¸à¸§à¹ˆà¸²à¸«à¸£à¸·à¸­à¸•à¸£à¸‡à¸à¸±à¸š {{ compared_value }} + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + ค่านี้ควรจะเหมือนà¸à¸±à¸™à¸à¸±à¸š {{ compared_value_type }} {{ compared_value }} + + + This value should be less than {{ compared_value }}. + ค่านี้ควรจะน้อยà¸à¸§à¹ˆà¸² {{ compared_value }} + + + This value should be less than or equal to {{ compared_value }}. + ค่านี้ควรจะน้อยà¸à¸§à¹ˆà¸²à¸«à¸£à¸·à¸­à¹€à¸—่าà¸à¸±à¸š {{ compared_value }} + + + This value should not be equal to {{ compared_value }}. + ค่านี้ไม่ควรเท่าà¸à¸±à¸™à¸à¸±à¸š {{ compared_value }} + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + ค่านี้ไม่ควรเหมือนà¸à¸±à¸™à¸à¸±à¸š {{ compared_value_type }} {{ compared_value }} + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + สัดส่วนของภาพใหà¸à¹ˆà¹€à¸à¸´à¸™ ({{ ratio }}) สามารถมีขนาดใหà¸à¹ˆà¸—ี่สุดได้ {{ max_ratio }} + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + สัดส่วนของภาพเล็à¸à¹€à¸à¸´à¸™ ({{ ratio }}) สามารถมีขนาดเล็à¸à¸—ี่สุดได้ {{ min_ratio }} + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + รูปภาพเป็นจุตรัส ({{ width }}x{{ height }}px) ไม่อนุà¸à¸²à¸•à¸ à¸²à¸žà¸—ี่เป็นสี่เหลี่ยมจตุรัส + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + ภาพนี้เป็นà¹à¸™à¸§à¸™à¸­à¸™ ({{ width }}x{{ height }}px) ไม่อนุà¸à¸²à¸•à¸ à¸²à¸žà¸—ี่เป็นà¹à¸™à¸§à¸™à¸­à¸™ + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + ภาพนี้เป็นà¹à¸™à¸§à¸•à¸±à¹‰à¸‡ ({{ width }}x{{ height }}px) ไม่อนุà¸à¸²à¸•à¸ à¸²à¸žà¸—ี่เป็นà¹à¸™à¸§à¸•à¸±à¹‰à¸‡ + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.tr.xlf b/core/vendor/symfony/validator/Resources/translations/validators.tr.xlf new file mode 100644 index 0000000..a7906ea --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.tr.xlf @@ -0,0 +1,227 @@ + + + + + + This value should be false. + Bu deÄŸer olumsuz olmalıdır. + + + This value should be true. + Bu deÄŸer olumlu olmalıdır. + + + This value should be of type {{ type }}. + Bu deÄŸerin tipi {{ type }} olmalıdır. + + + This value should be blank. + Bu deÄŸer boÅŸ olmalıdır. + + + The value you selected is not a valid choice. + SeçtiÄŸiniz deÄŸer geçerli bir seçenek deÄŸil. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + En az {{ limit }} seçenek belirtmelisiniz. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + En çok {{ limit }} seçenek belirtmelisiniz. + + + One or more of the given values is invalid. + Verilen deÄŸerlerden bir veya daha fazlası geçersiz. + + + This field was not expected. + Bu alan beklenen olmadı. + + + This field is missing. + Bu alan, eksik + + + This value is not a valid date. + Bu deÄŸer doÄŸru bir tarih biçimi deÄŸildir. + + + This value is not a valid datetime. + Bu deÄŸer doÄŸru bir tarihsaat biçimi deÄŸildir. + + + This value is not a valid email address. + Bu deÄŸer doÄŸru bir e-mail adresi deÄŸildir. + + + The file could not be found. + Dosya bulunamadı. + + + The file is not readable. + Dosya okunabilir deÄŸil. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Dosya çok büyük ({{ size }} {{ suffix }}). Ä°zin verilen en büyük dosya boyutu {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Dosyanın mime tipi geçersiz ({{ type }}). Ä°zin verilen mime tipleri {{ types }}. + + + This value should be {{ limit }} or less. + Bu deÄŸer {{ limit }} ve altında olmalıdır. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Bu deÄŸer çok uzun. {{ limit }} karakter veya daha az olmalıdır. + + + This value should be {{ limit }} or more. + Bu deÄŸer {{ limit }} veya daha fazla olmalıdır. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Bu deÄŸer çok kısa. {{ limit }} karakter veya daha fazla olmaldır. + + + This value should not be blank. + Bu deÄŸer boÅŸ bırakılmamalıdır. + + + This value should not be null. + Bu deÄŸer boÅŸ bırakılmamalıdır. + + + This value should be null. + Bu deÄŸer boÅŸ bırakılmalıdır. + + + This value is not valid. + Bu deÄŸer geçerli deÄŸil. + + + This value is not a valid time. + Bu deÄŸer doÄŸru bir saat deÄŸil. + + + This value is not a valid URL. + Bu deÄŸer doÄŸru bir URL deÄŸil. + + + The two values should be equal. + Ä°ki deÄŸer eÅŸit olmalıdır. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Dosya çok büyük. Ä°zin verilen en büyük dosya boyutu {{ limit }} {{ suffix }}. + + + The file is too large. + Dosya çok büyük. + + + The file could not be uploaded. + Dosya yüklenemiyor. + + + This value should be a valid number. + Bu deÄŸer geçerli bir rakam olmalıdır. + + + This file is not a valid image. + Bu dosya geçerli bir resim deÄŸildir. + + + This is not a valid IP address. + Bu geçerli bir IP adresi deÄŸildir. + + + This value is not a valid language. + Bu deÄŸer geçerli bir lisan deÄŸil. + + + This value is not a valid locale. + Bu deÄŸer geçerli bir yer deÄŸildir. + + + This value is not a valid country. + Bu deÄŸer geçerli bir ülke deÄŸildir. + + + This value is already used. + Bu deÄŸer ÅŸu anda kullanımda. + + + The size of the image could not be detected. + Resmin boyutu saptanamıyor. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Resmin geniÅŸliÄŸi çok büyük ({{ width }}px). Ä°zin verilen en büyük geniÅŸlik {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Resmin geniÅŸliÄŸi çok küçük ({{ width }}px). En az {{ min_width }}px olmalıdır. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Resmin yüksekliÄŸi çok büyük ({{ height }}px). Ä°zin verilen en büyük yükseklik {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Resmin yüksekliÄŸi çok küçük ({{ height }}px). En az {{ min_height }}px olmalıdır. + + + This value should be the user's current password. + Bu deÄŸer kullanıcının ÅŸu anki ÅŸifresi olmalıdır. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Bu deÄŸer tam olarak {{ limit }} karakter olmaldır. + + + The file was only partially uploaded. + Dosya sadece kısmen yüklendi. + + + No file was uploaded. + Hiçbir dosya yüklenmedi. + + + No temporary folder was configured in php.ini. + php.ini içerisinde geçici dizin tanımlanmadı. + + + Cannot write temporary file to disk. + Geçici dosya diske yazılamıyor. + + + A PHP extension caused the upload to fail. + Bir PHP eklentisi dosyanın yüklemesini baÅŸarısız kıldı. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Bu derlem {{ limit }} veya daha çok eleman içermelidir. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Bu derlem {{ limit }} veya daha az eleman içermelidir. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Bu derlem {{ limit }} eleman içermelidir. + + + Invalid card number. + Geçersiz kart numarası. + + + Unsupported card type or invalid card number. + Desteklenmeyen kart tipi veya geçersiz kart numarası. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.uk.xlf b/core/vendor/symfony/validator/Resources/translations/validators.uk.xlf new file mode 100644 index 0000000..02ecd5a --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.uk.xlf @@ -0,0 +1,283 @@ + + + + + + This value should be false. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ð¾ бути ÐÑ–. + + + This value should be true. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ð¾ бути Так. + + + This value should be of type {{ type }}. + Тип Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¿Ð¾Ð²Ð¸Ð½ÐµÐ½ бути {{ type }}. + + + This value should be blank. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ð¾ бути пуÑтим. + + + The value you selected is not a valid choice. + Обране вами Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð½ÐµÐ´Ð¾Ð¿ÑƒÑтиме. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Ви повинні обрати хоча б {{ limit }} варіант.|Ви повинні обрати хоча б {{ limit }} варіанти.|Ви повинні обрати хоча б {{ limit }} варіантів. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Ви повинні обрати не більше ніж {{ limit }} варіантів. + + + One or more of the given values is invalid. + Одне або кілька заданих значень Ñ” недопуÑтимі. + + + This field was not expected. + Це поле не очікуєтьÑÑ. + + + This field is missing. + Це поле не виÑтачає. + + + This value is not a valid date. + Дане Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð½Ðµ Ñ” вірною датою. + + + This value is not a valid datetime. + Дане Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð´Ð°Ñ‚Ð¸ та чаÑу недопуÑтиме. + + + This value is not a valid email address. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð°Ð´Ñ€ÐµÑи Ñлектронної пошти недопуÑтиме. + + + The file could not be found. + Файл не знайдено. + + + The file is not readable. + Файл не читаєтьÑÑ. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Файл занадто великий ({{ size }} {{ suffix }}). Дозволений макÑимальний розмір {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + MIME-тип файлу недопуÑтимий ({{ type }}). ДопуÑтимі MIME-типи файлів {{ types }}. + + + This value should be {{ limit }} or less. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ð¾ бути {{ limit }} або менше. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð·Ð°Ð½Ð°Ð´Ñ‚Ð¾ довге. Повинно бути рівне {{ limit }} Ñимволу або менше.|Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð·Ð°Ð½Ð°Ð´Ñ‚Ð¾ довге. Повинно бути рівне {{ limit }} Ñимволам або менше.|Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð·Ð°Ð½Ð°Ð´Ñ‚Ð¾ довге. Повинно бути рівне {{ limit }} Ñимволам або менше. + + + This value should be {{ limit }} or more. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ð¾ бути {{ limit }} або більше. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð·Ð°Ð½Ð°Ð´Ñ‚Ð¾ коротке. Повинно бути рівне {{ limit }} Ñимволу або більше.|Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð·Ð°Ð½Ð°Ð´Ñ‚Ð¾ коротке. Повинно бути рівне {{ limit }} Ñимволам або більше.|Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð·Ð°Ð½Ð°Ð´Ñ‚Ð¾ коротке. Повинно бути рівне {{ limit }} Ñимволам або більше. + + + This value should not be blank. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð½Ðµ повинно бути пуÑтим. + + + This value should not be null. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð½Ðµ повинно бути null. + + + This value should be null. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ð¾ бути null. + + + This value is not valid. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð½ÐµÐ´Ð¾Ð¿ÑƒÑтиме. + + + This value is not a valid time. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ñ‡Ð°Ñу недопуÑтиме. + + + This value is not a valid URL. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ URL недопуÑтиме. + + + The two values should be equal. + Обидва Ð·Ð°Ð½Ñ‡ÐµÐ½Ð½Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ñ– бути одинаковими. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Файл занадто великий. МакÑимальний допуÑтимий розмір {{ limit }} {{ suffix }}. + + + The file is too large. + Файл занадто великий. + + + The file could not be uploaded. + Файл не можливо завантажити. + + + This value should be a valid number. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¼Ð°Ñ” бути допуÑтимим чиÑлом. + + + This file is not a valid image. + Цей файл не Ñ” допуÑтимим форматом зображеннÑ. + + + This is not a valid IP address. + Це некоректна IP адреÑа. + + + This value is not a valid language. + Це некоректна мова. + + + This value is not a valid locale. + Це некоректна локалізаціÑ. + + + This value is not a valid country. + Це некоректна країна. + + + This value is already used. + Це Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð²Ð¶Ðµ викориÑтовуєтьÑÑ. + + + The size of the image could not be detected. + Ðе вдалоÑÑ Ð²Ð¸Ð·Ð½Ð°Ñ‡Ð¸Ñ‚Ð¸ розмір зображеннÑ. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Ширина Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð½Ñ Ð·Ð°Ð½Ð°Ð´Ñ‚Ð¾ велика ({{ width }}px). МакÑимально допуÑтима ширина {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Ширина Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð½Ñ Ð·Ð°Ð½Ð°Ð´Ñ‚Ð¾ мала ({{ width }}px). Мінімально допуÑтима ширина {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + ВиÑота Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð½Ñ Ð·Ð°Ð½Ð°Ð´Ñ‚Ð¾ велика ({{ height }}px). МакÑимально допуÑтима виÑота {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + ВиÑота Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð½Ñ Ð·Ð°Ð½Ð°Ð´Ñ‚Ð¾ мала ({{ height }}px). Мінімально допуÑтима виÑота {{ min_height }}px. + + + This value should be the user's current password. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¼Ð°Ñ” бути поточним паролем кориÑтувача. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¿Ð¾Ð²Ð¸Ð¸Ð½Ð¾ бути рівним {{ limit }} Ñимволу.|Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¿Ð¾Ð²Ð¸Ð¸Ð½Ð¾ бути рівним {{ limit }} Ñимволам.|Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¿Ð¾Ð²Ð¸Ð¸Ð½Ð¾ бути рівним {{ limit }} Ñимволам. + + + The file was only partially uploaded. + Файл був завантажений лише чаÑтково. + + + No file was uploaded. + Файл не був завантажений. + + + No temporary folder was configured in php.ini. + Ðе налаштована тимчаÑова Ð´Ð¸Ñ€ÐµÐºÑ‚Ð¾Ñ€Ñ–Ñ Ð² php.ini. + + + Cannot write temporary file to disk. + Ðеможливо запиÑати тимчаÑовий файл на диÑк. + + + A PHP extension caused the upload to fail. + Ð Ð¾Ð·ÑˆÐ¸Ñ€ÐµÐ½Ð½Ñ PHP викликало помилку при завантаженні. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ð¦Ñ ÐºÐ¾Ð»ÐµÐºÑ†Ñ–Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ð° міÑтити {{ limit }} елемент чи більше.|Ð¦Ñ ÐºÐ¾Ð»ÐµÐºÑ†Ñ–Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ð° міÑтити {{ limit }} елемента чи більше.|Ð¦Ñ ÐºÐ¾Ð»ÐµÐºÑ†Ñ–Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ð° міÑтити {{ limit }} елементів чи більше. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ð¦Ñ ÐºÐ¾Ð»ÐµÐºÑ†Ñ–Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ð° міÑтити {{ limit }} елемент чи менше.|Ð¦Ñ ÐºÐ¾Ð»ÐµÐºÑ†Ñ–Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ð° міÑтити {{ limit }} елемента чи менше.|Ð¦Ñ ÐºÐ¾Ð»ÐµÐºÑ†Ñ–Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ð° міÑтити {{ limit }} елементов чи менше. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ð¦Ñ ÐºÐ¾Ð»ÐµÐºÑ†Ñ–Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ð° міÑтити рівно {{ limit }} елемент.|Ð¦Ñ ÐºÐ¾Ð»ÐµÐºÑ†Ñ–Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ð° міÑтити рівно {{ limit }} елемента.|Ð¦Ñ ÐºÐ¾Ð»ÐµÐºÑ†Ñ–Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ð° міÑтити рівно {{ limit }} елементів. + + + Invalid card number. + Ðевірний номер карти. + + + Unsupported card type or invalid card number. + Ðепідтримуваний тип карти або невірний номер карти. + + + This is not a valid International Bank Account Number (IBAN). + Це не дійÑний міжнародний номер банківÑького рахунку (IBAN). + + + This value is not a valid ISBN-10. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð½Ðµ у форматі ISBN-10. + + + This value is not a valid ISBN-13. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð½Ðµ у форматі ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð½Ðµ відповідає форматам ISBN-10 та ISBN-13. + + + This value is not a valid ISSN. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¼Ð°Ñ” невірний формат ISSN. + + + This value is not a valid currency. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¼Ð°Ñ” невірний формат валюти. + + + This value should be equal to {{ compared_value }}. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ð¾ дорівнювати {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¼Ð°Ñ” бути більше ніж {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¼Ð°Ñ” бути більше або дорівнювати {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¼Ð°Ñ” бути ідентичним {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ð¾ бути менше ніж {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð¿Ð¾Ð²Ð¸Ð½Ð½Ð¾ бути менше або дорівнювати {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð½Ðµ повинно дорівнювати {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Ð—Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð½Ðµ повинно бути ідентичним {{ compared_value_type }} {{ compared_value }}. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.vi.xlf b/core/vendor/symfony/validator/Resources/translations/validators.vi.xlf new file mode 100644 index 0000000..e1833c7 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.vi.xlf @@ -0,0 +1,283 @@ + + + + + + This value should be false. + Giá trị này phải là sai. + + + This value should be true. + Giá trị này phải là đúng. + + + This value should be of type {{ type }}. + Giá trị này phải là kiểu {{ type }}. + + + This value should be blank. + Giá trị này phải rá»—ng. + + + The value you selected is not a valid choice. + Giá trị bạn vừa chá»n không hợp lệ. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Bạn phải chá»n ít nhất {{ limit }} lá»±a chá»n.|Bạn phải chá»n ít nhất {{ limit }} lá»±a chá»n. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Bạn phải chá»n nhiá»u nhất {{ limit }} lá»±a chá»n.|Bạn phải chá»n nhiá»u nhất {{ limit }} lá»±a chá»n. + + + One or more of the given values is invalid. + Má»™t hoặc nhiá»u giá trị được chá»n không hợp lệ. + + + This field was not expected. + LÄ©nh vá»±c này không được dá»± kiến. + + + This field is missing. + LÄ©nh vá»±c này là mất tích. + + + This value is not a valid date. + Giá trị không phải là ngày hợp lệ. + + + This value is not a valid datetime. + Giá trị không phải là ngày tháng hợp lệ. + + + This value is not a valid email address. + Giá trị này không phải là email hợp lệ. + + + The file could not be found. + Tập tin không tìm thấy. + + + The file is not readable. + Tập tin không thể Ä‘á»c được. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Tập tin quá lá»›n ({{ size }} {{ suffix }}). Kích thÆ°á»›c tối Ä‘a cho phép {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Kiểu mime của tập tin không hợp lệ ({{ type }}). Kiểu hợp lệ là {{ types }}. + + + This value should be {{ limit }} or less. + Giá trị phải bằng hoặc nhá» hÆ¡n {{ limit }}. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Giá trị quá dài. Phải bằng hoặc ít hÆ¡n {{ limit }} kí tá»±.|Giá trị quá dài. Phải bằng hoặc ít hÆ¡n {{ limit }} kí tá»±. + + + This value should be {{ limit }} or more. + Giá trị phải lá»›n hÆ¡n hoặc bằng {{ limit }}. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Giá trị quá ngắn. Phải hÆ¡n hoặc bằng {{ limit }} kí tá»±.|Giá trị quá ngắn. Phải hÆ¡n hoặc bằng {{ limit }} kí tá»±. + + + This value should not be blank. + Giá trị không được phép để trống. + + + This value should not be null. + Giá trị không được phép rá»—ng. + + + This value should be null. + Giá trị phải rá»—ng. + + + This value is not valid. + Giá trị không hợp lệ. + + + This value is not a valid time. + Giá trị không phải là thá»i gian hợp lệ. + + + This value is not a valid URL. + Giá trị không phải là địa chỉ URL hợp lệ. + + + The two values should be equal. + Hai giá trị phải bằng nhau. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Tập tin quá lá»›n. Kích thÆ°á»›c tối Ä‘a cho phép là {{ limit }} {{ suffix }}. + + + The file is too large. + Tập tin quá lá»›n. + + + The file could not be uploaded. + Tập tin không thể tải lên. + + + This value should be a valid number. + Giá trị phải là con số. + + + This file is not a valid image. + Tập tin không phải là hình ảnh. + + + This is not a valid IP address. + Äịa chỉ IP không hợp lệ. + + + This value is not a valid language. + Giá trị không phải là ngôn ngữ hợp lệ. + + + This value is not a valid locale. + Giá trị không phải là má»™t bản địa địa phÆ°Æ¡ng hợp lệ. + + + This value is not a valid country. + Giá trị không phải là nÆ°á»›c hợp lệ. + + + This value is already used. + Giá trị đã được sá»­ dụng. + + + The size of the image could not be detected. + Kích thÆ°á»›c của hình ảnh không thể xác định. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Chiá»u rá»™ng của hình quá lá»›n ({{ width }}px). Chiá»u rá»™ng tối Ä‘a phải là {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Chiá»u rá»™ng của hình quá thấp ({{ width }}px). Chiá»u rá»™ng tối thiểu phải là {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Chiá»u cao của hình quá cao ({{ height }}px). Chiá»u cao tối Ä‘a phải là {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Chiá»u cao của hình quá thấp ({{ height }}px). Chiá»u cao tối thiểu phải là {{ min_height }}px. + + + This value should be the user's current password. + Giá trị này phải là mật khẩu hiện tại của ngÆ°á»i dùng. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Giá trị phải có chính xác {{ limit }} kí tá»±.|Giá trị phải có chính xác {{ limit }} kí tá»±. + + + The file was only partially uploaded. + Tập tin chỉ được tải lên má»™t phần. + + + No file was uploaded. + Tập tin không được tải lên. + + + No temporary folder was configured in php.ini. + ThÆ° mục tạm không được định nghÄ©a trong php.ini. + + + Cannot write temporary file to disk. + Không thể ghi tập tin tạm ra Ä‘Ä©a. + + + A PHP extension caused the upload to fail. + Má»™t PHP extension đã phá há»ng quá trình tải lên của tập tin. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Danh sách phải chứa {{ limit }} hoặc nhiá»u hÆ¡n thành phần.|Danh sách phải chứa {{ limit }} hoặc nhiá»u hÆ¡n thành phần. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Danh sách phải chứa {{ limit }} hoặc ít hÆ¡n thành phần.|Danh sách phải chứa {{ limit }} hoặc ít hÆ¡n thành phần. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Danh sách phải chứa chính xác {{ limit }} thành phần.|Danh sách phải chứa chính xác {{ limit }} thành phần. + + + Invalid card number. + Số thẻ không hợp lệ. + + + Unsupported card type or invalid card number. + Thẻ không được há»— trợ hoặc số thẻ không hợp lệ. + + + This is not a valid International Bank Account Number (IBAN). + Giá trị không phải là International Bank Account Number (IBAN) hợp lệ. + + + This value is not a valid ISBN-10. + Giá trị không phải là ISBN-10 hợp lệ. + + + This value is not a valid ISBN-13. + Giá trị không phải là ISBN-13 hợp lệ. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Giá trị không phải là ISBN-10 hoặc ISBN-13 hợp lệ. + + + This value is not a valid ISSN. + Giá trị không là ISSN hợp lệ. + + + This value is not a valid currency. + Giá trị không phải là Ä‘Æ¡n vi tiá»n tệ hợp lệ. + + + This value should be equal to {{ compared_value }}. + Giá trị phải bằng {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Giá trị phải lá»›n hÆ¡n {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Giá trị phải lá»›n hÆ¡n hoặc bằng {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Giá trị phải giống {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Giá trị phải bé hÆ¡n {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Giá trị không được phép nhá» hÆ¡n hoặc bằng {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Giá trị không được phép bằng {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Giá trị không được phép giống nhÆ° {{ compared_value_type }} {{ compared_value }}. + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.zh_CN.xlf b/core/vendor/symfony/validator/Resources/translations/validators.zh_CN.xlf new file mode 100644 index 0000000..5ffc643 --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.zh_CN.xlf @@ -0,0 +1,283 @@ + + + + + + This value should be false. + 该å˜é‡çš„值应为 false 。 + + + This value should be true. + 该å˜é‡çš„值应为 true 。 + + + This value should be of type {{ type }}. + 该å˜é‡çš„类型应为 {{ type }} 。 + + + This value should be blank. + 该å˜é‡å€¼åº”为空。 + + + The value you selected is not a valid choice. + 选定å˜é‡çš„值ä¸æ˜¯æœ‰æ•ˆçš„选项。 + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + 您至少è¦é€‰æ‹© {{ limit }} 个选项。 + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + 您最多能选择 {{ limit }} 个选项。 + + + One or more of the given values is invalid. + 一个或者多个给定的值无效。 + + + This field was not expected. + 此字段是多余的。 + + + This field is missing. + 此字段缺失。 + + + This value is not a valid date. + 该值ä¸æ˜¯ä¸€ä¸ªæœ‰æ•ˆçš„日期(date)。 + + + This value is not a valid datetime. + 该值ä¸æ˜¯ä¸€ä¸ªæœ‰æ•ˆçš„日期时间(datetime)。 + + + This value is not a valid email address. + 该值ä¸æ˜¯ä¸€ä¸ªæœ‰æ•ˆçš„邮件地å€ã€‚ + + + The file could not be found. + 文件未找到。 + + + The file is not readable. + 文件ä¸å¯è¯»ã€‚ + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + 文件太大 ({{ size }} {{ suffix }})。文件大å°ä¸å¯ä»¥è¶…过 {{ limit }} {{ suffix }} 。 + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + 无效的文件类型 ({{ type }}) 。å…许的文件类型有 {{ types }} 。 + + + This value should be {{ limit }} or less. + 这个å˜é‡çš„值应该å°äºŽæˆ–等于 {{ limit }}。 + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + 字符串太长,长度ä¸å¯è¶…过 {{ limit }} 个字符。 + + + This value should be {{ limit }} or more. + 该å˜é‡çš„值应该大于或等于 {{ limit }}。 + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + 字符串太短,长度ä¸å¯å°‘于 {{ limit }} 个字符。 + + + This value should not be blank. + 该å˜é‡ä¸åº”为空。 + + + This value should not be null. + 该å˜é‡ä¸åº”为 null 。 + + + This value should be null. + 该å˜é‡åº”为空 null 。 + + + This value is not valid. + 该å˜é‡å€¼æ— æ•ˆ 。 + + + This value is not a valid time. + 该值ä¸æ˜¯ä¸€ä¸ªæœ‰æ•ˆçš„时间。 + + + This value is not a valid URL. + 该值ä¸æ˜¯ä¸€ä¸ªæœ‰æ•ˆçš„ URL 。 + + + The two values should be equal. + 这两个å˜é‡çš„值应该相等。 + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + 文件太大,文件大å°ä¸å¯ä»¥è¶…过 {{ limit }} {{ suffix }}。 + + + The file is too large. + 文件太大。 + + + The file could not be uploaded. + 无法上传此文件。 + + + This value should be a valid number. + 该值应该为有效的数字。 + + + This value is not a valid country. + 该值ä¸æ˜¯æœ‰æ•ˆçš„国家å。 + + + This file is not a valid image. + 该文件ä¸æ˜¯æœ‰æ•ˆçš„图片。 + + + This is not a valid IP address. + 该值ä¸æ˜¯æœ‰æ•ˆçš„IP地å€ã€‚ + + + This value is not a valid language. + 该值ä¸æ˜¯æœ‰æ•ˆçš„语言å。 + + + This value is not a valid locale. + 该值ä¸æ˜¯æœ‰æ•ˆçš„区域值(locale)。 + + + This value is already used. + 该值已ç»è¢«ä½¿ç”¨ã€‚ + + + The size of the image could not be detected. + ä¸èƒ½è§£æžå›¾ç‰‡å¤§å°ã€‚ + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + 图片太宽 ({{ width }}px),最大宽度为 {{ max_width }}px 。 + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + 图片宽度ä¸å¤Ÿ ({{ width }}px),最å°å®½åº¦ä¸º {{ min_width }}px 。 + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + 图片太高 ({{ height }}px),最大高度为 {{ max_height }}px 。 + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + 图片高度ä¸å¤Ÿ ({{ height }}px),最å°é«˜åº¦ä¸º {{ min_height }}px 。 + + + This value should be the user's current password. + 该å˜é‡çš„值应为用户当å‰çš„密ç ã€‚ + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + 该å˜é‡åº”为 {{ limit }} 个字符。 + + + The file was only partially uploaded. + 该文件的上传ä¸å®Œæ•´ã€‚ + + + No file was uploaded. + 没有上传任何文件。 + + + No temporary folder was configured in php.ini. + php.ini 里没有é…置临时文件目录。 + + + Cannot write temporary file to disk. + 临时文件写入ç£ç›˜å¤±è´¥ã€‚ + + + A PHP extension caused the upload to fail. + æŸä¸ª PHP 扩展造æˆä¸Šä¼ å¤±è´¥ã€‚ + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + 该集åˆæœ€å°‘åº”åŒ…å« {{ limit }} 个元素。 + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + 该集åˆæœ€å¤šåŒ…å« {{ limit }} 个元素。 + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + 该集åˆåº”åŒ…å« {{ limit }} 个元素 element 。 + + + Invalid card number. + 无效的信用å¡å·ã€‚ + + + Unsupported card type or invalid card number. + ä¸æ”¯æŒçš„信用å¡ç±»åž‹æˆ–无效的信用å¡å·ã€‚ + + + This is not a valid International Bank Account Number (IBAN). + 该值ä¸æ˜¯æœ‰æ•ˆçš„国际银行å¸å·ï¼ˆIBAN)。 + + + This value is not a valid ISBN-10. + 该值ä¸æ˜¯æœ‰æ•ˆçš„10ä½å›½é™…标准书å·ï¼ˆISBN-10)。 + + + This value is not a valid ISBN-13. + 该值ä¸æ˜¯æœ‰æ•ˆçš„13ä½å›½é™…标准书å·ï¼ˆISBN-13)。 + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + 该值ä¸æ˜¯æœ‰æ•ˆçš„国际标准书å·ï¼ˆISBN-10 或 ISBN-13)。 + + + This value is not a valid ISSN. + 该值ä¸æ˜¯æœ‰æ•ˆçš„国际标准期刊å·ï¼ˆISSN)。 + + + This value is not a valid currency. + 该值ä¸æ˜¯æœ‰æ•ˆçš„è´§å¸å(currency)。 + + + This value should be equal to {{ compared_value }}. + 该值应等于 {{ compared_value }} 。 + + + This value should be greater than {{ compared_value }}. + 该值应大于 {{ compared_value }} 。 + + + This value should be greater than or equal to {{ compared_value }}. + 该值应大于或等于 {{ compared_value }} 。 + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + 该值应与 {{ compared_value_type }} {{ compared_value }} 相åŒã€‚ + + + This value should be less than {{ compared_value }}. + 该值应å°äºŽ {{ compared_value }} 。 + + + This value should be less than or equal to {{ compared_value }}. + 该值应å°äºŽæˆ–等于 {{ compared_value }} 。 + + + This value should not be equal to {{ compared_value }}. + 该值ä¸åº”先等于 {{ compared_value }} 。 + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + 该值ä¸åº”与 {{ compared_value_type }} {{ compared_value }} 相åŒã€‚ + + + + diff --git a/core/vendor/symfony/validator/Resources/translations/validators.zh_TW.xlf b/core/vendor/symfony/validator/Resources/translations/validators.zh_TW.xlf new file mode 100644 index 0000000..d9d5f2f --- /dev/null +++ b/core/vendor/symfony/validator/Resources/translations/validators.zh_TW.xlf @@ -0,0 +1,283 @@ + + + + + + This value should be false. + 該變數的值應為 false 。 + + + This value should be true. + 該變數的值應為 true 。 + + + This value should be of type {{ type }}. + 該變數的類型應為 {{ type }} 。 + + + This value should be blank. + 該變數應為空。 + + + The value you selected is not a valid choice. + é¸å®šè®Šæ•¸çš„值ä¸æ˜¯æœ‰æ•ˆçš„é¸é …。 + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + 您至少è¦é¸æ“‡ {{ limit }} 個é¸é …。 + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + 您最多能é¸æ“‡ {{ limit }} 個é¸é …。 + + + One or more of the given values is invalid. + 一個或者多個給定的值無效。 + + + This field was not expected. + 此字段是沒有é æ–™åˆ°ã€‚ + + + This field is missing. + 此字段缺失。 + + + This value is not a valid date. + 該值ä¸æ˜¯ä¸€å€‹æœ‰æ•ˆçš„日期(date)。 + + + This value is not a valid datetime. + 該值ä¸æ˜¯ä¸€å€‹æœ‰æ•ˆçš„日期時間(datetime)。 + + + This value is not a valid email address. + 該值ä¸æ˜¯ä¸€å€‹æœ‰æ•ˆçš„郵件地å€ã€‚ + + + The file could not be found. + 找ä¸åˆ°æª”案。 + + + The file is not readable. + 無法讀å–檔案。 + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + 檔案太大 ({{ size }} {{ suffix }})。檔案大å°ä¸å¯ä»¥è¶…éŽ {{ limit }} {{ suffix }} 。 + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + 無效的檔案類型 ({{ type }}) 。å…許的檔案類型有 {{ types }} 。 + + + This value should be {{ limit }} or less. + 這個變數的值應該å°æ–¼æˆ–等於 {{ limit }}。 + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + 字串太長,長度ä¸å¯è¶…éŽ {{ limit }} 個字元。 + + + This value should be {{ limit }} or more. + 該變數的值應該大於或等於 {{ limit }}。 + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + 字串太短,長度ä¸å¯å°‘æ–¼ {{ limit }} 個字元。 + + + This value should not be blank. + 該變數ä¸æ‡‰ç‚ºç©ºç™½ã€‚ + + + This value should not be null. + 該值ä¸æ‡‰ç‚º null 。 + + + This value should be null. + 該值應為 null 。 + + + This value is not valid. + 無效的數值 。 + + + This value is not a valid time. + 該值ä¸æ˜¯ä¸€å€‹æœ‰æ•ˆçš„時間。 + + + This value is not a valid URL. + 該值ä¸æ˜¯ä¸€å€‹æœ‰æ•ˆçš„ URL 。 + + + The two values should be equal. + 這兩個變數的值應該相等。 + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + 檔案太大,檔案大å°ä¸å¯ä»¥è¶…éŽ {{ limit }} {{ suffix }}。 + + + The file is too large. + 檔案太大。 + + + The file could not be uploaded. + 無法上傳此檔案。 + + + This value should be a valid number. + 該值應該為有效的數字。 + + + This value is not a valid country. + 該值ä¸æ˜¯æœ‰æ•ˆçš„國家å。 + + + This file is not a valid image. + 該檔案ä¸æ˜¯æœ‰æ•ˆçš„圖片。 + + + This is not a valid IP address. + 該值ä¸æ˜¯æœ‰æ•ˆçš„IP地å€ã€‚ + + + This value is not a valid language. + 該值ä¸æ˜¯æœ‰æ•ˆçš„語言å。 + + + This value is not a valid locale. + 該值ä¸æ˜¯æœ‰æ•ˆçš„å€åŸŸå€¼ï¼ˆlocale)。 + + + This value is already used. + 該值已經被使用。 + + + The size of the image could not be detected. + ä¸èƒ½è§£æžåœ–片大å°ã€‚ + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + 圖片太寬 ({{ width }}px),最大寬度為 {{ max_width }}px 。 + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + 圖片寬度ä¸å¤  ({{ width }}px),最å°å¯¬åº¦ç‚º {{ min_width }}px 。 + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + 圖片太高 ({{ height }}px),最大高度為 {{ max_height }}px 。 + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + 圖片高度ä¸å¤  ({{ height }}px),最å°é«˜åº¦ç‚º {{ min_height }}px 。 + + + This value should be the user's current password. + 該變數的值應為用戶目å‰çš„密碼。 + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + 該變數應為 {{ limit }} 個字元。 + + + The file was only partially uploaded. + 該檔案的上傳ä¸å®Œæ•´ã€‚ + + + No file was uploaded. + 沒有上傳任何檔案。 + + + No temporary folder was configured in php.ini. + php.ini 裡沒有é…置臨時目錄。 + + + Cannot write temporary file to disk. + 暫存檔寫入ç£ç¢Ÿå¤±æ•—。 + + + A PHP extension caused the upload to fail. + æŸå€‹ PHP 擴展造æˆä¸Šå‚³å¤±æ•—。 + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + 該集åˆæœ€å°‘æ‡‰åŒ…å« {{ limit }} 個元素。 + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + 該集åˆæœ€å¤šåŒ…å« {{ limit }} 個元素。 + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + 該集åˆæ‡‰åŒ…å« {{ limit }} 個元素 element 。 + + + Invalid card number. + 無效的信用å¡è™Ÿã€‚ + + + Unsupported card type or invalid card number. + ä¸æ”¯æ´çš„信用å¡é¡žåž‹æˆ–無效的信用å¡è™Ÿã€‚ + + + This is not a valid International Bank Account Number (IBAN). + 該值ä¸æ˜¯æœ‰æ•ˆçš„國際銀行帳號(IBAN)。 + + + This value is not a valid ISBN-10. + 該值ä¸æ˜¯æœ‰æ•ˆçš„10ä½åœ‹éš›æ¨™æº–書號(ISBN-10)。 + + + This value is not a valid ISBN-13. + 該值ä¸æ˜¯æœ‰æ•ˆçš„13ä½åœ‹éš›æ¨™æº–書號(ISBN-13)。 + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + 該值ä¸æ˜¯æœ‰æ•ˆçš„國際標準書號(ISBN-10 或 ISBN-13)。 + + + This value is not a valid ISSN. + 該值ä¸æ˜¯æœ‰æ•ˆçš„國際標準期刊號(ISSN)。 + + + This value is not a valid currency. + 該值ä¸æ˜¯æœ‰æ•ˆçš„貨幣å(currency)。 + + + This value should be equal to {{ compared_value }}. + 該值應等於 {{ compared_value }} 。 + + + This value should be greater than {{ compared_value }}. + 該值應大於 {{ compared_value }} 。 + + + This value should be greater than or equal to {{ compared_value }}. + 該值應大於或等於 {{ compared_value }} 。 + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + 該值應與 {{ compared_value_type }} {{ compared_value }} 相åŒã€‚ + + + This value should be less than {{ compared_value }}. + 該值應å°æ–¼ {{ compared_value }} 。 + + + This value should be less than or equal to {{ compared_value }}. + 該值應å°æ–¼æˆ–等於 {{ compared_value }} 。 + + + This value should not be equal to {{ compared_value }}. + 該值應ä¸ç­‰æ–¼ {{ compared_value }} 。 + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + 該值ä¸æ‡‰èˆ‡ {{ compared_value_type }} {{ compared_value }} 相åŒã€‚ + + + + diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/.gitignore b/core/vendor/symfony/validator/Symfony/Component/Validator/.gitignore deleted file mode 100644 index c49a5d8..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/CHANGELOG.md b/core/vendor/symfony/validator/Symfony/Component/Validator/CHANGELOG.md deleted file mode 100644 index 329eaf3..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/CHANGELOG.md +++ /dev/null @@ -1,159 +0,0 @@ -CHANGELOG -========= - -2.6.0 ------ - - * [BC BREAK] `FileValidator` disallow empty files - * [BC BREAK] `UserPasswordValidator` source message change - * [BC BREAK] added internal `ExecutionContextInterface::setConstraint()` - * added `ConstraintViolation::getConstraint()` - * [BC BREAK] The `ExpressionValidator` will now evaluate the Expression even when the property value is null or an empty string - * deprecated `ClassMetadata::hasMemberMetadatas()` - * deprecated `ClassMetadata::getMemberMetadatas()` - * deprecated `ClassMetadata::addMemberMetadata()` - * [BC BREAK] added `Mapping\MetadataInterface::getConstraints()` - * added generic "payload" option to all constraints for attaching domain-specific data - * [BC BREAK] added `ConstraintViolationBuilderInterface::setCause()` - -2.5.0 ------ - - * deprecated `ApcCache` in favor of `DoctrineCache` - * added `DoctrineCache` to adapt any Doctrine cache - * `GroupSequence` now implements `ArrayAccess`, `Countable` and `Traversable` - * [BC BREAK] changed `ClassMetadata::getGroupSequence()` to return a `GroupSequence` instance instead of an array - * `Callback` can now be put onto properties (useful when you pass a closure to the constraint) - * deprecated `ClassBasedInterface` - * deprecated `MetadataInterface` - * deprecated `PropertyMetadataInterface` - * deprecated `PropertyMetadataContainerInterface` - * deprecated `Mapping\ElementMetadata` - * added `Mapping\MetadataInterface` - * added `Mapping\ClassMetadataInterface` - * added `Mapping\PropertyMetadataInterface` - * added `Mapping\GenericMetadata` - * added `Mapping\CascadingStrategy` - * added `Mapping\TraversalStrategy` - * deprecated `Mapping\ClassMetadata::accept()` - * deprecated `Mapping\MemberMetadata::accept()` - * removed array type hint of `Mapping\ClassMetadata::setGroupSequence()` - * deprecated `MetadataFactoryInterface` - * deprecated `Mapping\BlackholeMetadataFactory` - * deprecated `Mapping\ClassMetadataFactory` - * added `Mapping\Factory\MetadataFactoryInterface` - * added `Mapping\Factory\BlackHoleMetadataFactory` - * added `Mapping\Factory\LazyLoadingMetadataFactory` - * deprecated `ExecutionContextInterface` - * deprecated `ExecutionContext` - * deprecated `GlobalExecutionContextInterface` - * added `Context\ExecutionContextInterface` - * added `Context\ExecutionContext` - * added `Context\ExecutionContextFactoryInterface` - * added `Context\ExecutionContextFactory` - * deprecated `ValidatorInterface` - * deprecated `Validator` - * deprecated `ValidationVisitorInterface` - * deprecated `ValidationVisitor` - * added `Validator\ValidatorInterface` - * added `Validator\RecursiveValidator` - * added `Validator\ContextualValidatorInterface` - * added `Validator\RecursiveContextualValidator` - * added `Violation\ConstraintViolationBuilderInterface` - * added `Violation\ConstraintViolationBuilder` - * added `ConstraintViolation::getParameters()` - * added `ConstraintViolation::getPlural()` - * added `Constraints\Traverse` - * deprecated `$deep` property in `Constraints\Valid` - * added `ValidatorBuilderInterface::setApiVersion()` - * added `Validation::API_VERSION_2_4` - * added `Validation::API_VERSION_2_5` - * added `Exception\OutOfBoundsException` - * added `Exception\UnsupportedMetadataException` - * made `Exception\ValidatorException` extend `Exception\RuntimeException` - * added `Util\PropertyPath` - * made the PropertyAccess component an optional dependency - * deprecated `ValidatorBuilder::setPropertyAccessor()` - - -2.4.0 ------ - - * added a constraint the uses the expression language - * added `minRatio`, `maxRatio`, `allowSquare`, `allowLandscape`, and `allowPortrait` to Image validator - -2.3.0 ------ - - * added the ISBN, ISSN, and IBAN validators - * copied the constraints `Optional` and `Required` to the - `Symfony\Component\Validator\Constraints\` namespace and deprecated the original - classes. - * added comparison validators (EqualTo, NotEqualTo, LessThan, LessThanOrEqualTo, GreaterThan, GreaterThanOrEqualTo, IdenticalTo, NotIdenticalTo) - -2.2.0 ------ - - * added a CardScheme validator - * added a Luhn validator - * moved @api-tags from `Validator` to `ValidatorInterface` - * moved @api-tags from `ConstraintViolation` to the new `ConstraintViolationInterface` - * moved @api-tags from `ConstraintViolationList` to the new `ConstraintViolationListInterface` - * moved @api-tags from `ExecutionContext` to the new `ExecutionContextInterface` - * [BC BREAK] `ConstraintValidatorInterface::initialize` is now type hinted against `ExecutionContextInterface` instead of `ExecutionContext` - * [BC BREAK] changed the visibility of the properties in `Validator` from protected to private - * deprecated `ClassMetadataFactoryInterface` in favor of the new `MetadataFactoryInterface` - * deprecated `ClassMetadataFactory::getClassMetadata` in favor of `getMetadataFor` - * created `MetadataInterface`, `PropertyMetadataInterface`, `ClassBasedInterface` and `PropertyMetadataContainerInterface` - * deprecated `GraphWalker` in favor of the new `ValidationVisitorInterface` - * deprecated `ExecutionContext::addViolationAtPath` - * deprecated `ExecutionContext::addViolationAtSubPath` in favor of `ExecutionContextInterface::addViolationAt` - * deprecated `ExecutionContext::getCurrentClass` in favor of `ExecutionContextInterface::getClassName` - * deprecated `ExecutionContext::getCurrentProperty` in favor of `ExecutionContextInterface::getPropertyName` - * deprecated `ExecutionContext::getCurrentValue` in favor of `ExecutionContextInterface::getValue` - * deprecated `ExecutionContext::getGraphWalker` in favor of `ExecutionContextInterface::validate` and `ExecutionContextInterface::validateValue` - * improved `ValidatorInterface::validateValue` to accept arrays of constraints - * changed `ValidatorInterface::getMetadataFactory` to return a `MetadataFactoryInterface` instead of a `ClassMetadataFactoryInterface` - * removed `ClassMetadataFactoryInterface` type hint from `ValidatorBuilderInterface::setMetadataFactory`. - As of Symfony 2.3, this method will be typed against `MetadataFactoryInterface` instead. - * [BC BREAK] the switches `traverse` and `deep` in the `Valid` constraint and in `GraphWalker::walkReference` - are ignored for arrays now. Arrays are always traversed recursively. - * added dependency to Translation component - * violation messages are now translated with a TranslatorInterface implementation - * [BC BREAK] inserted argument `$message` in the constructor of `ConstraintViolation` - * [BC BREAK] inserted arguments `$translator` and `$translationDomain` in the constructor of `ExecutionContext` - * [BC BREAK] inserted arguments `$translator` and `$translationDomain` in the constructor of `GraphWalker` - * [BC BREAK] inserted arguments `$translator` and `$translationDomain` in the constructor of `ValidationVisitor` - * [BC BREAK] inserted arguments `$translator` and `$translationDomain` in the constructor of `Validator` - * [BC BREAK] added `setTranslator()` and `setTranslationDomain()` to `ValidatorBuilderInterface` - * improved the Validator to support pluralized messages by default - * [BC BREAK] changed the source of all pluralized messages in the translation files to the pluralized version - * added ExceptionInterface, BadMethodCallException and InvalidArgumentException - -2.1.0 ------ - - * added support for `ctype_*` assertions in `TypeValidator` - * improved the ImageValidator with min width, max width, min height, and max height constraints - * added support for MIME with wildcard in FileValidator - * changed Collection validator to add "missing" and "extra" errors to - individual fields - * changed default value for `extraFieldsMessage` and `missingFieldsMessage` - in Collection constraint - * made ExecutionContext immutable - * deprecated Constraint methods `setMessage`, `getMessageTemplate` and - `getMessageParameters` - * added support for dynamic group sequences with the GroupSequenceProvider pattern - * [BC BREAK] ConstraintValidatorInterface method `isValid` has been renamed to - `validate`, its return value was dropped. ConstraintValidator still contains - `isValid` for BC - * [BC BREAK] collections in fields annotated with `Valid` are not traversed - recursively anymore by default. `Valid` contains a new property `deep` - which enables the BC behavior. - * added Count constraint - * added Length constraint - * added Range constraint - * deprecated the Min and Max constraints - * deprecated the MinLength and MaxLength constraints - * added Validation and ValidatorBuilderInterface - * deprecated ValidatorContext, ValidatorContextInterface and ValidatorFactory diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/ClassBasedInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/ClassBasedInterface.php deleted file mode 100644 index fe532ef..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/ClassBasedInterface.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -/** - * An object backed by a PHP class. - * - * @author Bernhard Schussek - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link Mapping\ClassMetadataInterface} instead. - */ -interface ClassBasedInterface -{ - /** - * Returns the name of the backing PHP class. - * - * @return string The name of the backing class. - */ - public function getClassName(); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraint.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraint.php deleted file mode 100644 index a8ae634..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraint.php +++ /dev/null @@ -1,321 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; -use Symfony\Component\Validator\Exception\InvalidArgumentException; -use Symfony\Component\Validator\Exception\InvalidOptionsException; -use Symfony\Component\Validator\Exception\MissingOptionsException; - -/** - * Contains the properties of a constraint definition. - * - * A constraint can be defined on a class, an option or a getter method. - * The Constraint class encapsulates all the configuration required for - * validating this class, option or getter result successfully. - * - * Constraint instances are immutable and serializable. - * - * @property array $groups The groups that the constraint belongs to - * - * @author Bernhard Schussek - * - * @api - */ -abstract class Constraint -{ - /** - * The name of the group given to all constraints with no explicit group. - * - * @var string - */ - const DEFAULT_GROUP = 'Default'; - - /** - * Marks a constraint that can be put onto classes. - * - * @var string - */ - const CLASS_CONSTRAINT = 'class'; - - /** - * Marks a constraint that can be put onto properties. - * - * @var string - */ - const PROPERTY_CONSTRAINT = 'property'; - - /** - * Maps error codes to the names of their constants - * @var array - */ - protected static $errorNames = array(); - - /** - * Domain-specific data attached to a constraint - * @var mixed - */ - public $payload; - - /** - * Returns the name of the given error code. - * - * @param int $errorCode The error code - * - * @return string The name of the error code - * - * @throws InvalidArgumentException If the error code does not exist - */ - public static function getErrorName($errorCode) - { - if (!isset(static::$errorNames[$errorCode])) { - throw new InvalidArgumentException(sprintf( - 'The error code "%s" does not exist for constraint of type "%s".', - $errorCode, - get_called_class() - )); - } - - return static::$errorNames[$errorCode]; - } - - /** - * Initializes the constraint with options. - * - * You should pass an associative array. The keys should be the names of - * existing properties in this class. The values should be the value for these - * properties. - * - * Alternatively you can override the method getDefaultOption() to return the - * name of an existing property. If no associative array is passed, this - * property is set instead. - * - * You can force that certain options are set by overriding - * getRequiredOptions() to return the names of these options. If any - * option is not set here, an exception is thrown. - * - * @param mixed $options The options (as associative array) - * or the value for the default - * option (any other type) - * - * @throws InvalidOptionsException When you pass the names of non-existing - * options - * @throws MissingOptionsException When you don't pass any of the options - * returned by getRequiredOptions() - * @throws ConstraintDefinitionException When you don't pass an associative - * array, but getDefaultOption() returns - * null - * - * @api - */ - public function __construct($options = null) - { - $invalidOptions = array(); - $missingOptions = array_flip((array) $this->getRequiredOptions()); - $knownOptions = get_object_vars($this); - - // The "groups" option is added to the object lazily - $knownOptions['groups'] = true; - - if (is_array($options) && count($options) >= 1 && isset($options['value']) && !property_exists($this, 'value')) { - $options[$this->getDefaultOption()] = $options['value']; - unset($options['value']); - } - - if (is_array($options) && count($options) > 0 && is_string(key($options))) { - foreach ($options as $option => $value) { - if (array_key_exists($option, $knownOptions)) { - $this->$option = $value; - unset($missingOptions[$option]); - } else { - $invalidOptions[] = $option; - } - } - } elseif (null !== $options && !(is_array($options) && count($options) === 0)) { - $option = $this->getDefaultOption(); - - if (null === $option) { - throw new ConstraintDefinitionException( - sprintf('No default option is configured for constraint %s', get_class($this)) - ); - } - - if (array_key_exists($option, $knownOptions)) { - $this->$option = $options; - unset($missingOptions[$option]); - } else { - $invalidOptions[] = $option; - } - } - - if (count($invalidOptions) > 0) { - throw new InvalidOptionsException( - sprintf('The options "%s" do not exist in constraint %s', implode('", "', $invalidOptions), get_class($this)), - $invalidOptions - ); - } - - if (count($missingOptions) > 0) { - throw new MissingOptionsException( - sprintf('The options "%s" must be set for constraint %s', implode('", "', array_keys($missingOptions)), get_class($this)), - array_keys($missingOptions) - ); - } - } - - /** - * Sets the value of a lazily initialized option. - * - * Corresponding properties are added to the object on first access. Hence - * this method will be called at most once per constraint instance and - * option name. - * - * @param string $option The option name - * @param mixed $value The value to set - * - * @throws InvalidOptionsException If an invalid option name is given - */ - public function __set($option, $value) - { - if ('groups' === $option) { - $this->groups = (array) $value; - - return; - } - - throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, get_class($this)), array($option)); - } - - /** - * Returns the value of a lazily initialized option. - * - * Corresponding properties are added to the object on first access. Hence - * this method will be called at most once per constraint instance and - * option name. - * - * @param string $option The option name - * - * @return mixed The value of the option - * - * @throws InvalidOptionsException If an invalid option name is given - * - * @internal This method should not be used or overwritten in userland code. - * - * @since 2.6 - */ - public function __get($option) - { - if ('groups' === $option) { - $this->groups = array(self::DEFAULT_GROUP); - - return $this->groups; - } - - throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, get_class($this)), array($option)); - } - - /** - * Adds the given group if this constraint is in the Default group. - * - * @param string $group - * - * @api - */ - public function addImplicitGroupName($group) - { - if (in_array(Constraint::DEFAULT_GROUP, $this->groups) && !in_array($group, $this->groups)) { - $this->groups[] = $group; - } - } - - /** - * Returns the name of the default option. - * - * Override this method to define a default option. - * - * @return string - * - * @see __construct() - * - * @api - */ - public function getDefaultOption() - { - } - - /** - * Returns the name of the required options. - * - * Override this method if you want to define required options. - * - * @return array - * - * @see __construct() - * - * @api - */ - public function getRequiredOptions() - { - return array(); - } - - /** - * Returns the name of the class that validates this constraint. - * - * By default, this is the fully qualified name of the constraint class - * suffixed with "Validator". You can override this method to change that - * behaviour. - * - * @return string - * - * @api - */ - public function validatedBy() - { - return get_class($this).'Validator'; - } - - /** - * Returns whether the constraint can be put onto classes, properties or - * both. - * - * This method should return one or more of the constants - * Constraint::CLASS_CONSTRAINT and Constraint::PROPERTY_CONSTRAINT. - * - * @return string|array One or more constant values - * - * @api - */ - public function getTargets() - { - return self::PROPERTY_CONSTRAINT; - } - - /** - * Optimizes the serialized value to minimize storage space. - * - * @return array The properties to serialize - * - * @internal This method may be replaced by an implementation of - * {@link \Serializable} in the future. Please don't use or - * overwrite it. - * - * @since 2.6 - */ - public function __sleep() - { - // Initialize "groups" option if it is not set - $this->groups; - - return array_keys(get_object_vars($this)); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintValidator.php deleted file mode 100644 index 61c994a..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintValidator.php +++ /dev/null @@ -1,216 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -use Symfony\Component\Validator\Context\ExecutionContextInterface as ExecutionContextInterface2Dot5; -use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface; -use Symfony\Component\Validator\Violation\LegacyConstraintViolationBuilder; - -/** - * Base class for constraint validators. - * - * @author Bernhard Schussek - * - * @api - */ -abstract class ConstraintValidator implements ConstraintValidatorInterface -{ - /** - * Whether to format {@link \DateTime} objects as RFC-3339 dates - * ("Y-m-d H:i:s"). - * - * @var int - */ - const PRETTY_DATE = 1; - - /** - * Whether to cast objects with a "__toString()" method to strings. - * - * @var int - */ - const OBJECT_TO_STRING = 2; - - /** - * @var ExecutionContextInterface - */ - protected $context; - - /** - * {@inheritdoc} - */ - public function initialize(ExecutionContextInterface $context) - { - $this->context = $context; - } - - /** - * Wrapper for {@link ExecutionContextInterface::buildViolation} that - * supports the 2.4 context API. - * - * @param string $message The violation message - * @param array $parameters The message parameters - * - * @return ConstraintViolationBuilderInterface The violation builder - * - * @deprecated This method will be removed in Symfony 3.0. - */ - protected function buildViolation($message, array $parameters = array()) - { - if ($this->context instanceof ExecutionContextInterface2Dot5) { - return $this->context->buildViolation($message, $parameters); - } - - return new LegacyConstraintViolationBuilder($this->context, $message, $parameters); - } - - /** - * Wrapper for {@link ExecutionContextInterface::buildViolation} that - * supports the 2.4 context API. - * - * @param ExecutionContextInterface $context The context to use - * @param string $message The violation message - * @param array $parameters The message parameters - * - * @return ConstraintViolationBuilderInterface The violation builder - * - * @deprecated This method will be removed in Symfony 3.0. - */ - protected function buildViolationInContext(ExecutionContextInterface $context, $message, array $parameters = array()) - { - if ($context instanceof ExecutionContextInterface2Dot5) { - return $context->buildViolation($message, $parameters); - } - - return new LegacyConstraintViolationBuilder($context, $message, $parameters); - } - - /** - * Returns a string representation of the type of the value. - * - * This method should be used if you pass the type of a value as - * message parameter to a constraint violation. Note that such - * parameters should usually not be included in messages aimed at - * non-technical people. - * - * @param mixed $value The value to return the type of - * - * @return string The type of the value - */ - protected function formatTypeOf($value) - { - return is_object($value) ? get_class($value) : gettype($value); - } - - /** - * Returns a string representation of the value. - * - * This method returns the equivalent PHP tokens for most scalar types - * (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped - * in double quotes ("). Objects, arrays and resources are formatted as - * "object", "array" and "resource". If the parameter $prettyDateTime - * is set to true, {@link \DateTime} objects will be formatted as - * RFC-3339 dates ("Y-m-d H:i:s"). - * - * Be careful when passing message parameters to a constraint violation - * that (may) contain objects, arrays or resources. These parameters - * should only be displayed for technical users. Non-technical users - * won't know what an "object", "array" or "resource" is and will be - * confused by the violation message. - * - * @param mixed $value The value to format as string - * @param int $format A bitwise combination of the format - * constants in this class - * - * @return string The string representation of the passed value - */ - protected function formatValue($value, $format = 0) - { - $isDateTime = $value instanceof \DateTime || $value instanceof \DateTimeInterface; - - if (($format & self::PRETTY_DATE) && $isDateTime) { - if (class_exists('IntlDateFormatter')) { - $locale = \Locale::getDefault(); - $formatter = new \IntlDateFormatter($locale, \IntlDateFormatter::MEDIUM, \IntlDateFormatter::SHORT); - - // neither the native nor the stub IntlDateFormatter support - // DateTimeImmutable as of yet - if (!$value instanceof \DateTime) { - $value = new \DateTime( - $value->format('Y-m-d H:i:s.u e'), - $value->getTimezone() - ); - } - - return $formatter->format($value); - } - - return $value->format('Y-m-d H:i:s'); - } - - if (is_object($value)) { - if ($format & self::OBJECT_TO_STRING && method_exists($value, '__toString')) { - return $value->__toString(); - } - - return 'object'; - } - - if (is_array($value)) { - return 'array'; - } - - if (is_string($value)) { - return '"'.$value.'"'; - } - - if (is_resource($value)) { - return 'resource'; - } - - if (null === $value) { - return 'null'; - } - - if (false === $value) { - return 'false'; - } - - if (true === $value) { - return 'true'; - } - - return (string) $value; - } - - /** - * Returns a string representation of a list of values. - * - * Each of the values is converted to a string using - * {@link formatValue()}. The values are then concatenated with commas. - * - * @param array $values A list of values - * @param int $format A bitwise combination of the format - * constants in this class - * - * @return string The string representation of the value list - * - * @see formatValue() - */ - protected function formatValues(array $values, $format = 0) - { - foreach ($values as $key => $value) { - $values[$key] = $this->formatValue($value, $format); - } - - return implode(', ', $values); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintValidatorFactory.php b/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintValidatorFactory.php deleted file mode 100644 index cc6981b..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintValidatorFactory.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -use Symfony\Component\Validator\Constraints\ExpressionValidator; - -/** - * Default implementation of the ConstraintValidatorFactoryInterface. - * - * This enforces the convention that the validatedBy() method on any - * Constraint will return the class name of the ConstraintValidator that - * should validate the Constraint. - * - * @author Bernhard Schussek - */ -class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface -{ - protected $validators = array(); - - private $propertyAccessor; - - public function __construct($propertyAccessor = null) - { - $this->propertyAccessor = $propertyAccessor; - } - - /** - * {@inheritdoc} - */ - public function getInstance(Constraint $constraint) - { - $className = $constraint->validatedBy(); - - if (!isset($this->validators[$className])) { - $this->validators[$className] = 'validator.expression' === $className - ? new ExpressionValidator($this->propertyAccessor) - : new $className(); - } - - return $this->validators[$className]; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintValidatorFactoryInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintValidatorFactoryInterface.php deleted file mode 100644 index 5e21627..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintValidatorFactoryInterface.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -/** - * Specifies an object able to return the correct ConstraintValidatorInterface - * instance given a Constraint object. - */ -interface ConstraintValidatorFactoryInterface -{ - /** - * Given a Constraint, this returns the ConstraintValidatorInterface - * object that should be used to verify its validity. - * - * @param Constraint $constraint The source constraint - * - * @return ConstraintValidatorInterface - */ - public function getInstance(Constraint $constraint); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintValidatorInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintValidatorInterface.php deleted file mode 100644 index f7538a1..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintValidatorInterface.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -/** - * @author Bernhard Schussek - * - * @api - */ -interface ConstraintValidatorInterface -{ - /** - * Initializes the constraint validator. - * - * @param ExecutionContextInterface $context The current validation context - */ - public function initialize(ExecutionContextInterface $context); - - /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api - */ - public function validate($value, Constraint $constraint); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintViolation.php b/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintViolation.php deleted file mode 100644 index 8f4744f..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintViolation.php +++ /dev/null @@ -1,233 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -/** - * Default implementation of {@ConstraintViolationInterface}. - * - * @author Bernhard Schussek - */ -class ConstraintViolation implements ConstraintViolationInterface -{ - /** - * @var string - */ - private $message; - - /** - * @var string - */ - private $messageTemplate; - - /** - * @var array - */ - private $parameters; - - /** - * @var int|null - */ - private $plural; - - /** - * @var mixed - */ - private $root; - - /** - * @var string - */ - private $propertyPath; - - /** - * @var mixed - */ - private $invalidValue; - - /** - * @var Constraint|null - */ - private $constraint; - - /** - * @var mixed - */ - private $code; - - /** - * @var mixed - */ - private $cause; - - /** - * Creates a new constraint violation. - * - * @param string $message The violation message - * @param string $messageTemplate The raw violation message - * @param array $parameters The parameters to substitute in the - * raw violation message - * @param mixed $root The value originally passed to the - * validator - * @param string $propertyPath The property path from the root - * value to the invalid value - * @param mixed $invalidValue The invalid value that caused this - * violation - * @param int|null $plural The number for determining the plural - * form when translating the message - * @param mixed $code The error code of the violation - * @param Constraint|null $constraint The constraint whose validation - * caused the violation - * @param mixed $cause The cause of the violation - */ - public function __construct($message, $messageTemplate, array $parameters, $root, $propertyPath, $invalidValue, $plural = null, $code = null, Constraint $constraint = null, $cause = null) - { - $this->message = $message; - $this->messageTemplate = $messageTemplate; - $this->parameters = $parameters; - $this->plural = $plural; - $this->root = $root; - $this->propertyPath = $propertyPath; - $this->invalidValue = $invalidValue; - $this->constraint = $constraint; - $this->code = $code; - $this->cause = $cause; - } - - /** - * Converts the violation into a string for debugging purposes. - * - * @return string The violation as string. - */ - public function __toString() - { - if (is_object($this->root)) { - $class = 'Object('.get_class($this->root).')'; - } elseif (is_array($this->root)) { - $class = 'Array'; - } else { - $class = (string) $this->root; - } - - $propertyPath = (string) $this->propertyPath; - $code = $this->code; - - if ('' !== $propertyPath && '[' !== $propertyPath[0] && '' !== $class) { - $class .= '.'; - } - - if (!empty($code)) { - $code = ' (code '.$code.')'; - } - - return $class.$propertyPath.":\n ".$this->getMessage().$code; - } - - /** - * {@inheritdoc} - */ - public function getMessageTemplate() - { - return $this->messageTemplate; - } - - /** - * {@inheritdoc} - */ - public function getMessageParameters() - { - return $this->parameters; - } - - /** - * Alias of {@link getMessageParameters()}. - */ - public function getParameters() - { - return $this->parameters; - } - - /** - * {@inheritdoc} - */ - public function getMessagePluralization() - { - return $this->plural; - } - - /** - * Alias of {@link getMessagePluralization()}. - */ - public function getPlural() - { - return $this->plural; - } - - /** - * {@inheritdoc} - */ - public function getMessage() - { - return $this->message; - } - - /** - * {@inheritdoc} - */ - public function getRoot() - { - return $this->root; - } - - /** - * {@inheritdoc} - */ - public function getPropertyPath() - { - return $this->propertyPath; - } - - /** - * {@inheritdoc} - */ - public function getInvalidValue() - { - return $this->invalidValue; - } - - /** - * Returns the constraint whose validation caused the violation. - * - * @return Constraint|null The constraint or null if it is not known - */ - public function getConstraint() - { - return $this->constraint; - } - - /** - * Returns the cause of the violation. - * - * @return mixed - */ - public function getCause() - { - return $this->cause; - } - - /** - * {@inheritdoc} - */ - public function getCode() - { - return $this->code; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintViolationInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintViolationInterface.php deleted file mode 100644 index 232fb55..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintViolationInterface.php +++ /dev/null @@ -1,136 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -/** - * A violation of a constraint that happened during validation. - * - * For each constraint that fails during validation one or more violations are - * created. The violations store the violation message, the path to the failing - * element in the validation graph and the root element that was originally - * passed to the validator. For example, take the following graph: - * - *
- * (Person)---(firstName: string)
- *      \
- *   (address: Address)---(street: string)
- * 
- * - * If the Person object is validated and validation fails for the - * "firstName" property, the generated violation has the Person - * instance as root and the property path "firstName". If validation fails - * for the "street" property of the related Address instance, the root - * element is still the person, but the property path is "address.street". - * - * @author Bernhard Schussek - * - * @api - */ -interface ConstraintViolationInterface -{ - /** - * Returns the violation message. - * - * @return string The violation message. - * - * @api - */ - public function getMessage(); - - /** - * Returns the raw violation message. - * - * The raw violation message contains placeholders for the parameters - * returned by {@link getMessageParameters}. Typically you'll pass the - * message template and parameters to a translation engine. - * - * @return string The raw violation message. - * - * @api - */ - public function getMessageTemplate(); - - /** - * Returns the parameters to be inserted into the raw violation message. - * - * @return array A possibly empty list of parameters indexed by the names - * that appear in the message template. - * - * @see getMessageTemplate() - * - * @api - */ - public function getMessageParameters(); - - /** - * Returns a number for pluralizing the violation message. - * - * For example, the message template could have different translation based - * on a parameter "choices": - * - *
    - *
  • Please select exactly one entry. (choices=1)
  • - *
  • Please select two entries. (choices=2)
  • - *
- * - * This method returns the value of the parameter for choosing the right - * pluralization form (in this case "choices"). - * - * @return int|null The number to use to pluralize of the message. - */ - public function getMessagePluralization(); - - /** - * Returns the root element of the validation. - * - * @return mixed The value that was passed originally to the validator when - * the validation was started. Because the validator traverses - * the object graph, the value at which the violation occurs - * is not necessarily the value that was originally validated. - * - * @api - */ - public function getRoot(); - - /** - * Returns the property path from the root element to the violation. - * - * @return string The property path indicates how the validator reached - * the invalid value from the root element. If the root - * element is a Person instance with a property - * "address" that contains an Address instance - * with an invalid property "street", the generated property - * path is "address.street". Property access is denoted by - * dots, while array access is denoted by square brackets, - * for example "addresses[1].street". - * - * @api - */ - public function getPropertyPath(); - - /** - * Returns the value that caused the violation. - * - * @return mixed The invalid value that caused the validated constraint to - * fail. - * - * @api - */ - public function getInvalidValue(); - - /** - * Returns a machine-digestible error code for the violation. - * - * @return mixed The error code. - */ - public function getCode(); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintViolationList.php b/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintViolationList.php deleted file mode 100644 index cccfa86..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintViolationList.php +++ /dev/null @@ -1,159 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -/** - * Default implementation of {@ConstraintViolationListInterface}. - * - * @author Bernhard Schussek - */ -class ConstraintViolationList implements \IteratorAggregate, ConstraintViolationListInterface -{ - /** - * @var ConstraintViolationInterface[] - */ - private $violations = array(); - - /** - * Creates a new constraint violation list. - * - * @param ConstraintViolationInterface[] $violations The constraint violations to add to the list - */ - public function __construct(array $violations = array()) - { - foreach ($violations as $violation) { - $this->add($violation); - } - } - - /** - * Converts the violation into a string for debugging purposes. - * - * @return string The violation as string. - */ - public function __toString() - { - $string = ''; - - foreach ($this->violations as $violation) { - $string .= $violation."\n"; - } - - return $string; - } - - /** - * {@inheritdoc} - */ - public function add(ConstraintViolationInterface $violation) - { - $this->violations[] = $violation; - } - - /** - * {@inheritdoc} - */ - public function addAll(ConstraintViolationListInterface $otherList) - { - foreach ($otherList as $violation) { - $this->violations[] = $violation; - } - } - - /** - * {@inheritdoc} - */ - public function get($offset) - { - if (!isset($this->violations[$offset])) { - throw new \OutOfBoundsException(sprintf('The offset "%s" does not exist.', $offset)); - } - - return $this->violations[$offset]; - } - - /** - * {@inheritdoc} - */ - public function has($offset) - { - return isset($this->violations[$offset]); - } - - /** - * {@inheritdoc} - */ - public function set($offset, ConstraintViolationInterface $violation) - { - $this->violations[$offset] = $violation; - } - - /** - * {@inheritdoc} - */ - public function remove($offset) - { - unset($this->violations[$offset]); - } - - /** - * {@inheritdoc} - */ - public function getIterator() - { - return new \ArrayIterator($this->violations); - } - - /** - * {@inheritdoc} - */ - public function count() - { - return count($this->violations); - } - - /** - * {@inheritdoc} - */ - public function offsetExists($offset) - { - return $this->has($offset); - } - - /** - * {@inheritdoc} - */ - public function offsetGet($offset) - { - return $this->get($offset); - } - - /** - * {@inheritdoc} - */ - public function offsetSet($offset, $violation) - { - if (null === $offset) { - $this->add($violation); - } else { - $this->set($offset, $violation); - } - } - - /** - * {@inheritdoc} - */ - public function offsetUnset($offset) - { - $this->remove($offset); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintViolationListInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintViolationListInterface.php deleted file mode 100644 index 088c70c..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintViolationListInterface.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -/** - * A list of constraint violations. - * - * @author Bernhard Schussek - * - * @api - */ -interface ConstraintViolationListInterface extends \Traversable, \Countable, \ArrayAccess -{ - /** - * Adds a constraint violation to this list. - * - * @param ConstraintViolationInterface $violation The violation to add. - * - * @api - */ - public function add(ConstraintViolationInterface $violation); - - /** - * Merges an existing violation list into this list. - * - * @param ConstraintViolationListInterface $otherList The list to merge. - * - * @api - */ - public function addAll(ConstraintViolationListInterface $otherList); - - /** - * Returns the violation at a given offset. - * - * @param int $offset The offset of the violation. - * - * @return ConstraintViolationInterface The violation. - * - * @throws \OutOfBoundsException If the offset does not exist. - * - * @api - */ - public function get($offset); - - /** - * Returns whether the given offset exists. - * - * @param int $offset The violation offset. - * - * @return bool Whether the offset exists. - * - * @api - */ - public function has($offset); - - /** - * Sets a violation at a given offset. - * - * @param int $offset The violation offset. - * @param ConstraintViolationInterface $violation The violation. - * - * @api - */ - public function set($offset, ConstraintViolationInterface $violation); - - /** - * Removes a violation at a given offset. - * - * @param int $offset The offset to remove. - * - * @api - */ - public function remove($offset); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/AbstractComparison.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/AbstractComparison.php deleted file mode 100644 index fb1f1f3..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/AbstractComparison.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; - -/** - * Used for the comparison of values. - * - * @author Daniel Holmes - */ -abstract class AbstractComparison extends Constraint -{ - public $message; - public $value; - - /** - * {@inheritdoc} - */ - public function __construct($options = null) - { - if (is_array($options) && !isset($options['value'])) { - throw new ConstraintDefinitionException(sprintf( - 'The %s constraint requires the "value" option to be set.', - get_class($this) - )); - } - - parent::__construct($options); - } - - /** - * {@inheritdoc} - */ - public function getDefaultOption() - { - return 'value'; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php deleted file mode 100644 index ec734b3..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * Provides a base class for the validation of property comparisons. - * - * @author Daniel Holmes - * @author Bernhard Schussek - */ -abstract class AbstractComparisonValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof AbstractComparison) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\AbstractComparison'); - } - - if (null === $value) { - return; - } - - $comparedValue = $constraint->value; - - // Convert strings to DateTimes if comparing another DateTime - // This allows to compare with any date/time value supported by - // the DateTime constructor: - // http://php.net/manual/en/datetime.formats.php - if (is_string($comparedValue)) { - if ($value instanceof \DatetimeImmutable) { - // If $value is immutable, convert the compared value to a - // DateTimeImmutable too - $comparedValue = new \DatetimeImmutable($comparedValue); - } elseif ($value instanceof \DateTime || $value instanceof \DateTimeInterface) { - // Otherwise use DateTime - $comparedValue = new \DateTime($comparedValue); - } - } - - if (!$this->compareValues($value, $comparedValue)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value, self::OBJECT_TO_STRING | self::PRETTY_DATE)) - ->setParameter('{{ compared_value }}', $this->formatValue($comparedValue, self::OBJECT_TO_STRING | self::PRETTY_DATE)) - ->setParameter('{{ compared_value_type }}', $this->formatTypeOf($comparedValue)) - ->addViolation(); - } - } - - /** - * Compares the two given values to find if their relationship is valid. - * - * @param mixed $value1 The first value to compare - * @param mixed $value2 The second value to compare - * - * @return bool true if the relationship is valid, false otherwise - */ - abstract protected function compareValues($value1, $value2); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/All.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/All.php deleted file mode 100644 index 3250fcf..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/All.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class All extends Composite -{ - public $constraints = array(); - - public function getDefaultOption() - { - return 'constraints'; - } - - public function getRequiredOptions() - { - return array('constraints'); - } - - protected function getCompositeOption() - { - return 'constraints'; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/AllValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/AllValidator.php deleted file mode 100644 index a655afc..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/AllValidator.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Context\ExecutionContextInterface; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Bernhard Schussek - * - * @api - */ -class AllValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof All) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\All'); - } - - if (null === $value) { - return; - } - - if (!is_array($value) && !$value instanceof \Traversable) { - throw new UnexpectedTypeException($value, 'array or Traversable'); - } - - $context = $this->context; - - if ($context instanceof ExecutionContextInterface) { - $validator = $context->getValidator()->inContext($context); - - foreach ($value as $key => $element) { - $validator->atPath('['.$key.']')->validate($element, $constraint->constraints); - } - } else { - // 2.4 API - foreach ($value as $key => $element) { - $context->validateValue($element, $constraint->constraints, '['.$key.']'); - } - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Blank.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Blank.php deleted file mode 100644 index 766ce6c..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Blank.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class Blank extends Constraint -{ - public $message = 'This value should be blank.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/BlankValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/BlankValidator.php deleted file mode 100644 index 031c7a5..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/BlankValidator.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Bernhard Schussek - * - * @api - */ -class BlankValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Blank) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Blank'); - } - - if ('' !== $value && null !== $value) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Callback.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Callback.php deleted file mode 100644 index 312952a..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Callback.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class Callback extends Constraint -{ - /** - * @var string|callable - * - * @since 2.4 - */ - public $callback; - - /** - * @var array - * - * @deprecated Deprecated since version 2.4, to be removed in Symfony 3.0. - */ - public $methods; - - /** - * {@inheritdoc} - */ - public function __construct($options = null) - { - // Invocation through annotations with an array parameter only - if (is_array($options) && 1 === count($options) && isset($options['value'])) { - $options = $options['value']; - } - - if (is_array($options) && !isset($options['callback']) && !isset($options['methods']) && !isset($options['groups'])) { - if (is_callable($options)) { - $options = array('callback' => $options); - } else { - // BC with Symfony < 2.4 - $options = array('methods' => $options); - } - } - - parent::__construct($options); - } - - /** - * {@inheritdoc} - */ - public function getDefaultOption() - { - return 'callback'; - } - - /** - * {@inheritdoc} - */ - public function getTargets() - { - return array(self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CallbackValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CallbackValidator.php deleted file mode 100644 index 9939306..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CallbackValidator.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * Validator for Callback constraint. - * - * @author Bernhard Schussek - * - * @api - */ -class CallbackValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($object, Constraint $constraint) - { - if (!$constraint instanceof Callback) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Callback'); - } - - if (null !== $constraint->callback && null !== $constraint->methods) { - throw new ConstraintDefinitionException( - 'The Callback constraint supports either the option "callback" '. - 'or "methods", but not both at the same time.' - ); - } - - // has to be an array so that we can differentiate between callables - // and method names - if (null !== $constraint->methods && !is_array($constraint->methods)) { - throw new UnexpectedTypeException($constraint->methods, 'array'); - } - - $methods = $constraint->methods ?: array($constraint->callback); - - foreach ($methods as $method) { - if ($method instanceof \Closure) { - $method($object, $this->context); - } elseif (is_array($method)) { - if (!is_callable($method)) { - throw new ConstraintDefinitionException(sprintf('"%s::%s" targeted by Callback constraint is not a valid callable', $method[0], $method[1])); - } - - call_user_func($method, $object, $this->context); - } elseif (null !== $object) { - if (!method_exists($object, $method)) { - throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist', $method)); - } - - $reflMethod = new \ReflectionMethod($object, $method); - - if ($reflMethod->isStatic()) { - $reflMethod->invoke(null, $object, $this->context); - } else { - $reflMethod->invoke($object, $this->context); - } - } - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CardScheme.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CardScheme.php deleted file mode 100644 index 14f3b5d..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CardScheme.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * Metadata for the CardSchemeValidator. - * - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Tim Nagel - * @author Bernhard Schussek - */ -class CardScheme extends Constraint -{ - const NOT_NUMERIC_ERROR = 1; - const INVALID_FORMAT_ERROR = 2; - - protected static $errorNames = array( - self::NOT_NUMERIC_ERROR => 'NOT_NUMERIC_ERROR', - self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', - ); - - public $message = 'Unsupported card type or invalid card number.'; - public $schemes; - - public function getDefaultOption() - { - return 'schemes'; - } - - public function getRequiredOptions() - { - return array('schemes'); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CardSchemeValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CardSchemeValidator.php deleted file mode 100644 index 0e7de08..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CardSchemeValidator.php +++ /dev/null @@ -1,122 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * Validates that a card number belongs to a specified scheme. - * - * @author Tim Nagel - * @author Bernhard Schussek - * - * @see http://en.wikipedia.org/wiki/Bank_card_number - * @see http://www.regular-expressions.info/creditcard.html - */ -class CardSchemeValidator extends ConstraintValidator -{ - protected $schemes = array( - // American Express card numbers start with 34 or 37 and have 15 digits. - 'AMEX' => array( - '/^3[47][0-9]{13}$/', - ), - // China UnionPay cards start with 62 and have between 16 and 19 digits. - // Please note that these cards do not follow Luhn Algorithm as a checksum. - 'CHINA_UNIONPAY' => array( - '/^62[0-9]{14,17}$/', - ), - // Diners Club card numbers begin with 300 through 305, 36 or 38. All have 14 digits. - // There are Diners Club cards that begin with 5 and have 16 digits. - // These are a joint venture between Diners Club and MasterCard, and should be processed like a MasterCard. - 'DINERS' => array( - '/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/', - ), - // Discover card numbers begin with 6011, 622126 through 622925, 644 through 649 or 65. - // All have 16 digits. - 'DISCOVER' => array( - '/^6011[0-9]{12}$/', - '/^64[4-9][0-9]{13}$/', - '/^65[0-9]{14}$/', - '/^622(12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|91[0-9]|92[0-5])[0-9]{10}$/', - ), - // InstaPayment cards begin with 637 through 639 and have 16 digits. - 'INSTAPAYMENT' => array( - '/^63[7-9][0-9]{13}$/', - ), - // JCB cards beginning with 2131 or 1800 have 15 digits. - // JCB cards beginning with 35 have 16 digits. - 'JCB' => array( - '/^(?:2131|1800|35[0-9]{3})[0-9]{11}$/', - ), - // Laser cards begin with either 6304, 6706, 6709 or 6771 and have between 16 and 19 digits. - 'LASER' => array( - '/^(6304|670[69]|6771)[0-9]{12,15}$/', - ), - // Maestro cards begin with either 5018, 5020, 5038, 5893, 6304, 6759, 6761, 6762, 6763 or 0604 - // They have between 12 and 19 digits. - 'MAESTRO' => array( - '/^(5018|5020|5038|6304|6759|6761|676[23]|0604)[0-9]{8,15}$/', - ), - // All MasterCard numbers start with the numbers 51 through 55. All have 16 digits. - 'MASTERCARD' => array( - '/^5[1-5][0-9]{14}$/', - ), - // All Visa card numbers start with a 4. New cards have 16 digits. Old cards have 13. - 'VISA' => array( - '/^4([0-9]{12}|[0-9]{15})$/', - ), - ); - - /** - * Validates a creditcard belongs to a specified scheme. - * - * @param mixed $value - * @param Constraint $constraint - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof CardScheme) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\CardScheme'); - } - - if (null === $value || '' === $value) { - return; - } - - if (!is_numeric($value)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(CardScheme::NOT_NUMERIC_ERROR) - ->addViolation(); - - return; - } - - $schemes = array_flip((array) $constraint->schemes); - $schemeRegexes = array_intersect_key($this->schemes, $schemes); - - foreach ($schemeRegexes as $regexes) { - foreach ($regexes as $regex) { - if (preg_match($regex, $value)) { - return; - } - } - } - - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(CardScheme::INVALID_FORMAT_ERROR) - ->addViolation(); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Choice.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Choice.php deleted file mode 100644 index 39a6457..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Choice.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class Choice extends Constraint -{ - const NO_SUCH_CHOICE_ERROR = 1; - const TOO_FEW_ERROR = 2; - const TOO_MANY_ERROR = 3; - - protected static $errorNames = array( - self::NO_SUCH_CHOICE_ERROR => 'NO_SUCH_CHOICE_ERROR', - self::TOO_FEW_ERROR => 'TOO_FEW_ERROR', - self::TOO_MANY_ERROR => 'TOO_MANY_ERROR', - ); - - public $choices; - public $callback; - public $multiple = false; - public $strict = false; - public $min; - public $max; - public $message = 'The value you selected is not a valid choice.'; - public $multipleMessage = 'One or more of the given values is invalid.'; - public $minMessage = 'You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.'; - public $maxMessage = 'You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.'; - - /** - * {@inheritdoc} - */ - public function getDefaultOption() - { - return 'choices'; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/ChoiceValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/ChoiceValidator.php deleted file mode 100644 index cf5774c..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/ChoiceValidator.php +++ /dev/null @@ -1,103 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * ChoiceValidator validates that the value is one of the expected values. - * - * @author Fabien Potencier - * @author Florian Eckerstorfer - * @author Bernhard Schussek - * - * @api - */ -class ChoiceValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Choice) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Choice'); - } - - if (!$constraint->choices && !$constraint->callback) { - throw new ConstraintDefinitionException('Either "choices" or "callback" must be specified on constraint Choice'); - } - - if (null === $value) { - return; - } - - if ($constraint->multiple && !is_array($value)) { - throw new UnexpectedTypeException($value, 'array'); - } - - if ($constraint->callback) { - if (!is_callable($choices = array($this->context->getClassName(), $constraint->callback)) - && !is_callable($choices = $constraint->callback) - ) { - throw new ConstraintDefinitionException('The Choice constraint expects a valid callback'); - } - $choices = call_user_func($choices); - } else { - $choices = $constraint->choices; - } - - if ($constraint->multiple) { - foreach ($value as $_value) { - if (!in_array($_value, $choices, $constraint->strict)) { - $this->buildViolation($constraint->multipleMessage) - ->setParameter('{{ value }}', $this->formatValue($_value)) - ->setCode(Choice::NO_SUCH_CHOICE_ERROR) - ->setInvalidValue($_value) - ->addViolation(); - - return; - } - } - - $count = count($value); - - if ($constraint->min !== null && $count < $constraint->min) { - $this->buildViolation($constraint->minMessage) - ->setParameter('{{ limit }}', $constraint->min) - ->setPlural((int) $constraint->min) - ->setCode(Choice::TOO_FEW_ERROR) - ->addViolation(); - - return; - } - - if ($constraint->max !== null && $count > $constraint->max) { - $this->buildViolation($constraint->maxMessage) - ->setParameter('{{ limit }}', $constraint->max) - ->setPlural((int) $constraint->max) - ->setCode(Choice::TOO_MANY_ERROR) - ->addViolation(); - - return; - } - } elseif (!in_array($value, $choices, $constraint->strict)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Choice::NO_SUCH_CHOICE_ERROR) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Collection.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Collection.php deleted file mode 100644 index 708c8ed..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Collection.php +++ /dev/null @@ -1,87 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class Collection extends Composite -{ - const MISSING_FIELD_ERROR = 1; - const NO_SUCH_FIELD_ERROR = 2; - - protected static $errorNames = array( - self::MISSING_FIELD_ERROR => 'MISSING_FIELD_ERROR', - self::NO_SUCH_FIELD_ERROR => 'NO_SUCH_FIELD_ERROR', - ); - - public $fields = array(); - public $allowExtraFields = false; - public $allowMissingFields = false; - public $extraFieldsMessage = 'This field was not expected.'; - public $missingFieldsMessage = 'This field is missing.'; - - /** - * {@inheritdoc} - */ - public function __construct($options = null) - { - // no known options set? $options is the fields array - if (is_array($options) - && !array_intersect(array_keys($options), array('groups', 'fields', 'allowExtraFields', 'allowMissingFields', 'extraFieldsMessage', 'missingFieldsMessage'))) { - $options = array('fields' => $options); - } - - parent::__construct($options); - } - - /** - * {@inheritdoc} - */ - protected function initializeNestedConstraints() - { - parent::initializeNestedConstraints(); - - if (!is_array($this->fields)) { - throw new ConstraintDefinitionException(sprintf('The option "fields" is expected to be an array in constraint %s', __CLASS__)); - } - - foreach ($this->fields as $fieldName => $field) { - // the XmlFileLoader and YamlFileLoader pass the field Optional - // and Required constraint as an array with exactly one element - if (is_array($field) && count($field) == 1) { - $this->fields[$fieldName] = $field = $field[0]; - } - - if (!$field instanceof Optional && !$field instanceof Required) { - $this->fields[$fieldName] = $field = new Required($field); - } - } - } - - public function getRequiredOptions() - { - return array('fields'); - } - - protected function getCompositeOption() - { - return 'fields'; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Collection/Optional.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Collection/Optional.php deleted file mode 100644 index f7a9204..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Collection/Optional.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints\Collection; - -use Symfony\Component\Validator\Constraints\Optional as BaseOptional; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @deprecated Deprecated in 2.3, to be removed in 3.0. Use - * {@link \Symfony\Component\Validator\Constraints\Optional} instead. - */ -class Optional extends BaseOptional -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Collection/Required.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Collection/Required.php deleted file mode 100644 index e358343..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Collection/Required.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints\Collection; - -use Symfony\Component\Validator\Constraints\Required as BaseRequired; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @deprecated Deprecated in 2.3, to be removed in 3.0. Use - * {@link \Symfony\Component\Validator\Constraints\Required} instead. - */ -class Required extends BaseRequired -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CollectionValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CollectionValidator.php deleted file mode 100644 index c3180d2..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CollectionValidator.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Context\ExecutionContextInterface; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Bernhard Schussek - * - * @api - */ -class CollectionValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Collection) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Collection'); - } - - if (null === $value) { - return; - } - - if (!is_array($value) && !($value instanceof \Traversable && $value instanceof \ArrayAccess)) { - throw new UnexpectedTypeException($value, 'array or Traversable and ArrayAccess'); - } - - // We need to keep the initialized context when CollectionValidator - // calls itself recursively (Collection constraints can be nested). - // Since the context of the validator is overwritten when initialize() - // is called for the nested constraint, the outer validator is - // acting on the wrong context when the nested validation terminates. - // - // A better solution - which should be approached in Symfony 3.0 - is to - // remove the initialize() method and pass the context as last argument - // to validate() instead. - $context = $this->context; - - foreach ($constraint->fields as $field => $fieldConstraint) { - // bug fix issue #2779 - $existsInArray = is_array($value) && array_key_exists($field, $value); - $existsInArrayAccess = $value instanceof \ArrayAccess && $value->offsetExists($field); - - if ($existsInArray || $existsInArrayAccess) { - if (count($fieldConstraint->constraints) > 0) { - if ($context instanceof ExecutionContextInterface) { - $context->getValidator() - ->inContext($context) - ->atPath('['.$field.']') - ->validate($value[$field], $fieldConstraint->constraints); - } else { - // 2.4 API - $context->validateValue($value[$field], $fieldConstraint->constraints, '['.$field.']'); - } - } - } elseif (!$fieldConstraint instanceof Optional && !$constraint->allowMissingFields) { - $this->buildViolationInContext($context, $constraint->missingFieldsMessage) - ->atPath('['.$field.']') - ->setParameter('{{ field }}', $this->formatValue($field)) - ->setInvalidValue(null) - ->setCode(Collection::MISSING_FIELD_ERROR) - ->addViolation(); - } - } - - if (!$constraint->allowExtraFields) { - foreach ($value as $field => $fieldValue) { - if (!isset($constraint->fields[$field])) { - $this->buildViolationInContext($context, $constraint->extraFieldsMessage) - ->atPath('['.$field.']') - ->setParameter('{{ field }}', $this->formatValue($field)) - ->setInvalidValue($fieldValue) - ->setCode(Collection::NO_SUCH_FIELD_ERROR) - ->addViolation(); - } - } - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Composite.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Composite.php deleted file mode 100644 index 22a748c..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Composite.php +++ /dev/null @@ -1,152 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; - -/** - * A constraint that is composed of other constraints. - * - * You should never use the nested constraint instances anywhere else, because - * their groups are adapted when passed to the constructor of this class. - * - * If you want to create your own composite constraint, extend this class and - * let {@link getCompositeOption()} return the name of the property which - * contains the nested constraints. - * - * @since 2.6 - * @author Bernhard Schussek - */ -abstract class Composite extends Constraint -{ - /** - * {@inheritdoc} - * - * The groups of the composite and its nested constraints are made - * consistent using the following strategy: - * - * - If groups are passed explicitly to the composite constraint, but - * not to the nested constraints, the options of the composite - * constraint are copied to the nested constraints; - * - * - If groups are passed explicitly to the nested constraints, but not - * to the composite constraint, the groups of all nested constraints - * are merged and used as groups for the composite constraint; - * - * - If groups are passed explicitly to both the composite and its nested - * constraints, the groups of the nested constraints must be a subset - * of the groups of the composite constraint. If not, a - * {@link ConstraintDefinitionException} is thrown. - * - * All this is done in the constructor, because constraints can then be - * cached. When constraints are loaded from the cache, no more group - * checks need to be done. - */ - public function __construct($options = null) - { - parent::__construct($options); - - $this->initializeNestedConstraints(); - - /** @var Constraint[] $nestedConstraints */ - $compositeOption = $this->getCompositeOption(); - $nestedConstraints = $this->$compositeOption; - - if (!is_array($nestedConstraints)) { - $nestedConstraints = array($nestedConstraints); - } - - foreach ($nestedConstraints as $constraint) { - if (!$constraint instanceof Constraint) { - throw new ConstraintDefinitionException(sprintf('The value %s is not an instance of Constraint in constraint %s', $constraint, get_class($this))); - } - - if ($constraint instanceof Valid) { - throw new ConstraintDefinitionException(sprintf('The constraint Valid cannot be nested inside constraint %s. You can only declare the Valid constraint directly on a field or method.', get_class($this))); - } - } - - if (!property_exists($this, 'groups')) { - $mergedGroups = array(); - - foreach ($nestedConstraints as $constraint) { - foreach ($constraint->groups as $group) { - $mergedGroups[$group] = true; - } - } - - $this->groups = array_keys($mergedGroups); - $this->$compositeOption = $nestedConstraints; - - return; - } - - foreach ($nestedConstraints as $constraint) { - if (property_exists($constraint, 'groups')) { - $excessGroups = array_diff($constraint->groups, $this->groups); - - if (count($excessGroups) > 0) { - throw new ConstraintDefinitionException(sprintf( - 'The group(s) "%s" passed to the constraint %s '. - 'should also be passed to its containing constraint %s', - implode('", "', $excessGroups), - get_class($constraint), - get_class($this) - )); - } - } else { - $constraint->groups = $this->groups; - } - } - - $this->$compositeOption = $nestedConstraints; - } - - /** - * {@inheritdoc} - * - * Implicit group names are forwarded to nested constraints. - * - * @param string $group - */ - public function addImplicitGroupName($group) - { - parent::addImplicitGroupName($group); - - /** @var Constraint[] $nestedConstraints */ - $nestedConstraints = $this->{$this->getCompositeOption()}; - - foreach ($nestedConstraints as $constraint) { - $constraint->addImplicitGroupName($group); - } - } - - /** - * Returns the name of the property that contains the nested constraints. - * - * @return string The property name - */ - abstract protected function getCompositeOption(); - - /** - * Initializes the nested constraints. - * - * This method can be overwritten in subclasses to clean up the nested - * constraints passed to the constructor. - * - * @see Collection::initializeNestedConstraints() - */ - protected function initializeNestedConstraints() - { - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Count.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Count.php deleted file mode 100644 index a3e12fe..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Count.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Exception\MissingOptionsException; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class Count extends Constraint -{ - const TOO_FEW_ERROR = 1; - const TOO_MANY_ERROR = 2; - - protected static $errorNames = array( - self::TOO_FEW_ERROR => 'TOO_FEW_ERROR', - self::TOO_MANY_ERROR => 'TOO_MANY_ERROR', - ); - - public $minMessage = 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.'; - public $maxMessage = 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.'; - public $exactMessage = 'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.'; - public $min; - public $max; - - public function __construct($options = null) - { - if (null !== $options && !is_array($options)) { - $options = array( - 'min' => $options, - 'max' => $options, - ); - } - - parent::__construct($options); - - if (null === $this->min && null === $this->max) { - throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), array('min', 'max')); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CountValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CountValidator.php deleted file mode 100644 index d44f537..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CountValidator.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Bernhard Schussek - */ -class CountValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (null === $value) { - return; - } - - if (!is_array($value) && !$value instanceof \Countable) { - throw new UnexpectedTypeException($value, 'array or \Countable'); - } - - $count = count($value); - - if (null !== $constraint->max && $count > $constraint->max) { - $this->buildViolation($constraint->min == $constraint->max ? $constraint->exactMessage : $constraint->maxMessage) - ->setParameter('{{ count }}', $count) - ->setParameter('{{ limit }}', $constraint->max) - ->setInvalidValue($value) - ->setPlural((int) $constraint->max) - ->setCode(Count::TOO_MANY_ERROR) - ->addViolation(); - - return; - } - - if (null !== $constraint->min && $count < $constraint->min) { - $this->buildViolation($constraint->min == $constraint->max ? $constraint->exactMessage : $constraint->minMessage) - ->setParameter('{{ count }}', $count) - ->setParameter('{{ limit }}', $constraint->min) - ->setInvalidValue($value) - ->setPlural((int) $constraint->min) - ->setCode(Count::TOO_FEW_ERROR) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Country.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Country.php deleted file mode 100644 index ff6f3d0..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Country.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class Country extends Constraint -{ - public $message = 'This value is not a valid country.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CountryValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CountryValidator.php deleted file mode 100644 index 0d001f7..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CountryValidator.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Intl\Intl; -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * Validates whether a value is a valid country code. - * - * @author Bernhard Schussek - * - * @api - */ -class CountryValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Country) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Country'); - } - - if (null === $value || '' === $value) { - return; - } - - if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); - } - - $value = (string) $value; - $countries = Intl::getRegionBundle()->getCountryNames(); - - if (!isset($countries[$value])) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Currency.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Currency.php deleted file mode 100644 index c09fe88..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Currency.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Miha Vrhovnik - * - * @api - */ -class Currency extends Constraint -{ - public $message = 'This value is not a valid currency.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CurrencyValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CurrencyValidator.php deleted file mode 100644 index 5585426..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/CurrencyValidator.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Intl\Intl; -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * Validates whether a value is a valid currency. - * - * @author Miha Vrhovnik - * - * @api - */ -class CurrencyValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Currency) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Currency'); - } - - if (null === $value || '' === $value) { - return; - } - - if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); - } - - $value = (string) $value; - $currencies = Intl::getCurrencyBundle()->getCurrencyNames(); - - if (!isset($currencies[$value])) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Date.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Date.php deleted file mode 100644 index 2bc444f..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Date.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class Date extends Constraint -{ - const INVALID_FORMAT_ERROR = 1; - const INVALID_DATE_ERROR = 2; - - protected static $errorNames = array( - self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', - self::INVALID_DATE_ERROR => 'INVALID_DATE_ERROR', - ); - - public $message = 'This value is not a valid date.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/DateTime.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/DateTime.php deleted file mode 100644 index ae67ff3..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/DateTime.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class DateTime extends Constraint -{ - const INVALID_FORMAT_ERROR = 1; - const INVALID_DATE_ERROR = 2; - const INVALID_TIME_ERROR = 3; - - protected static $errorNames = array( - self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', - self::INVALID_DATE_ERROR => 'INVALID_DATE_ERROR', - self::INVALID_TIME_ERROR => 'INVALID_TIME_ERROR', - ); - - public $message = 'This value is not a valid datetime.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/DateTimeValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/DateTimeValidator.php deleted file mode 100644 index b459c78..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/DateTimeValidator.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Bernhard Schussek - * - * @api - */ -class DateTimeValidator extends DateValidator -{ - const PATTERN = '/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/'; - - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof DateTime) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\DateTime'); - } - - if (null === $value || '' === $value || $value instanceof \DateTime) { - return; - } - - if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); - } - - $value = (string) $value; - - if (!preg_match(static::PATTERN, $value, $matches)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(DateTime::INVALID_FORMAT_ERROR) - ->addViolation(); - - return; - } - - if (!DateValidator::checkDate($matches[1], $matches[2], $matches[3])) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(DateTime::INVALID_DATE_ERROR) - ->addViolation(); - } - - if (!TimeValidator::checkTime($matches[4], $matches[5], $matches[6])) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(DateTime::INVALID_TIME_ERROR) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/DateValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/DateValidator.php deleted file mode 100644 index 77f0111..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/DateValidator.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Bernhard Schussek - * - * @api - */ -class DateValidator extends ConstraintValidator -{ - const PATTERN = '/^(\d{4})-(\d{2})-(\d{2})$/'; - - /** - * Checks whether a date is valid. - * - * @param int $year The year - * @param int $month The month - * @param int $day The day - * - * @return bool Whether the date is valid - * - * @internal - */ - public static function checkDate($year, $month, $day) - { - return checkdate($month, $day, $year); - } - - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Date) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Date'); - } - - if (null === $value || '' === $value || $value instanceof \DateTime) { - return; - } - - if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); - } - - $value = (string) $value; - - if (!preg_match(static::PATTERN, $value, $matches)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Date::INVALID_FORMAT_ERROR) - ->addViolation(); - - return; - } - - if (!self::checkDate($matches[1], $matches[2], $matches[3])) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Date::INVALID_DATE_ERROR) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Email.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Email.php deleted file mode 100644 index 3697717..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Email.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class Email extends Constraint -{ - const INVALID_FORMAT_ERROR = 1; - const MX_CHECK_FAILED_ERROR = 2; - const HOST_CHECK_FAILED_ERROR = 3; - - protected static $errorNames = array( - self::INVALID_FORMAT_ERROR => 'STRICT_CHECK_FAILED_ERROR', - self::MX_CHECK_FAILED_ERROR => 'MX_CHECK_FAILED_ERROR', - self::HOST_CHECK_FAILED_ERROR => 'HOST_CHECK_FAILED_ERROR', - ); - - public $message = 'This value is not a valid email address.'; - public $checkMX = false; - public $checkHost = false; - public $strict; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/EmailValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/EmailValidator.php deleted file mode 100644 index 8d3a7c5..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/EmailValidator.php +++ /dev/null @@ -1,130 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\RuntimeException; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Bernhard Schussek - * - * @api - */ -class EmailValidator extends ConstraintValidator -{ - /** - * isStrict - * - * @var bool - */ - private $isStrict; - - public function __construct($strict = false) - { - $this->isStrict = $strict; - } - - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Email) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Email'); - } - - if (null === $value || '' === $value) { - return; - } - - if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); - } - - $value = (string) $value; - - if (null === $constraint->strict) { - $constraint->strict = $this->isStrict; - } - - if ($constraint->strict) { - if (!class_exists('\Egulias\EmailValidator\EmailValidator')) { - throw new RuntimeException('Strict email validation requires egulias/email-validator'); - } - - $strictValidator = new \Egulias\EmailValidator\EmailValidator(); - - if (!$strictValidator->isValid($value, false, true)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Email::INVALID_FORMAT_ERROR) - ->addViolation(); - - return; - } - } elseif (!preg_match('/.+\@.+\..+/', $value)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Email::INVALID_FORMAT_ERROR) - ->addViolation(); - - return; - } - - $host = substr($value, strpos($value, '@') + 1); - - // Check for host DNS resource records - if ($constraint->checkMX) { - if (!$this->checkMX($host)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Email::MX_CHECK_FAILED_ERROR) - ->addViolation(); - } - - return; - } - - if ($constraint->checkHost && !$this->checkHost($host)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Email::HOST_CHECK_FAILED_ERROR) - ->addViolation(); - } - } - - /** - * Check DNS Records for MX type. - * - * @param string $host Host - * - * @return bool - */ - private function checkMX($host) - { - return checkdnsrr($host, 'MX'); - } - - /** - * Check if one of MX, A or AAAA DNS RR exists. - * - * @param string $host Host - * - * @return bool - */ - private function checkHost($host) - { - return $this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA')); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/EqualTo.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/EqualTo.php deleted file mode 100644 index 8d3d752..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/EqualTo.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Daniel Holmes - */ -class EqualTo extends AbstractComparison -{ - public $message = 'This value should be equal to {{ compared_value }}.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/EqualToValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/EqualToValidator.php deleted file mode 100644 index 3739dbe..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/EqualToValidator.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * Validates values are equal (==). - * - * @author Daniel Holmes - */ -class EqualToValidator extends AbstractComparisonValidator -{ - /** - * {@inheritdoc} - */ - protected function compareValues($value1, $value2) - { - return $value1 == $value2; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Existence.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Existence.php deleted file mode 100644 index 5ea6ffe..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Existence.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * @author Bernhard Schussek - */ -abstract class Existence extends Composite -{ - public $constraints = array(); - - public function getDefaultOption() - { - return 'constraints'; - } - - protected function getCompositeOption() - { - return 'constraints'; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Expression.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Expression.php deleted file mode 100644 index dfa242c..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Expression.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Fabien Potencier - * @author Bernhard Schussek - */ -class Expression extends Constraint -{ - public $message = 'This value is not valid.'; - public $expression; - - /** - * {@inheritdoc} - */ - public function getDefaultOption() - { - return 'expression'; - } - - /** - * {@inheritdoc} - */ - public function getRequiredOptions() - { - return array('expression'); - } - - /** - * {@inheritdoc} - */ - public function getTargets() - { - return array(self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT); - } - - /** - * {@inheritdoc} - */ - public function validatedBy() - { - return 'validator.expression'; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/ExpressionValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/ExpressionValidator.php deleted file mode 100644 index fd3e903..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/ExpressionValidator.php +++ /dev/null @@ -1,117 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\ExpressionLanguage\ExpressionLanguage; -use Symfony\Component\PropertyAccess\PropertyAccess; -use Symfony\Component\PropertyAccess\PropertyAccessorInterface; -use Symfony\Component\PropertyAccess\PropertyPath; -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Context\ExecutionContextInterface; -use Symfony\Component\Validator\Exception\RuntimeException; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Fabien Potencier - * @author Bernhard Schussek - */ -class ExpressionValidator extends ConstraintValidator -{ - /** - * @var PropertyAccessorInterface - */ - private $propertyAccessor; - - /** - * @var ExpressionLanguage - */ - private $expressionLanguage; - - /** - * @param PropertyAccessorInterface|null $propertyAccessor Optional as of Symfony 2.5 - * - * @throws UnexpectedTypeException If the property accessor is invalid - */ - public function __construct($propertyAccessor = null) - { - if (null !== $propertyAccessor && !$propertyAccessor instanceof PropertyAccessorInterface) { - throw new UnexpectedTypeException($propertyAccessor, 'null or \Symfony\Component\PropertyAccess\PropertyAccessorInterface'); - } - - $this->propertyAccessor = $propertyAccessor; - } - - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Expression) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Expression'); - } - - $variables = array(); - - // Symfony 2.5+ - if ($this->context instanceof ExecutionContextInterface) { - $variables['value'] = $value; - $variables['this'] = $this->context->getObject(); - } elseif (null === $this->context->getPropertyName()) { - $variables['value'] = $value; - $variables['this'] = $value; - } else { - $root = $this->context->getRoot(); - $variables['value'] = $value; - - if (is_object($root)) { - // Extract the object that the property belongs to from the object - // graph - $path = new PropertyPath($this->context->getPropertyPath()); - $parentPath = $path->getParent(); - $variables['this'] = $parentPath ? $this->getPropertyAccessor()->getValue($root, $parentPath) : $root; - } else { - $variables['this'] = null; - } - } - - if (!$this->getExpressionLanguage()->evaluate($constraint->expression, $variables)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->addViolation(); - } - } - - private function getExpressionLanguage() - { - if (null === $this->expressionLanguage) { - if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) { - throw new RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); - } - $this->expressionLanguage = new ExpressionLanguage(); - } - - return $this->expressionLanguage; - } - - private function getPropertyAccessor() - { - if (null === $this->propertyAccessor) { - if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccess')) { - throw new RuntimeException('Unable to use expressions as the Symfony PropertyAccess component is not installed.'); - } - $this->propertyAccessor = PropertyAccess::createPropertyAccessor(); - } - - return $this->propertyAccessor; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/False.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/False.php deleted file mode 100644 index fc2e3e4..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/False.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class False extends Constraint -{ - public $message = 'This value should be false.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/FalseValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/FalseValidator.php deleted file mode 100644 index 206780c..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/FalseValidator.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Bernhard Schussek - * - * @api - */ -class FalseValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof False) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\False'); - } - - if (null === $value || false === $value || 0 === $value || '0' === $value) { - return; - } - - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->addViolation(); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/File.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/File.php deleted file mode 100644 index ae0ad67..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/File.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class File extends Constraint -{ - // Check the Image constraint for clashes if adding new constants here - - const NOT_FOUND_ERROR = 1; - const NOT_READABLE_ERROR = 2; - const EMPTY_ERROR = 3; - const TOO_LARGE_ERROR = 4; - const INVALID_MIME_TYPE_ERROR = 5; - - protected static $errorNames = array( - self::NOT_FOUND_ERROR => 'NOT_FOUND_ERROR', - self::NOT_READABLE_ERROR => 'NOT_READABLE_ERROR', - self::EMPTY_ERROR => 'EMPTY_ERROR', - self::TOO_LARGE_ERROR => 'TOO_LARGE_ERROR', - self::INVALID_MIME_TYPE_ERROR => 'INVALID_MIME_TYPE_ERROR', - ); - - public $maxSize; - public $binaryFormat; - public $mimeTypes = array(); - public $notFoundMessage = 'The file could not be found.'; - public $notReadableMessage = 'The file is not readable.'; - public $maxSizeMessage = 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.'; - public $mimeTypesMessage = 'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.'; - public $disallowEmptyMessage = 'An empty file is not allowed.'; - - public $uploadIniSizeErrorMessage = 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.'; - public $uploadFormSizeErrorMessage = 'The file is too large.'; - public $uploadPartialErrorMessage = 'The file was only partially uploaded.'; - public $uploadNoFileErrorMessage = 'No file was uploaded.'; - public $uploadNoTmpDirErrorMessage = 'No temporary folder was configured in php.ini.'; - public $uploadCantWriteErrorMessage = 'Cannot write temporary file to disk.'; - public $uploadExtensionErrorMessage = 'A PHP extension caused the upload to fail.'; - public $uploadErrorMessage = 'The file could not be uploaded.'; - - public function __construct($options = null) - { - parent::__construct($options); - - if ($this->maxSize) { - if (ctype_digit((string) $this->maxSize)) { - $this->maxSize = (int) $this->maxSize; - $this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat; - } elseif (preg_match('/^\d++k$/i', $this->maxSize)) { - $this->maxSize = $this->maxSize * 1000; - $this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat; - } elseif (preg_match('/^\d++M$/i', $this->maxSize)) { - $this->maxSize = $this->maxSize * 1000000; - $this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat; - } elseif (preg_match('/^\d++Ki$/i', $this->maxSize)) { - $this->maxSize = $this->maxSize << 10; - $this->binaryFormat = null === $this->binaryFormat ? true : $this->binaryFormat; - } elseif (preg_match('/^\d++Mi$/i', $this->maxSize)) { - $this->maxSize = $this->maxSize << 20; - $this->binaryFormat = null === $this->binaryFormat ? true : $this->binaryFormat; - } else { - throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum size', $this->maxSize)); - } - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/FileValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/FileValidator.php deleted file mode 100644 index 9d225a9..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/FileValidator.php +++ /dev/null @@ -1,240 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\HttpFoundation\File\File as FileObject; -use Symfony\Component\HttpFoundation\File\UploadedFile; -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Bernhard Schussek - * - * @api - */ -class FileValidator extends ConstraintValidator -{ - const KB_BYTES = 1000; - const MB_BYTES = 1000000; - const KIB_BYTES = 1024; - const MIB_BYTES = 1048576; - - private static $suffices = array( - 1 => 'bytes', - self::KB_BYTES => 'kB', - self::MB_BYTES => 'MB', - self::KIB_BYTES => 'KiB', - self::MIB_BYTES => 'MiB', - ); - - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof File) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\File'); - } - - if (null === $value || '' === $value) { - return; - } - - if ($value instanceof UploadedFile && !$value->isValid()) { - switch ($value->getError()) { - case UPLOAD_ERR_INI_SIZE: - $iniLimitSize = UploadedFile::getMaxFilesize(); - if ($constraint->maxSize && $constraint->maxSize < $iniLimitSize) { - $limitInBytes = $constraint->maxSize; - $binaryFormat = $constraint->binaryFormat; - } else { - $limitInBytes = $iniLimitSize; - $binaryFormat = true; - } - - list($sizeAsString, $limitAsString, $suffix) = $this->factorizeSizes(0, $limitInBytes, $binaryFormat); - $this->buildViolation($constraint->uploadIniSizeErrorMessage) - ->setParameter('{{ limit }}', $limitAsString) - ->setParameter('{{ suffix }}', $suffix) - ->setCode(UPLOAD_ERR_INI_SIZE) - ->addViolation(); - - return; - case UPLOAD_ERR_FORM_SIZE: - $this->buildViolation($constraint->uploadFormSizeErrorMessage) - ->setCode(UPLOAD_ERR_FORM_SIZE) - ->addViolation(); - - return; - case UPLOAD_ERR_PARTIAL: - $this->buildViolation($constraint->uploadPartialErrorMessage) - ->setCode(UPLOAD_ERR_PARTIAL) - ->addViolation(); - - return; - case UPLOAD_ERR_NO_FILE: - $this->buildViolation($constraint->uploadNoFileErrorMessage) - ->setCode(UPLOAD_ERR_NO_FILE) - ->addViolation(); - - return; - case UPLOAD_ERR_NO_TMP_DIR: - $this->buildViolation($constraint->uploadNoTmpDirErrorMessage) - ->setCode(UPLOAD_ERR_NO_TMP_DIR) - ->addViolation(); - - return; - case UPLOAD_ERR_CANT_WRITE: - $this->buildViolation($constraint->uploadCantWriteErrorMessage) - ->setCode(UPLOAD_ERR_CANT_WRITE) - ->addViolation(); - - return; - case UPLOAD_ERR_EXTENSION: - $this->buildViolation($constraint->uploadExtensionErrorMessage) - ->setCode(UPLOAD_ERR_EXTENSION) - ->addViolation(); - - return; - default: - $this->buildViolation($constraint->uploadErrorMessage) - ->setCode($value->getError()) - ->addViolation(); - - return; - } - } - - if (!is_scalar($value) && !$value instanceof FileObject && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); - } - - $path = $value instanceof FileObject ? $value->getPathname() : (string) $value; - - if (!is_file($path)) { - $this->buildViolation($constraint->notFoundMessage) - ->setParameter('{{ file }}', $this->formatValue($path)) - ->setCode(File::NOT_FOUND_ERROR) - ->addViolation(); - - return; - } - - if (!is_readable($path)) { - $this->buildViolation($constraint->notReadableMessage) - ->setParameter('{{ file }}', $this->formatValue($path)) - ->setCode(File::NOT_READABLE_ERROR) - ->addViolation(); - - return; - } - - $sizeInBytes = filesize($path); - - if (0 === $sizeInBytes) { - $this->buildViolation($constraint->disallowEmptyMessage) - ->setParameter('{{ file }}', $this->formatValue($path)) - ->setCode(File::EMPTY_ERROR) - ->addViolation(); - - return; - } - - if ($constraint->maxSize) { - $limitInBytes = $constraint->maxSize; - - if ($sizeInBytes > $limitInBytes) { - list($sizeAsString, $limitAsString, $suffix) = $this->factorizeSizes($sizeInBytes, $limitInBytes, $constraint->binaryFormat); - $this->buildViolation($constraint->maxSizeMessage) - ->setParameter('{{ file }}', $this->formatValue($path)) - ->setParameter('{{ size }}', $sizeAsString) - ->setParameter('{{ limit }}', $limitAsString) - ->setParameter('{{ suffix }}', $suffix) - ->setCode(File::TOO_LARGE_ERROR) - ->addViolation(); - - return; - } - } - - if ($constraint->mimeTypes) { - if (!$value instanceof FileObject) { - $value = new FileObject($value); - } - - $mimeTypes = (array) $constraint->mimeTypes; - $mime = $value->getMimeType(); - - foreach ($mimeTypes as $mimeType) { - if ($mimeType === $mime) { - return; - } - - if ($discrete = strstr($mimeType, '/*', true)) { - if (strstr($mime, '/', true) === $discrete) { - return; - } - } - } - - $this->buildViolation($constraint->mimeTypesMessage) - ->setParameter('{{ file }}', $this->formatValue($path)) - ->setParameter('{{ type }}', $this->formatValue($mime)) - ->setParameter('{{ types }}', $this->formatValues($mimeTypes)) - ->setCode(File::INVALID_MIME_TYPE_ERROR) - ->addViolation(); - } - } - - private static function moreDecimalsThan($double, $numberOfDecimals) - { - return strlen((string) $double) > strlen(round($double, $numberOfDecimals)); - } - - /** - * Convert the limit to the smallest possible number - * (i.e. try "MB", then "kB", then "bytes") - */ - private function factorizeSizes($size, $limit, $binaryFormat) - { - if ($binaryFormat) { - $coef = self::MIB_BYTES; - $coefFactor = self::KIB_BYTES; - } else { - $coef = self::MB_BYTES; - $coefFactor = self::KB_BYTES; - } - - $limitAsString = (string) ($limit / $coef); - - // Restrict the limit to 2 decimals (without rounding! we - // need the precise value) - while (self::moreDecimalsThan($limitAsString, 2)) { - $coef /= $coefFactor; - $limitAsString = (string) ($limit / $coef); - } - - // Convert size to the same measure, but round to 2 decimals - $sizeAsString = (string) round($size / $coef, 2); - - // If the size and limit produce the same string output - // (due to rounding), reduce the coefficient - while ($sizeAsString === $limitAsString) { - $coef /= $coefFactor; - $limitAsString = (string) ($limit / $coef); - $sizeAsString = (string) round($size / $coef, 2); - } - - return array($sizeAsString, $limitAsString, self::$suffices[$coef]); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/GreaterThan.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/GreaterThan.php deleted file mode 100644 index ec7fafb..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/GreaterThan.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Daniel Holmes - */ -class GreaterThan extends AbstractComparison -{ - public $message = 'This value should be greater than {{ compared_value }}.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/GreaterThanOrEqual.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/GreaterThanOrEqual.php deleted file mode 100644 index 36fdd9c..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/GreaterThanOrEqual.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Daniel Holmes - */ -class GreaterThanOrEqual extends AbstractComparison -{ - public $message = 'This value should be greater than or equal to {{ compared_value }}.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/GreaterThanOrEqualValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/GreaterThanOrEqualValidator.php deleted file mode 100644 index 2363204..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/GreaterThanOrEqualValidator.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * Validates values are greater than or equal to the previous (>=). - * - * @author Daniel Holmes - */ -class GreaterThanOrEqualValidator extends AbstractComparisonValidator -{ - /** - * {@inheritdoc} - */ - protected function compareValues($value1, $value2) - { - return $value1 >= $value2; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/GreaterThanValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/GreaterThanValidator.php deleted file mode 100644 index fdcf0c1..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/GreaterThanValidator.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * Validates values are greater than the previous (>). - * - * @author Daniel Holmes - */ -class GreaterThanValidator extends AbstractComparisonValidator -{ - /** - * {@inheritdoc} - */ - protected function compareValues($value1, $value2) - { - return $value1 > $value2; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/GroupSequence.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/GroupSequence.php deleted file mode 100644 index 72bfb16..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/GroupSequence.php +++ /dev/null @@ -1,196 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Exception\OutOfBoundsException; - -/** - * A sequence of validation groups. - * - * When validating a group sequence, each group will only be validated if all - * of the previous groups in the sequence succeeded. For example: - * - * $validator->validate($address, null, new GroupSequence('Basic', 'Strict')); - * - * In the first step, all constraints that belong to the group "Basic" will be - * validated. If none of the constraints fail, the validator will then validate - * the constraints in group "Strict". This is useful, for example, if "Strict" - * contains expensive checks that require a lot of CPU or slow, external - * services. You usually don't want to run expensive checks if any of the cheap - * checks fail. - * - * When adding metadata to a class, you can override the "Default" group of - * that class with a group sequence: - * - * /** - * * @GroupSequence({"Address", "Strict"}) - * *\/ - * class Address - * { - * // ... - * } - * - * Whenever you validate that object in the "Default" group, the group sequence - * will be validated: - * - * $validator->validate($address); - * - * If you want to execute the constraints of the "Default" group for a class - * with an overridden default group, pass the class name as group name instead: - * - * $validator->validate($address, null, "Address") - * - * @Annotation - * @Target({"CLASS", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - * - * Implementing \ArrayAccess, \IteratorAggregate and \Countable is @deprecated since 2.5 and will be removed in 3.0. - */ -class GroupSequence implements \ArrayAccess, \IteratorAggregate, \Countable -{ - /** - * The groups in the sequence. - * - * @var string[]|GroupSequence[] - */ - public $groups; - - /** - * The group in which cascaded objects are validated when validating - * this sequence. - * - * By default, cascaded objects are validated in each of the groups of - * the sequence. - * - * If a class has a group sequence attached, that sequence replaces the - * "Default" group. When validating that class in the "Default" group, the - * group sequence is used instead, but still the "Default" group should be - * cascaded to other objects. - * - * @var string|GroupSequence - */ - public $cascadedGroup; - - /** - * Creates a new group sequence. - * - * @param string[] $groups The groups in the sequence - */ - public function __construct(array $groups) - { - // Support for Doctrine annotations - $this->groups = isset($groups['value']) ? $groups['value'] : $groups; - } - - /** - * Returns an iterator for this group. - * - * @return \Traversable The iterator - * - * @see \IteratorAggregate::getIterator() - * - * @deprecated Implemented for backwards compatibility with Symfony < 2.5. - * To be removed in Symfony 3.0. - */ - public function getIterator() - { - return new \ArrayIterator($this->groups); - } - - /** - * Returns whether the given offset exists in the sequence. - * - * @param int $offset The offset - * - * @return bool Whether the offset exists - * - * @deprecated Implemented for backwards compatibility with Symfony < 2.5. - * To be removed in Symfony 3.0. - */ - public function offsetExists($offset) - { - return isset($this->groups[$offset]); - } - - /** - * Returns the group at the given offset. - * - * @param int $offset The offset - * - * @return string The group a the given offset - * - * @throws OutOfBoundsException If the object does not exist - * - * @deprecated Implemented for backwards compatibility with Symfony < 2.5. - * To be removed in Symfony 3.0. - */ - public function offsetGet($offset) - { - if (!isset($this->groups[$offset])) { - throw new OutOfBoundsException(sprintf( - 'The offset "%s" does not exist.', - $offset - )); - } - - return $this->groups[$offset]; - } - - /** - * Sets the group at the given offset. - * - * @param int $offset The offset - * @param string $value The group name - * - * @deprecated Implemented for backwards compatibility with Symfony < 2.5. - * To be removed in Symfony 3.0. - */ - public function offsetSet($offset, $value) - { - if (null !== $offset) { - $this->groups[$offset] = $value; - - return; - } - - $this->groups[] = $value; - } - - /** - * Removes the group at the given offset. - * - * @param int $offset The offset - * - * @deprecated Implemented for backwards compatibility with Symfony < 2.5. - * To be removed in Symfony 3.0. - */ - public function offsetUnset($offset) - { - unset($this->groups[$offset]); - } - - /** - * Returns the number of groups in the sequence. - * - * @return int The number of groups - * - * @deprecated Implemented for backwards compatibility with Symfony < 2.5. - * To be removed in Symfony 3.0. - */ - public function count() - { - return count($this->groups); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/GroupSequenceProvider.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/GroupSequenceProvider.php deleted file mode 100644 index 3904473..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/GroupSequenceProvider.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * Annotation to define a group sequence provider. - * - * @Annotation - * @Target({"CLASS", "ANNOTATION"}) - */ -class GroupSequenceProvider -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Iban.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Iban.php deleted file mode 100644 index 66ce09a..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Iban.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Manuel Reinhard - * @author Michael Schummel - * @author Bernhard Schussek - */ -class Iban extends Constraint -{ - const TOO_SHORT_ERROR = 1; - const INVALID_COUNTRY_CODE_ERROR = 2; - const INVALID_CHARACTERS_ERROR = 3; - const INVALID_CASE_ERROR = 4; - const CHECKSUM_FAILED_ERROR = 5; - - protected static $errorNames = array( - self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', - self::INVALID_COUNTRY_CODE_ERROR => 'INVALID_COUNTRY_CODE_ERROR', - self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', - self::INVALID_CASE_ERROR => 'INVALID_CASE_ERROR', - self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR', - ); - - public $message = 'This is not a valid International Bank Account Number (IBAN).'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/IbanValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/IbanValidator.php deleted file mode 100644 index 35995d2..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/IbanValidator.php +++ /dev/null @@ -1,143 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Manuel Reinhard - * @author Michael Schummel - * @author Bernhard Schussek - * - * @link http://www.michael-schummel.de/2007/10/05/iban-prufung-mit-php/ - */ -class IbanValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Iban) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Iban'); - } - - if (null === $value || '' === $value) { - return; - } - - if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); - } - - $value = (string) $value; - - // Remove spaces - $canonicalized = str_replace(' ', '', $value); - - // The IBAN must have at least 4 characters... - if (strlen($canonicalized) < 4) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Iban::TOO_SHORT_ERROR) - ->addViolation(); - - return; - } - - // ...start with a country code... - if (!ctype_alpha($canonicalized{0}) || !ctype_alpha($canonicalized{1})) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Iban::INVALID_COUNTRY_CODE_ERROR) - ->addViolation(); - - return; - } - - // ...contain only digits and characters... - if (!ctype_alnum($canonicalized)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Iban::INVALID_CHARACTERS_ERROR) - ->addViolation(); - - return; - } - - // ...and contain uppercase characters only - if ($canonicalized !== strtoupper($canonicalized)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Iban::INVALID_CASE_ERROR) - ->addViolation(); - - return; - } - - // Move the first four characters to the end - // e.g. CH93 0076 2011 6238 5295 7 - // -> 0076 2011 6238 5295 7 CH93 - $canonicalized = substr($canonicalized, 4).substr($canonicalized, 0, 4); - - // Convert all remaining letters to their ordinals - // The result is an integer, which is too large for PHP's int - // data type, so we store it in a string instead. - // e.g. 0076 2011 6238 5295 7 CH93 - // -> 0076 2011 6238 5295 7 121893 - $checkSum = $this->toBigInt($canonicalized); - - // Do a modulo-97 operation on the large integer - // We cannot use PHP's modulo operator, so we calculate the - // modulo step-wisely instead - if (1 !== $this->bigModulo97($checkSum)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Iban::CHECKSUM_FAILED_ERROR) - ->addViolation(); - } - } - - private function toBigInt($string) - { - $chars = str_split($string); - $bigInt = ''; - - foreach ($chars as $char) { - // Convert uppercase characters to ordinals, starting with 10 for "A" - if (ctype_upper($char)) { - $bigInt .= (ord($char) - 55); - - continue; - } - - // Simply append digits - $bigInt .= $char; - } - - return $bigInt; - } - - private function bigModulo97($bigInt) - { - $parts = str_split($bigInt, 7); - $rest = 0; - - foreach ($parts as $part) { - $rest = ($rest.$part) % 97; - } - - return $rest; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/IdenticalTo.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/IdenticalTo.php deleted file mode 100644 index 6d00286..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/IdenticalTo.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Daniel Holmes - */ -class IdenticalTo extends AbstractComparison -{ - public $message = 'This value should be identical to {{ compared_value_type }} {{ compared_value }}.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/IdenticalToValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/IdenticalToValidator.php deleted file mode 100644 index a186726..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/IdenticalToValidator.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * Validates values are identical (===). - * - * @author Daniel Holmes - */ -class IdenticalToValidator extends AbstractComparisonValidator -{ - /** - * {@inheritdoc} - */ - protected function compareValues($value1, $value2) - { - return $value1 === $value2; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Image.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Image.php deleted file mode 100644 index 904ef97..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Image.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Benjamin Dulau - * @author Bernhard Schussek - * - * @api - */ -class Image extends File -{ - // Don't reuse values used in File - - const SIZE_NOT_DETECTED_ERROR = 10; - const TOO_WIDE_ERROR = 11; - const TOO_NARROW_ERROR = 12; - const TOO_HIGH_ERROR = 13; - const TOO_LOW_ERROR = 14; - const RATIO_TOO_BIG_ERROR = 15; - const RATIO_TOO_SMALL_ERROR = 16; - const SQUARE_NOT_ALLOWED_ERROR = 17; - const LANDSCAPE_NOT_ALLOWED_ERROR = 18; - const PORTRAIT_NOT_ALLOWED_ERROR = 19; - - // Include the mapping from the base class - - protected static $errorNames = array( - self::NOT_FOUND_ERROR => 'NOT_FOUND_ERROR', - self::NOT_READABLE_ERROR => 'NOT_READABLE_ERROR', - self::EMPTY_ERROR => 'EMPTY_ERROR', - self::TOO_LARGE_ERROR => 'TOO_LARGE_ERROR', - self::INVALID_MIME_TYPE_ERROR => 'INVALID_MIME_TYPE_ERROR', - self::SIZE_NOT_DETECTED_ERROR => 'SIZE_NOT_DETECTED_ERROR', - self::TOO_WIDE_ERROR => 'TOO_WIDE_ERROR', - self::TOO_NARROW_ERROR => 'TOO_NARROW_ERROR', - self::TOO_HIGH_ERROR => 'TOO_HIGH_ERROR', - self::TOO_LOW_ERROR => 'TOO_LOW_ERROR', - self::RATIO_TOO_BIG_ERROR => 'RATIO_TOO_BIG_ERROR', - self::RATIO_TOO_SMALL_ERROR => 'RATIO_TOO_SMALL_ERROR', - self::SQUARE_NOT_ALLOWED_ERROR => 'SQUARE_NOT_ALLOWED_ERROR', - self::LANDSCAPE_NOT_ALLOWED_ERROR => 'LANDSCAPE_NOT_ALLOWED_ERROR', - self::PORTRAIT_NOT_ALLOWED_ERROR => 'PORTRAIT_NOT_ALLOWED_ERROR', - ); - - public $mimeTypes = 'image/*'; - public $minWidth; - public $maxWidth; - public $maxHeight; - public $minHeight; - public $maxRatio; - public $minRatio; - public $allowSquare = true; - public $allowLandscape = true; - public $allowPortrait = true; - - // The constant for a wrong MIME type is taken from the parent class. - public $mimeTypesMessage = 'This file is not a valid image.'; - public $sizeNotDetectedMessage = 'The size of the image could not be detected.'; - public $maxWidthMessage = 'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.'; - public $minWidthMessage = 'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.'; - public $maxHeightMessage = 'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.'; - public $minHeightMessage = 'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.'; - public $maxRatioMessage = 'The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.'; - public $minRatioMessage = 'The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.'; - public $allowSquareMessage = 'The image is square ({{ width }}x{{ height }}px). Square images are not allowed.'; - public $allowLandscapeMessage = 'The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.'; - public $allowPortraitMessage = 'The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/ImageValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/ImageValidator.php deleted file mode 100644 index e183e27..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/ImageValidator.php +++ /dev/null @@ -1,182 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * Validates whether a value is a valid image file and is valid - * against minWidth, maxWidth, minHeight and maxHeight constraints. - * - * @author Benjamin Dulau - * @author Bernhard Schussek - */ -class ImageValidator extends FileValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Image) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Image'); - } - - $violations = count($this->context->getViolations()); - - parent::validate($value, $constraint); - - $failed = count($this->context->getViolations()) !== $violations; - - if ($failed || null === $value || '' === $value) { - return; - } - - if (null === $constraint->minWidth && null === $constraint->maxWidth - && null === $constraint->minHeight && null === $constraint->maxHeight - && null === $constraint->minRatio && null === $constraint->maxRatio - && $constraint->allowSquare && $constraint->allowLandscape && $constraint->allowPortrait) { - return; - } - - $size = @getimagesize($value); - - if (empty($size) || ($size[0] === 0) || ($size[1] === 0)) { - $this->buildViolation($constraint->sizeNotDetectedMessage) - ->setCode(Image::SIZE_NOT_DETECTED_ERROR) - ->addViolation(); - - return; - } - - $width = $size[0]; - $height = $size[1]; - - if ($constraint->minWidth) { - if (!ctype_digit((string) $constraint->minWidth)) { - throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum width', $constraint->minWidth)); - } - - if ($width < $constraint->minWidth) { - $this->buildViolation($constraint->minWidthMessage) - ->setParameter('{{ width }}', $width) - ->setParameter('{{ min_width }}', $constraint->minWidth) - ->setCode(Image::TOO_NARROW_ERROR) - ->addViolation(); - - return; - } - } - - if ($constraint->maxWidth) { - if (!ctype_digit((string) $constraint->maxWidth)) { - throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum width', $constraint->maxWidth)); - } - - if ($width > $constraint->maxWidth) { - $this->buildViolation($constraint->maxWidthMessage) - ->setParameter('{{ width }}', $width) - ->setParameter('{{ max_width }}', $constraint->maxWidth) - ->setCode(Image::TOO_WIDE_ERROR) - ->addViolation(); - - return; - } - } - - if ($constraint->minHeight) { - if (!ctype_digit((string) $constraint->minHeight)) { - throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum height', $constraint->minHeight)); - } - - if ($height < $constraint->minHeight) { - $this->buildViolation($constraint->minHeightMessage) - ->setParameter('{{ height }}', $height) - ->setParameter('{{ min_height }}', $constraint->minHeight) - ->setCode(Image::TOO_LOW_ERROR) - ->addViolation(); - - return; - } - } - - if ($constraint->maxHeight) { - if (!ctype_digit((string) $constraint->maxHeight)) { - throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum height', $constraint->maxHeight)); - } - - if ($height > $constraint->maxHeight) { - $this->buildViolation($constraint->maxHeightMessage) - ->setParameter('{{ height }}', $height) - ->setParameter('{{ max_height }}', $constraint->maxHeight) - ->setCode(Image::TOO_HIGH_ERROR) - ->addViolation(); - } - } - - $ratio = round($width / $height, 2); - - if (null !== $constraint->minRatio) { - if (!is_numeric((string) $constraint->minRatio)) { - throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum ratio', $constraint->minRatio)); - } - - if ($ratio < $constraint->minRatio) { - $this->buildViolation($constraint->minRatioMessage) - ->setParameter('{{ ratio }}', $ratio) - ->setParameter('{{ min_ratio }}', $constraint->minRatio) - ->setCode(Image::RATIO_TOO_SMALL_ERROR) - ->addViolation(); - } - } - - if (null !== $constraint->maxRatio) { - if (!is_numeric((string) $constraint->maxRatio)) { - throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum ratio', $constraint->maxRatio)); - } - - if ($ratio > $constraint->maxRatio) { - $this->buildViolation($constraint->maxRatioMessage) - ->setParameter('{{ ratio }}', $ratio) - ->setParameter('{{ max_ratio }}', $constraint->maxRatio) - ->setCode(Image::RATIO_TOO_BIG_ERROR) - ->addViolation(); - } - } - - if (!$constraint->allowSquare && $width == $height) { - $this->buildViolation($constraint->allowSquareMessage) - ->setParameter('{{ width }}', $width) - ->setParameter('{{ height }}', $height) - ->setCode(Image::SQUARE_NOT_ALLOWED_ERROR) - ->addViolation(); - } - - if (!$constraint->allowLandscape && $width > $height) { - $this->buildViolation($constraint->allowLandscapeMessage) - ->setParameter('{{ width }}', $width) - ->setParameter('{{ height }}', $height) - ->setCode(Image::LANDSCAPE_NOT_ALLOWED_ERROR) - ->addViolation(); - } - - if (!$constraint->allowPortrait && $width < $height) { - $this->buildViolation($constraint->allowPortraitMessage) - ->setParameter('{{ width }}', $width) - ->setParameter('{{ height }}', $height) - ->setCode(Image::PORTRAIT_NOT_ALLOWED_ERROR) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Ip.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Ip.php deleted file mode 100644 index 27f0b2d..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Ip.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; - -/** - * Validates that a value is a valid IP address. - * - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * @author Joseph Bielawski - * - * @api - */ -class Ip extends Constraint -{ - const V4 = '4'; - const V6 = '6'; - const ALL = 'all'; - - // adds FILTER_FLAG_NO_PRIV_RANGE flag (skip private ranges) - const V4_NO_PRIV = '4_no_priv'; - const V6_NO_PRIV = '6_no_priv'; - const ALL_NO_PRIV = 'all_no_priv'; - - // adds FILTER_FLAG_NO_RES_RANGE flag (skip reserved ranges) - const V4_NO_RES = '4_no_res'; - const V6_NO_RES = '6_no_res'; - const ALL_NO_RES = 'all_no_res'; - - // adds FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE flags (skip both) - const V4_ONLY_PUBLIC = '4_public'; - const V6_ONLY_PUBLIC = '6_public'; - const ALL_ONLY_PUBLIC = 'all_public'; - - protected static $versions = array( - self::V4, - self::V6, - self::ALL, - - self::V4_NO_PRIV, - self::V6_NO_PRIV, - self::ALL_NO_PRIV, - - self::V4_NO_RES, - self::V6_NO_RES, - self::ALL_NO_RES, - - self::V4_ONLY_PUBLIC, - self::V6_ONLY_PUBLIC, - self::ALL_ONLY_PUBLIC, - ); - - public $version = self::V4; - - public $message = 'This is not a valid IP address.'; - - /** - * {@inheritdoc} - */ - public function __construct($options = null) - { - parent::__construct($options); - - if (!in_array($this->version, self::$versions)) { - throw new ConstraintDefinitionException(sprintf('The option "version" must be one of "%s"', implode('", "', self::$versions))); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/IpValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/IpValidator.php deleted file mode 100644 index 2bbe7e4..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/IpValidator.php +++ /dev/null @@ -1,103 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * Validates whether a value is a valid IP address. - * - * @author Bernhard Schussek - * @author Joseph Bielawski - * - * @api - */ -class IpValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Ip) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Ip'); - } - - if (null === $value || '' === $value) { - return; - } - - if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); - } - - $value = (string) $value; - - switch ($constraint->version) { - case Ip::V4: - $flag = FILTER_FLAG_IPV4; - break; - - case Ip::V6: - $flag = FILTER_FLAG_IPV6; - break; - - case Ip::V4_NO_PRIV: - $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE; - break; - - case Ip::V6_NO_PRIV: - $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE; - break; - - case Ip::ALL_NO_PRIV: - $flag = FILTER_FLAG_NO_PRIV_RANGE; - break; - - case Ip::V4_NO_RES: - $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE; - break; - - case Ip::V6_NO_RES: - $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE; - break; - - case Ip::ALL_NO_RES: - $flag = FILTER_FLAG_NO_RES_RANGE; - break; - - case Ip::V4_ONLY_PUBLIC: - $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; - break; - - case Ip::V6_ONLY_PUBLIC: - $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; - break; - - case Ip::ALL_ONLY_PUBLIC: - $flag = FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; - break; - - default: - $flag = null; - break; - } - - if (!filter_var($value, FILTER_VALIDATE_IP, $flag)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Isbn.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Isbn.php deleted file mode 100644 index 67d177f..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Isbn.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author The Whole Life To Learn - * @author Manuel Reinhard - * @author Bernhard Schussek - */ -class Isbn extends Constraint -{ - const TOO_SHORT_ERROR = 1; - const TOO_LONG_ERROR = 2; - const INVALID_CHARACTERS_ERROR = 3; - const CHECKSUM_FAILED_ERROR = 4; - const TYPE_NOT_RECOGNIZED_ERROR = 5; - - protected static $errorNames = array( - self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', - self::TOO_LONG_ERROR => 'TOO_LONG_ERROR', - self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', - self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR', - self::TYPE_NOT_RECOGNIZED_ERROR => 'TYPE_NOT_RECOGNIZED_ERROR', - ); - - public $isbn10Message = 'This value is not a valid ISBN-10.'; - public $isbn13Message = 'This value is not a valid ISBN-13.'; - public $bothIsbnMessage = 'This value is neither a valid ISBN-10 nor a valid ISBN-13.'; - public $type; - public $message; - - /** - * @deprecated Deprecated since version 2.5, to be removed in 3.0. Use option "type" instead. - * @var bool - */ - public $isbn10 = false; - - /** - * @deprecated Deprecated since version 2.5, to be removed in 3.0. Use option "type" instead. - * @var bool - */ - public $isbn13 = false; - - /** - * {@inheritdoc} - */ - public function getDefaultOption() - { - return 'type'; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/IsbnValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/IsbnValidator.php deleted file mode 100644 index 5980857..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/IsbnValidator.php +++ /dev/null @@ -1,192 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * Validates whether the value is a valid ISBN-10 or ISBN-13 - * - * @author The Whole Life To Learn - * @author Manuel Reinhard - * @author Bernhard Schussek - * - * @see https://en.wikipedia.org/wiki/Isbn - */ -class IsbnValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Isbn) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Isbn'); - } - - if (null === $value || '' === $value) { - return; - } - - if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); - } - - $value = (string) $value; - $canonical = str_replace('-', '', $value); - - if (null === $constraint->type) { - if ($constraint->isbn10 && !$constraint->isbn13) { - $constraint->type = 'isbn10'; - } elseif ($constraint->isbn13 && !$constraint->isbn10) { - $constraint->type = 'isbn13'; - } - } - - // Explicitly validate against ISBN-10 - if ('isbn10' === $constraint->type) { - if (true !== ($code = $this->validateIsbn10($canonical))) { - $this->buildViolation($this->getMessage($constraint, $constraint->type)) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode($code) - ->addViolation(); - } - - return; - } - - // Explicitly validate against ISBN-13 - if ('isbn13' === $constraint->type) { - if (true !== ($code = $this->validateIsbn13($canonical))) { - $this->buildViolation($this->getMessage($constraint, $constraint->type)) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode($code) - ->addViolation(); - } - - return; - } - - // Try both ISBNs - - // First, try ISBN-10 - $code = $this->validateIsbn10($canonical); - - // The ISBN can only be an ISBN-13 if the value was too long for ISBN-10 - if (Isbn::TOO_LONG_ERROR === $code) { - // Try ISBN-13 now - $code = $this->validateIsbn13($canonical); - - // If too short, this means we have 11 or 12 digits - if (Isbn::TOO_SHORT_ERROR === $code) { - $code = Isbn::TYPE_NOT_RECOGNIZED_ERROR; - } - } - - if (true !== $code) { - $this->buildViolation($this->getMessage($constraint)) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode($code) - ->addViolation(); - } - } - - protected function validateIsbn10($isbn) - { - // Choose an algorithm so that ERROR_INVALID_CHARACTERS is preferred - // over ERROR_TOO_SHORT/ERROR_TOO_LONG - // Otherwise "0-45122-5244" passes, but "0-45122_5244" reports - // "too long" - - // Error priority: - // 1. ERROR_INVALID_CHARACTERS - // 2. ERROR_TOO_SHORT/ERROR_TOO_LONG - // 3. ERROR_CHECKSUM_FAILED - - $checkSum = 0; - - for ($i = 0; $i < 10; ++$i) { - // If we test the length before the loop, we get an ERROR_TOO_SHORT - // when actually an ERROR_INVALID_CHARACTERS is wanted, e.g. for - // "0-45122_5244" (typo) - if (!isset($isbn{$i})) { - return Isbn::TOO_SHORT_ERROR; - } - - if ('X' === $isbn{$i}) { - $digit = 10; - } elseif (ctype_digit($isbn{$i})) { - $digit = $isbn{$i}; - } else { - return Isbn::INVALID_CHARACTERS_ERROR; - } - - $checkSum += $digit * (10 - $i); - } - - if (isset($isbn{$i})) { - return Isbn::TOO_LONG_ERROR; - } - - return 0 === $checkSum % 11 ? true : Isbn::CHECKSUM_FAILED_ERROR; - } - - protected function validateIsbn13($isbn) - { - // Error priority: - // 1. ERROR_INVALID_CHARACTERS - // 2. ERROR_TOO_SHORT/ERROR_TOO_LONG - // 3. ERROR_CHECKSUM_FAILED - - if (!ctype_digit($isbn)) { - return Isbn::INVALID_CHARACTERS_ERROR; - } - - $length = strlen($isbn); - - if ($length < 13) { - return Isbn::TOO_SHORT_ERROR; - } - - if ($length > 13) { - return Isbn::TOO_LONG_ERROR; - } - - $checkSum = 0; - - for ($i = 0; $i < 13; $i += 2) { - $checkSum += $isbn{$i}; - } - - for ($i = 1; $i < 12; $i += 2) { - $checkSum += $isbn{$i} - * 3; - } - - return 0 === $checkSum % 10 ? true : Isbn::CHECKSUM_FAILED_ERROR; - } - - protected function getMessage($constraint, $type = null) - { - if (null !== $constraint->message) { - return $constraint->message; - } elseif ('isbn10' === $type) { - return $constraint->isbn10Message; - } elseif ('isbn13' === $type) { - return $constraint->isbn13Message; - } - - return $constraint->bothIsbnMessage; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Issn.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Issn.php deleted file mode 100644 index 39716a2..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Issn.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Antonio J. García Lagar - * @author Bernhard Schussek - */ -class Issn extends Constraint -{ - const TOO_SHORT_ERROR = 1; - const TOO_LONG_ERROR = 2; - const MISSING_HYPHEN_ERROR = 3; - const INVALID_CHARACTERS_ERROR = 4; - const INVALID_CASE_ERROR = 5; - const CHECKSUM_FAILED_ERROR = 6; - - protected static $errorNames = array( - self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', - self::TOO_LONG_ERROR => 'TOO_LONG_ERROR', - self::MISSING_HYPHEN_ERROR => 'MISSING_HYPHEN_ERROR', - self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', - self::INVALID_CASE_ERROR => 'INVALID_CASE_ERROR', - self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR', - ); - - public $message = 'This value is not a valid ISSN.'; - public $caseSensitive = false; - public $requireHyphen = false; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/IssnValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/IssnValidator.php deleted file mode 100644 index 1f17c38..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/IssnValidator.php +++ /dev/null @@ -1,132 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * Validates whether the value is a valid ISSN. - * - * @author Antonio J. García Lagar - * @author Bernhard Schussek - * - * @see https://en.wikipedia.org/wiki/Issn - */ -class IssnValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Issn) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Issn'); - } - - if (null === $value || '' === $value) { - return; - } - - if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); - } - - $value = (string) $value; - $canonical = $value; - - // 1234-567X - // ^ - if (isset($canonical{4}) && '-' === $canonical{4}) { - // remove hyphen - $canonical = substr($canonical, 0, 4).substr($canonical, 5); - } elseif ($constraint->requireHyphen) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Issn::MISSING_HYPHEN_ERROR) - ->addViolation(); - - return; - } - - $length = strlen($canonical); - - if ($length < 8) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Issn::TOO_SHORT_ERROR) - ->addViolation(); - - return; - } - - if ($length > 8) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Issn::TOO_LONG_ERROR) - ->addViolation(); - - return; - } - - // 1234567X - // ^^^^^^^ digits only - if (!ctype_digit(substr($canonical, 0, 7))) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Issn::INVALID_CHARACTERS_ERROR) - ->addViolation(); - - return; - } - - // 1234567X - // ^ digit, x or X - if (!ctype_digit($canonical{7}) && 'x' !== $canonical{7} && 'X' !== $canonical{7}) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Issn::INVALID_CHARACTERS_ERROR) - ->addViolation(); - - return; - } - - // 1234567X - // ^ case-sensitive? - if ($constraint->caseSensitive && 'x' === $canonical{7}) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Issn::INVALID_CASE_ERROR) - ->addViolation(); - - return; - } - - // Calculate a checksum. "X" equals 10. - $checkSum = 'X' === $canonical{7} || 'x' === $canonical{7} - ? 10 - : $canonical{7}; - - for ($i = 0; $i < 7; ++$i) { - // Multiply the first digit by 8, the second by 7, etc. - $checkSum += (8 - $i) * $canonical{$i}; - } - - if (0 !== $checkSum % 11) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Issn::CHECKSUM_FAILED_ERROR) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Language.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Language.php deleted file mode 100644 index e7c29dc..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Language.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class Language extends Constraint -{ - public $message = 'This value is not a valid language.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LanguageValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LanguageValidator.php deleted file mode 100644 index be7ad28..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LanguageValidator.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Intl\Intl; -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * Validates whether a value is a valid language code. - * - * @author Bernhard Schussek - * - * @api - */ -class LanguageValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Language) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Language'); - } - - if (null === $value || '' === $value) { - return; - } - - if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); - } - - $value = (string) $value; - $languages = Intl::getLanguageBundle()->getLanguageNames(); - - if (!isset($languages[$value])) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Length.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Length.php deleted file mode 100644 index 8d00480..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Length.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Exception\MissingOptionsException; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class Length extends Constraint -{ - const TOO_SHORT_ERROR = 1; - const TOO_LONG_ERROR = 2; - - protected static $errorNames = array( - self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', - self::TOO_LONG_ERROR => 'TOO_LONG_ERROR', - ); - - public $maxMessage = 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.'; - public $minMessage = 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.'; - public $exactMessage = 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.'; - public $charsetMessage = 'This value does not match the expected {{ charset }} charset.'; - public $max; - public $min; - public $charset = 'UTF-8'; - - public function __construct($options = null) - { - if (null !== $options && !is_array($options)) { - $options = array( - 'min' => $options, - 'max' => $options, - ); - } - - parent::__construct($options); - - if (null === $this->min && null === $this->max) { - throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), array('min', 'max')); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LengthValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LengthValidator.php deleted file mode 100644 index f822047..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LengthValidator.php +++ /dev/null @@ -1,98 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Bernhard Schussek - */ -class LengthValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Length) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Length'); - } - - if (null === $value || '' === $value) { - return; - } - - if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); - } - - $stringValue = (string) $value; - $invalidCharset = false; - - if ('UTF8' === $charset = strtoupper($constraint->charset)) { - $charset = 'UTF-8'; - } - - if (function_exists('iconv_strlen')) { - $length = @iconv_strlen($stringValue, $constraint->charset); - $invalidCharset = false === $length; - } elseif (function_exists('mb_strlen')) { - if (mb_check_encoding($stringValue, $constraint->charset)) { - $length = mb_strlen($stringValue, $constraint->charset); - } else { - $invalidCharset = true; - } - } elseif ('UTF-8' !== $charset) { - $length = strlen($stringValue); - } elseif (!preg_match('//u', $stringValue)) { - $invalidCharset = true; - } elseif (function_exists('utf8_decode')) { - $length = strlen(utf8_decode($stringValue)); - } else { - preg_replace('/./u', '', $stringValue, -1, $length); - } - - if ($invalidCharset) { - $this->buildViolation($constraint->charsetMessage) - ->setParameter('{{ value }}', $this->formatValue($stringValue)) - ->setParameter('{{ charset }}', $constraint->charset) - ->setInvalidValue($value) - ->addViolation(); - - return; - } - - if (null !== $constraint->max && $length > $constraint->max) { - $this->buildViolation($constraint->min == $constraint->max ? $constraint->exactMessage : $constraint->maxMessage) - ->setParameter('{{ value }}', $this->formatValue($stringValue)) - ->setParameter('{{ limit }}', $constraint->max) - ->setInvalidValue($value) - ->setPlural((int) $constraint->max) - ->setCode(Length::TOO_LONG_ERROR) - ->addViolation(); - - return; - } - - if (null !== $constraint->min && $length < $constraint->min) { - $this->buildViolation($constraint->min == $constraint->max ? $constraint->exactMessage : $constraint->minMessage) - ->setParameter('{{ value }}', $this->formatValue($stringValue)) - ->setParameter('{{ limit }}', $constraint->min) - ->setInvalidValue($value) - ->setPlural((int) $constraint->min) - ->setCode(Length::TOO_SHORT_ERROR) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LessThan.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LessThan.php deleted file mode 100644 index b116320..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LessThan.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Daniel Holmes - */ -class LessThan extends AbstractComparison -{ - public $message = 'This value should be less than {{ compared_value }}.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LessThanOrEqual.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LessThanOrEqual.php deleted file mode 100644 index 7faca84..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LessThanOrEqual.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Daniel Holmes - */ -class LessThanOrEqual extends AbstractComparison -{ - public $message = 'This value should be less than or equal to {{ compared_value }}.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LessThanOrEqualValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LessThanOrEqualValidator.php deleted file mode 100644 index dcc93b2..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LessThanOrEqualValidator.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * Validates values are less than or equal to the previous (<=). - * - * @author Daniel Holmes - */ -class LessThanOrEqualValidator extends AbstractComparisonValidator -{ - /** - * {@inheritdoc} - */ - protected function compareValues($value1, $value2) - { - return $value1 <= $value2; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LessThanValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LessThanValidator.php deleted file mode 100644 index 081316a..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LessThanValidator.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * Validates values are less than the previous (<). - * - * @author Daniel Holmes - */ -class LessThanValidator extends AbstractComparisonValidator -{ - /** - * {@inheritdoc} - */ - protected function compareValues($value1, $value2) - { - return $value1 < $value2; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Locale.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Locale.php deleted file mode 100644 index 12a5546..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Locale.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class Locale extends Constraint -{ - public $message = 'This value is not a valid locale.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LocaleValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LocaleValidator.php deleted file mode 100644 index 748e5cf..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LocaleValidator.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Intl\Intl; -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * Validates whether a value is a valid locale code. - * - * @author Bernhard Schussek - * - * @api - */ -class LocaleValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Locale) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Locale'); - } - - if (null === $value || '' === $value) { - return; - } - - if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); - } - - $value = (string) $value; - $locales = Intl::getLocaleBundle()->getLocaleNames(); - - if (!isset($locales[$value])) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Luhn.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Luhn.php deleted file mode 100644 index 24f5bc7..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Luhn.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * Metadata for the LuhnValidator. - * - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Tim Nagel - * @author Greg Knapp http://gregk.me/2011/php-implementation-of-bank-card-luhn-algorithm/ - * @author Bernhard Schussek - */ -class Luhn extends Constraint -{ - const INVALID_CHARACTERS_ERROR = 1; - const CHECKSUM_FAILED_ERROR = 2; - - protected static $errorNames = array( - self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', - self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR', - ); - - public $message = 'Invalid card number.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LuhnValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LuhnValidator.php deleted file mode 100644 index d58bfbf..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/LuhnValidator.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * Validates a PAN using the LUHN Algorithm. - * - * For a list of example card numbers that are used to test this - * class, please see the LuhnValidatorTest class. - * - * @see http://en.wikipedia.org/wiki/Luhn_algorithm - * - * @author Tim Nagel - * @author Greg Knapp http://gregk.me/2011/php-implementation-of-bank-card-luhn-algorithm/ - * @author Bernhard Schussek - */ -class LuhnValidator extends ConstraintValidator -{ - /** - * Validates a credit card number with the Luhn algorithm. - * - * @param mixed $value - * @param Constraint $constraint - * - * @throws UnexpectedTypeException when the given credit card number is no string - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Luhn) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Luhn'); - } - - if (null === $value || '' === $value) { - return; - } - - // Work with strings only, because long numbers are represented as floats - // internally and don't work with strlen() - if (!is_string($value) && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); - } - - $value = (string) $value; - - if (!ctype_digit($value)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Luhn::INVALID_CHARACTERS_ERROR) - ->addViolation(); - - return; - } - - $checkSum = 0; - $length = strlen($value); - - // Starting with the last digit and walking left, add every second - // digit to the check sum - // e.g. 7 9 9 2 7 3 9 8 7 1 3 - // ^ ^ ^ ^ ^ ^ - // = 7 + 9 + 7 + 9 + 7 + 3 - for ($i = $length - 1; $i >= 0; $i -= 2) { - $checkSum += $value{$i}; - } - - // Starting with the second last digit and walking left, double every - // second digit and add it to the check sum - // For doubles greater than 9, sum the individual digits - // e.g. 7 9 9 2 7 3 9 8 7 1 3 - // ^ ^ ^ ^ ^ - // = 1+8 + 4 + 6 + 1+6 + 2 - for ($i = $length - 2; $i >= 0; $i -= 2) { - $checkSum += array_sum(str_split($value{$i} * 2)); - } - - if (0 === $checkSum || 0 !== $checkSum % 10) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Luhn::CHECKSUM_FAILED_ERROR) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotBlank.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotBlank.php deleted file mode 100644 index c578c6d..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotBlank.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class NotBlank extends Constraint -{ - public $message = 'This value should not be blank.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotBlankValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotBlankValidator.php deleted file mode 100644 index 9deab15..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotBlankValidator.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Bernhard Schussek - * - * @api - */ -class NotBlankValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof NotBlank) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\NotBlank'); - } - - if (false === $value || (empty($value) && '0' != $value)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotEqualTo.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotEqualTo.php deleted file mode 100644 index abd8092..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotEqualTo.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Daniel Holmes - */ -class NotEqualTo extends AbstractComparison -{ - public $message = 'This value should not be equal to {{ compared_value }}.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotEqualToValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotEqualToValidator.php deleted file mode 100644 index 5710a85..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotEqualToValidator.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * Validates values are all unequal (!=). - * - * @author Daniel Holmes - */ -class NotEqualToValidator extends AbstractComparisonValidator -{ - /** - * {@inheritdoc} - */ - protected function compareValues($value1, $value2) - { - return $value1 != $value2; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotIdenticalTo.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotIdenticalTo.php deleted file mode 100644 index fb4ef3f..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotIdenticalTo.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Daniel Holmes - */ -class NotIdenticalTo extends AbstractComparison -{ - public $message = 'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotIdenticalToValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotIdenticalToValidator.php deleted file mode 100644 index ed8dc1c..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotIdenticalToValidator.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * Validates values aren't identical (!==). - * - * @author Daniel Holmes - */ -class NotIdenticalToValidator extends AbstractComparisonValidator -{ - /** - * {@inheritdoc} - */ - protected function compareValues($value1, $value2) - { - return $value1 !== $value2; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotNull.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotNull.php deleted file mode 100644 index 60416c7..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotNull.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class NotNull extends Constraint -{ - public $message = 'This value should not be null.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotNullValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotNullValidator.php deleted file mode 100644 index a7a905a..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NotNullValidator.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Bernhard Schussek - * - * @api - */ -class NotNullValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof NotNull) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\NotNull'); - } - - if (null === $value) { - $this->context->addViolation($constraint->message); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Null.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Null.php deleted file mode 100644 index 3104550..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Null.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class Null extends Constraint -{ - public $message = 'This value should be null.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NullValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NullValidator.php deleted file mode 100644 index 1e6c3a5..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NullValidator.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Bernhard Schussek - * - * @api - */ -class NullValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Null) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Null'); - } - - if (null !== $value) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Optional.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Optional.php deleted file mode 100644 index dab8b43..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Optional.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * @Annotation - * @Target({"ANNOTATION"}) - * - * @author Bernhard Schussek - */ -class Optional extends Existence -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Range.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Range.php deleted file mode 100644 index a12afff..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Range.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Exception\MissingOptionsException; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class Range extends Constraint -{ - const INVALID_VALUE_ERROR = 1; - const BEYOND_RANGE_ERROR = 2; - const BELOW_RANGE_ERROR = 3; - - protected static $errorNames = array( - self::INVALID_VALUE_ERROR => 'INVALID_VALUE_ERROR', - self::BEYOND_RANGE_ERROR => 'BEYOND_RANGE_ERROR', - self::BELOW_RANGE_ERROR => 'BELOW_RANGE_ERROR', - ); - - public $minMessage = 'This value should be {{ limit }} or more.'; - public $maxMessage = 'This value should be {{ limit }} or less.'; - public $invalidMessage = 'This value should be a valid number.'; - public $min; - public $max; - - public function __construct($options = null) - { - parent::__construct($options); - - if (null === $this->min && null === $this->max) { - throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), array('min', 'max')); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/RangeValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/RangeValidator.php deleted file mode 100644 index ebae112..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/RangeValidator.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Bernhard Schussek - */ -class RangeValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Range) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Range'); - } - - if (null === $value) { - return; - } - - if (!is_numeric($value) && !$value instanceof \DateTime && !$value instanceof \DateTimeInterface) { - $this->buildViolation($constraint->invalidMessage) - ->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE)) - ->setCode(Range::INVALID_VALUE_ERROR) - ->addViolation(); - - return; - } - - $min = $constraint->min; - $max = $constraint->max; - - // Convert strings to DateTimes if comparing another DateTime - // This allows to compare with any date/time value supported by - // the DateTime constructor: - // http://php.net/manual/en/datetime.formats.php - if ($value instanceof \DateTime || $value instanceof \DateTimeInterface) { - if (is_string($min)) { - $min = new \DateTime($min); - } - - if (is_string($max)) { - $max = new \DateTime($max); - } - } - - if (null !== $constraint->max && $value > $max) { - $this->buildViolation($constraint->maxMessage) - ->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE)) - ->setParameter('{{ limit }}', $this->formatValue($max, self::PRETTY_DATE)) - ->setCode(Range::BEYOND_RANGE_ERROR) - ->addViolation(); - - return; - } - - if (null !== $constraint->min && $value < $min) { - $this->buildViolation($constraint->minMessage) - ->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE)) - ->setParameter('{{ limit }}', $this->formatValue($min, self::PRETTY_DATE)) - ->setCode(Range::BELOW_RANGE_ERROR) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Regex.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Regex.php deleted file mode 100644 index 3cdf514..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Regex.php +++ /dev/null @@ -1,98 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class Regex extends Constraint -{ - public $message = 'This value is not valid.'; - public $pattern; - public $htmlPattern; - public $match = true; - - /** - * {@inheritdoc} - */ - public function getDefaultOption() - { - return 'pattern'; - } - - /** - * {@inheritdoc} - */ - public function getRequiredOptions() - { - return array('pattern'); - } - - /** - * Converts the htmlPattern to a suitable format for HTML5 pattern. - * Example: /^[a-z]+$/ would be converted to [a-z]+ - * However, if options are specified, it cannot be converted. - * - * Pattern is also ignored if match=false since the pattern should - * then be reversed before application. - * - * @link http://dev.w3.org/html5/spec/single-page.html#the-pattern-attribute - * - * @return string|null - */ - public function getHtmlPattern() - { - // If htmlPattern is specified, use it - if (null !== $this->htmlPattern) { - return empty($this->htmlPattern) - ? null - : $this->htmlPattern; - } - - // Quit if delimiters not at very beginning/end (e.g. when options are passed) - if ($this->pattern[0] !== $this->pattern[strlen($this->pattern) - 1]) { - return; - } - - $delimiter = $this->pattern[0]; - - // Unescape the delimiter - $pattern = str_replace('\\'.$delimiter, $delimiter, substr($this->pattern, 1, -1)); - - // If the pattern is inverted, we can simply wrap it in - // ((?!pattern).)* - if (!$this->match) { - return '((?!'.$pattern.').)*'; - } - - // If the pattern contains an or statement, wrap the pattern in - // .*(pattern).* and quit. Otherwise we'd need to parse the pattern - if (false !== strpos($pattern, '|')) { - return '.*('.$pattern.').*'; - } - - // Trim leading ^, otherwise prepend .* - $pattern = '^' === $pattern[0] ? substr($pattern, 1) : '.*'.$pattern; - - // Trim trailing $, otherwise append .* - $pattern = '$' === $pattern[strlen($pattern) - 1] ? substr($pattern, 0, -1) : $pattern.'.*'; - - return $pattern; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/RegexValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/RegexValidator.php deleted file mode 100644 index 5916e85..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/RegexValidator.php +++ /dev/null @@ -1,53 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * Validates whether a value match or not given regexp pattern. - * - * @author Bernhard Schussek - * @author Joseph Bielawski - * - * @api - */ -class RegexValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Regex) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Regex'); - } - - if (null === $value || '' === $value) { - return; - } - - if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); - } - - $value = (string) $value; - - if ($constraint->match xor preg_match($constraint->pattern, $value)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Required.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Required.php deleted file mode 100644 index bd77a90..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Required.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -/** - * @Annotation - * @Target({"ANNOTATION"}) - * - * @author Bernhard Schussek - */ -class Required extends Existence -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Time.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Time.php deleted file mode 100644 index 7998c6f..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Time.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class Time extends Constraint -{ - const INVALID_FORMAT_ERROR = 1; - const INVALID_TIME_ERROR = 2; - - protected static $errorNames = array( - self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', - self::INVALID_TIME_ERROR => 'INVALID_TIME_ERROR', - ); - - public $message = 'This value is not a valid time.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/TimeValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/TimeValidator.php deleted file mode 100644 index bfecf95..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/TimeValidator.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Bernhard Schussek - * - * @api - */ -class TimeValidator extends ConstraintValidator -{ - const PATTERN = '/^(\d{2}):(\d{2}):(\d{2})$/'; - - /** - * Checks whether a time is valid. - * - * @param int $hour The hour - * @param int $minute The minute - * @param int $second The second - * - * @return bool Whether the time is valid - * - * @internal - */ - public static function checkTime($hour, $minute, $second) - { - return $hour >= 0 && $hour < 24 && $minute >= 0 && $minute < 60 && $second >= 0 && $second < 60; - } - - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Time) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Time'); - } - - if (null === $value || '' === $value || $value instanceof \DateTime) { - return; - } - - if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); - } - - $value = (string) $value; - - if (!preg_match(static::PATTERN, $value, $matches)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Time::INVALID_FORMAT_ERROR) - ->addViolation(); - - return; - } - - if (!self::checkTime($matches[1], $matches[2], $matches[3])) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Time::INVALID_TIME_ERROR) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Traverse.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Traverse.php deleted file mode 100644 index 4abae6c..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Traverse.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; - -/** - * @Annotation - * - * @since 2.5 - * @author Bernhard Schussek - */ -class Traverse extends Constraint -{ - public $traverse = true; - - public function __construct($options = null) - { - if (is_array($options) && array_key_exists('groups', $options)) { - throw new ConstraintDefinitionException(sprintf( - 'The option "groups" is not supported by the constraint %s', - __CLASS__ - )); - } - - parent::__construct($options); - } - - /** - * {@inheritdoc} - */ - public function getDefaultOption() - { - return 'traverse'; - } - - /** - * {@inheritdoc} - */ - public function getTargets() - { - return self::CLASS_CONSTRAINT; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/True.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/True.php deleted file mode 100644 index 788e36a..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/True.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class True extends Constraint -{ - public $message = 'This value should be true.'; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/TrueValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/TrueValidator.php deleted file mode 100644 index a01f5bb..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/TrueValidator.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Bernhard Schussek - * - * @api - */ -class TrueValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof True) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\True'); - } - - if (null === $value) { - return; - } - - if (true !== $value && 1 !== $value && '1' !== $value) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Type.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Type.php deleted file mode 100644 index fc4cc72..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Type.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class Type extends Constraint -{ - public $message = 'This value should be of type {{ type }}.'; - public $type; - - /** - * {@inheritdoc} - */ - public function getDefaultOption() - { - return 'type'; - } - - /** - * {@inheritdoc} - */ - public function getRequiredOptions() - { - return array('type'); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/TypeValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/TypeValidator.php deleted file mode 100644 index 66217d0..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/TypeValidator.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Bernhard Schussek - * - * @api - */ -class TypeValidator extends ConstraintValidator -{ - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Type) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Type'); - } - - if (null === $value) { - return; - } - - $type = strtolower($constraint->type); - $type = $type == 'boolean' ? 'bool' : $constraint->type; - $isFunction = 'is_'.$type; - $ctypeFunction = 'ctype_'.$type; - - if (function_exists($isFunction) && $isFunction($value)) { - return; - } elseif (function_exists($ctypeFunction) && $ctypeFunction($value)) { - return; - } elseif ($value instanceof $constraint->type) { - return; - } - - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setParameter('{{ type }}', $constraint->type) - ->addViolation(); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Url.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Url.php deleted file mode 100644 index e867ee1..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Url.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class Url extends Constraint -{ - public $message = 'This value is not a valid URL.'; - public $protocols = array('http', 'https'); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/UrlValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/UrlValidator.php deleted file mode 100644 index 3d18477..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/UrlValidator.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * @author Bernhard Schussek - * - * @api - */ -class UrlValidator extends ConstraintValidator -{ - const PATTERN = '~^ - (%s):// # protocol - (([\pL\pN-]+:)?([\pL\pN-]+)@)? # basic auth - ( - ([\pL\pN\pS-\.])+(\.?([\pL]|xn\-\-[\pL\pN-]+)+\.?) # a domain name - | # or - \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # a IP address - | # or - \[ - (?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,1}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,2}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,3}(?:(?:[0-9a-f]{1,4})))?::(?:(?:[0-9a-f]{1,4})):)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,4}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::)))) - \] # a IPv6 address - ) - (:[0-9]+)? # a port (optional) - (/?|/\S+) # a /, nothing or a / with something - $~ixu'; - - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (!$constraint instanceof Url) { - throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Url'); - } - - if (null === $value || '' === $value) { - return; - } - - if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); - } - - $value = (string) $value; - $pattern = sprintf(static::PATTERN, implode('|', $constraint->protocols)); - - if (!preg_match($pattern, $value)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Uuid.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Uuid.php deleted file mode 100644 index 3c67a3a..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Uuid.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; - -/** - * @Annotation - * - * @author Colin O'Dell - * @author Bernhard Schussek - */ -class Uuid extends Constraint -{ - const TOO_SHORT_ERROR = 1; - const TOO_LONG_ERROR = 2; - const INVALID_CHARACTERS_ERROR = 3; - const INVALID_HYPHEN_PLACEMENT_ERROR = 4; - const INVALID_VERSION_ERROR = 5; - const INVALID_VARIANT_ERROR = 6; - - protected static $errorNames = array( - self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', - self::TOO_LONG_ERROR => 'TOO_LONG_ERROR', - self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', - self::INVALID_HYPHEN_PLACEMENT_ERROR => 'INVALID_HYPHEN_PLACEMENT_ERROR', - self::INVALID_VERSION_ERROR => 'INVALID_VERSION_ERROR', - self::INVALID_VARIANT_ERROR => 'INVALID_VARIANT_ERROR', - ); - - // Possible versions defined by RFC 4122 - const V1_MAC = 1; - const V2_DCE = 2; - const V3_MD5 = 3; - const V4_RANDOM = 4; - const V5_SHA1 = 5; - - /** - * Message to display when validation fails - * - * @var string - */ - public $message = 'This is not a valid UUID.'; - - /** - * Strict mode only allows UUIDs that meet the formal definition and formatting per RFC 4122 - * - * Set this to `false` to allow legacy formats with different dash positioning or wrapping characters - * - * @var bool - */ - public $strict = true; - - /** - * Array of allowed versions (see version constants above) - * - * All UUID versions are allowed by default - * - * @var int[] - */ - public $versions = array( - self::V1_MAC, - self::V2_DCE, - self::V3_MD5, - self::V4_RANDOM, - self::V5_SHA1, - ); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/UuidValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/UuidValidator.php deleted file mode 100644 index 0ae04e2..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/UuidValidator.php +++ /dev/null @@ -1,264 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * Validates whether the value is a valid UUID per RFC 4122. - * - * @author Colin O'Dell - * @author Bernhard Schussek - * - * @see http://tools.ietf.org/html/rfc4122 - * @see https://en.wikipedia.org/wiki/Universally_unique_identifier - */ -class UuidValidator extends ConstraintValidator -{ - // The strict pattern matches UUIDs like this: - // xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx - - // Roughly speaking: - // x = any hexadecimal character - // M = any allowed version {1..5} - // N = any allowed variant {8, 9, a, b} - - const STRICT_LENGTH = 36; - const STRICT_FIRST_HYPHEN_POSITION = 8; - const STRICT_LAST_HYPHEN_POSITION = 23; - const STRICT_VERSION_POSITION = 14; - const STRICT_VARIANT_POSITION = 19; - - // The loose pattern validates similar yet non-compliant UUIDs. - // Hyphens are completely optional. If present, they should only appear - // between every fourth character: - // xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx - // xxxxxxxxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx - // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - - // The value can also be wrapped with characters like []{}: - // {xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx} - - // Neither the version nor the variant is validated by this pattern. - - const LOOSE_MAX_LENGTH = 39; - const LOOSE_FIRST_HYPHEN_POSITION = 4; - - /** - * @deprecated Deprecated since Symfony 2.6, to be removed in 3.0 - */ - const STRICT_PATTERN = '/^[a-f0-9]{8}-[a-f0-9]{4}-[%s][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i'; - - /** - * @deprecated Deprecated since Symfony 2.6, to be removed in 3.0 - */ - const LOOSE_PATTERN = '/^[a-f0-9]{4}(?:-?[a-f0-9]{4}){7}$/i'; - - /** - * @deprecated Deprecated since Symfony 2.6, to be removed in 3.0 - */ - const STRICT_UUID_LENGTH = self::STRICT_LENGTH; - - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) - { - if (null === $value || '' === $value) { - return; - } - - if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); - } - - $value = (string) $value; - - if ($constraint->strict) { - $this->validateStrict($value, $constraint); - - return; - } - - $this->validateLoose($value, $constraint); - } - - private function validateLoose($value, Uuid $constraint) - { - // Error priority: - // 1. ERROR_INVALID_CHARACTERS - // 2. ERROR_INVALID_HYPHEN_PLACEMENT - // 3. ERROR_TOO_SHORT/ERROR_TOO_LONG - - // Trim any wrapping characters like [] or {} used by some legacy systems - $trimmed = trim($value, '[]{}'); - - // Position of the next expected hyphen - $h = self::LOOSE_FIRST_HYPHEN_POSITION; - - // Expected length - $l = self::LOOSE_MAX_LENGTH; - - for ($i = 0; $i < $l; ++$i) { - // Check length - if (!isset($trimmed{$i})) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Uuid::TOO_SHORT_ERROR) - ->addViolation(); - - return; - } - - // Hyphens must occur every fifth position - // xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx - // ^ ^ ^ ^ ^ ^ ^ - if ('-' === $trimmed{$i}) { - if ($i !== $h) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) - ->addViolation(); - - return; - } - - $h += 5; - - continue; - } - - // Missing hyphens are ignored - if ($i === $h) { - $h += 4; - --$l; - } - - // Check characters - if (!ctype_xdigit($trimmed{$i})) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Uuid::INVALID_CHARACTERS_ERROR) - ->addViolation(); - - return; - } - } - - // Check length again - if (isset($trimmed{$i})) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Uuid::TOO_LONG_ERROR) - ->addViolation(); - } - } - - private function validateStrict($value, Uuid $constraint) - { - // Error priority: - // 1. ERROR_INVALID_CHARACTERS - // 2. ERROR_INVALID_HYPHEN_PLACEMENT - // 3. ERROR_TOO_SHORT/ERROR_TOO_LONG - // 4. ERROR_INVALID_VERSION - // 5. ERROR_INVALID_VARIANT - - // Position of the next expected hyphen - $h = self::STRICT_FIRST_HYPHEN_POSITION; - - for ($i = 0; $i < self::STRICT_LENGTH; ++$i) { - // Check length - if (!isset($value{$i})) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Uuid::TOO_SHORT_ERROR) - ->addViolation(); - - return; - } - - // Check hyphen placement - // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - // ^ ^ ^ ^ - if ('-' === $value{$i}) { - if ($i !== $h) { - $this->buildViolation($constraint->message) - ->setParameter( - '{{ value }}', - $this->formatValue($value) - ) - ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) - ->addViolation(); - - return; - } - - // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - // ^ - if ($h < self::STRICT_LAST_HYPHEN_POSITION) { - $h += 5; - } - - continue; - } - - // Check characters - if (!ctype_xdigit($value{$i})) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Uuid::INVALID_CHARACTERS_ERROR) - ->addViolation(); - - return; - } - - // Missing hyphen - if ($i === $h) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) - ->addViolation(); - - return; - } - } - - // Check length again - if (isset($value{$i})) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Uuid::TOO_LONG_ERROR) - ->addViolation(); - } - - // Check version - if (!in_array($value{self::STRICT_VERSION_POSITION}, $constraint->versions)) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Uuid::INVALID_VERSION_ERROR) - ->addViolation(); - } - - // Check variant - first two bits must equal "10" - // 0b10xx - // & 0b1100 (12) - // = 0b1000 (8) - if ((hexdec($value{self::STRICT_VARIANT_POSITION}) & 12) !== 8) { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Uuid::INVALID_VARIANT_ERROR) - ->addViolation(); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Valid.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Valid.php deleted file mode 100644 index b0f518b..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/Valid.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; - -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Bernhard Schussek - * - * @api - */ -class Valid extends Constraint -{ - public $traverse = true; - - /** - * @deprecated Deprecated as of version 2.5, to be removed in Symfony 3.0. - */ - public $deep = true; - - public function __construct($options = null) - { - if (is_array($options) && array_key_exists('groups', $options)) { - throw new ConstraintDefinitionException(sprintf( - 'The option "groups" is not supported by the constraint %s', - __CLASS__ - )); - } - - parent::__construct($options); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Context/ExecutionContext.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Context/ExecutionContext.php deleted file mode 100644 index f329615..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Context/ExecutionContext.php +++ /dev/null @@ -1,404 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Context; - -use Symfony\Component\Translation\TranslatorInterface; -use Symfony\Component\Validator\ClassBasedInterface; -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintViolation; -use Symfony\Component\Validator\ConstraintViolationList; -use Symfony\Component\Validator\Exception\BadMethodCallException; -use Symfony\Component\Validator\Mapping\MetadataInterface; -use Symfony\Component\Validator\Mapping\PropertyMetadataInterface; -use Symfony\Component\Validator\Util\PropertyPath; -use Symfony\Component\Validator\Validator\ValidatorInterface; -use Symfony\Component\Validator\Violation\ConstraintViolationBuilder; - -/** - * The context used and created by {@link ExecutionContextFactory}. - * - * @since 2.5 - * @author Bernhard Schussek - * - * @see ExecutionContextInterface - * - * @internal You should not instantiate or use this class. Code against - * {@link ExecutionContextInterface} instead. - */ -class ExecutionContext implements ExecutionContextInterface -{ - /** - * @var ValidatorInterface - */ - private $validator; - - /** - * The root value of the validated object graph. - * - * @var mixed - */ - private $root; - - /** - * @var TranslatorInterface - */ - private $translator; - - /** - * @var string - */ - private $translationDomain; - - /** - * The violations generated in the current context. - * - * @var ConstraintViolationList - */ - private $violations; - - /** - * The currently validated value. - * - * @var mixed - */ - private $value; - - /** - * The currently validated object. - * - * @var object|null - */ - private $object; - - /** - * The property path leading to the current value. - * - * @var string - */ - private $propertyPath = ''; - - /** - * The current validation metadata. - * - * @var MetadataInterface|null - */ - private $metadata; - - /** - * The currently validated group. - * - * @var string|null - */ - private $group; - - /** - * The currently validated constraint. - * - * @var Constraint|null - */ - private $constraint; - - /** - * Stores which objects have been validated in which group. - * - * @var array - */ - private $validatedObjects = array(); - - /** - * Stores which class constraint has been validated for which object. - * - * @var array - */ - private $validatedConstraints = array(); - - /** - * Stores which objects have been initialized. - * - * @var array - */ - private $initializedObjects; - - /** - * Creates a new execution context. - * - * @param ValidatorInterface $validator The validator - * @param mixed $root The root value of the - * validated object graph - * @param TranslatorInterface $translator The translator - * @param string|null $translationDomain The translation domain to - * use for translating - * violation messages - * - * @internal Called by {@link ExecutionContextFactory}. Should not be used - * in user code. - */ - public function __construct(ValidatorInterface $validator, $root, TranslatorInterface $translator, $translationDomain = null) - { - $this->validator = $validator; - $this->root = $root; - $this->translator = $translator; - $this->translationDomain = $translationDomain; - $this->violations = new ConstraintViolationList(); - } - - /** - * {@inheritdoc} - */ - public function setNode($value, $object, MetadataInterface $metadata = null, $propertyPath) - { - $this->value = $value; - $this->object = $object; - $this->metadata = $metadata; - $this->propertyPath = (string) $propertyPath; - } - - /** - * {@inheritdoc} - */ - public function setGroup($group) - { - $this->group = $group; - } - - /** - * {@inheritdoc} - */ - public function setConstraint(Constraint $constraint) - { - $this->constraint = $constraint; - } - - /** - * {@inheritdoc} - */ - public function addViolation($message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null) - { - // The parameters $invalidValue and following are ignored by the new - // API, as they are not present in the new interface anymore. - // You should use buildViolation() instead. - if (func_num_args() > 2) { - throw new BadMethodCallException( - 'The parameters $invalidValue, $pluralization and $code are '. - 'not supported anymore as of Symfony 2.5. Please use '. - 'buildViolation() instead or enable the legacy mode.' - ); - } - - $this->violations->add(new ConstraintViolation( - $this->translator->trans($message, $parameters, $this->translationDomain), - $message, - $parameters, - $this->root, - $this->propertyPath, - $this->value, - null, - null, - $this->constraint - )); - } - - /** - * {@inheritdoc} - */ - public function buildViolation($message, array $parameters = array()) - { - return new ConstraintViolationBuilder( - $this->violations, - $this->constraint, - $message, - $parameters, - $this->root, - $this->propertyPath, - $this->value, - $this->translator, - $this->translationDomain - ); - } - - /** - * {@inheritdoc} - */ - public function getViolations() - { - return $this->violations; - } - - /** - * {@inheritdoc} - */ - public function getValidator() - { - return $this->validator; - } - - /** - * {@inheritdoc} - */ - public function getRoot() - { - return $this->root; - } - - /** - * {@inheritdoc} - */ - public function getValue() - { - return $this->value; - } - - /** - * {@inheritdoc} - */ - public function getObject() - { - return $this->object; - } - - /** - * {@inheritdoc} - */ - public function getMetadata() - { - return $this->metadata; - } - - /** - * {@inheritdoc} - */ - public function getGroup() - { - return $this->group; - } - - /** - * {@inheritdoc} - */ - public function getClassName() - { - return $this->metadata instanceof ClassBasedInterface ? $this->metadata->getClassName() : null; - } - - /** - * {@inheritdoc} - */ - public function getPropertyName() - { - return $this->metadata instanceof PropertyMetadataInterface ? $this->metadata->getPropertyName() : null; - } - - /** - * {@inheritdoc} - */ - public function getPropertyPath($subPath = '') - { - return PropertyPath::append($this->propertyPath, $subPath); - } - - /** - * {@inheritdoc} - */ - public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null) - { - throw new BadMethodCallException( - 'addViolationAt() is not supported anymore as of Symfony 2.5. '. - 'Please use buildViolation() instead or enable the legacy mode.' - ); - } - - /** - * {@inheritdoc} - */ - public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false) - { - throw new BadMethodCallException( - 'validate() is not supported anymore as of Symfony 2.5. '. - 'Please use getValidator() instead or enable the legacy mode.' - ); - } - - /** - * {@inheritdoc} - */ - public function validateValue($value, $constraints, $subPath = '', $groups = null) - { - throw new BadMethodCallException( - 'validateValue() is not supported anymore as of Symfony 2.5. '. - 'Please use getValidator() instead or enable the legacy mode.' - ); - } - - /** - * {@inheritdoc} - */ - public function getMetadataFactory() - { - throw new BadMethodCallException( - 'getMetadataFactory() is not supported anymore as of Symfony 2.5. '. - 'Please use getValidator() in combination with getMetadataFor() '. - 'or hasMetadataFor() instead or enable the legacy mode.' - ); - } - - /** - * {@inheritdoc} - */ - public function markGroupAsValidated($cacheKey, $groupHash) - { - if (!isset($this->validatedObjects[$cacheKey])) { - $this->validatedObjects[$cacheKey] = array(); - } - - $this->validatedObjects[$cacheKey][$groupHash] = true; - } - - /** - * {@inheritdoc} - */ - public function isGroupValidated($cacheKey, $groupHash) - { - return isset($this->validatedObjects[$cacheKey][$groupHash]); - } - - /** - * {@inheritdoc} - */ - public function markConstraintAsValidated($cacheKey, $constraintHash) - { - $this->validatedConstraints[$cacheKey.':'.$constraintHash] = true; - } - - /** - * {@inheritdoc} - */ - public function isConstraintValidated($cacheKey, $constraintHash) - { - return isset($this->validatedConstraints[$cacheKey.':'.$constraintHash]); - } - - /** - * {@inheritdoc} - */ - public function markObjectAsInitialized($cacheKey) - { - $this->initializedObjects[$cacheKey] = true; - } - - /** - * {@inheritdoc} - */ - public function isObjectInitialized($cacheKey) - { - return isset($this->initializedObjects[$cacheKey]); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Context/ExecutionContextFactory.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Context/ExecutionContextFactory.php deleted file mode 100644 index d94a806..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Context/ExecutionContextFactory.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Context; - -use Symfony\Component\Translation\TranslatorInterface; -use Symfony\Component\Validator\Validator\ValidatorInterface; - -/** - * Creates new {@link ExecutionContext} instances. - * - * @since 2.5 - * @author Bernhard Schussek - * - * @internal You should not instantiate or use this class. Code against - * {@link ExecutionContextFactoryInterface} instead. - */ -class ExecutionContextFactory implements ExecutionContextFactoryInterface -{ - /** - * @var TranslatorInterface - */ - private $translator; - - /** - * @var string|null - */ - private $translationDomain; - - /** - * Creates a new context factory. - * - * @param TranslatorInterface $translator The translator - * @param string|null $translationDomain The translation domain to - * use for translating - * violation messages - */ - public function __construct(TranslatorInterface $translator, $translationDomain = null) - { - $this->translator = $translator; - $this->translationDomain = $translationDomain; - } - - /** - * {@inheritdoc} - */ - public function createContext(ValidatorInterface $validator, $root) - { - return new ExecutionContext( - $validator, - $root, - $this->translator, - $this->translationDomain - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Context/ExecutionContextFactoryInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Context/ExecutionContextFactoryInterface.php deleted file mode 100644 index f0ee001..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Context/ExecutionContextFactoryInterface.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Context; - -use Symfony\Component\Validator\Validator\ValidatorInterface; - -/** - * Creates instances of {@link ExecutionContextInterface}. - * - * You can use a custom factory if you want to customize the execution context - * that is passed through the validation run. - * - * @since 2.5 - * @author Bernhard Schussek - */ -interface ExecutionContextFactoryInterface -{ - /** - * Creates a new execution context. - * - * @param ValidatorInterface $validator The validator - * @param mixed $root The root value of the validated - * object graph - * - * @return ExecutionContextInterface The new execution context - */ - public function createContext(ValidatorInterface $validator, $root); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Context/ExecutionContextInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Context/ExecutionContextInterface.php deleted file mode 100644 index 4865204..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Context/ExecutionContextInterface.php +++ /dev/null @@ -1,226 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Context; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ExecutionContextInterface as LegacyExecutionContextInterface; -use Symfony\Component\Validator\Mapping\MetadataInterface; -use Symfony\Component\Validator\Validator\ValidatorInterface; -use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface; - -/** - * The context of a validation run. - * - * The context collects all violations generated during the validation. By - * default, validators execute all validations in a new context: - * - * $violations = $validator->validate($object); - * - * When you make another call to the validator, while the validation is in - * progress, the violations will be isolated from each other: - * - * public function validate($value, Constraint $constraint) - * { - * $validator = $this->context->getValidator(); - * - * // The violations are not added to $this->context - * $violations = $validator->validate($value); - * } - * - * However, if you want to add the violations to the current context, use the - * {@link ValidatorInterface::inContext()} method: - * - * public function validate($value, Constraint $constraint) - * { - * $validator = $this->context->getValidator(); - * - * // The violations are added to $this->context - * $validator - * ->inContext($this->context) - * ->validate($value) - * ; - * } - * - * Additionally, the context provides information about the current state of - * the validator, such as the currently validated class, the name of the - * currently validated property and more. These values change over time, so you - * cannot store a context and expect that the methods still return the same - * results later on. - * - * @since 2.5 - * @author Bernhard Schussek - */ -interface ExecutionContextInterface extends LegacyExecutionContextInterface -{ - /** - * Returns a builder for adding a violation with extended information. - * - * Call {@link ConstraintViolationBuilderInterface::addViolation()} to - * add the violation when you're done with the configuration: - * - * $context->buildViolation('Please enter a number between %min% and %max%.') - * ->setParameter('%min%', 3) - * ->setParameter('%max%', 10) - * ->setTranslationDomain('number_validation') - * ->addViolation(); - * - * @param string $message The error message - * @param array $parameters The parameters substituted in the error message - * - * @return ConstraintViolationBuilderInterface The violation builder - */ - public function buildViolation($message, array $parameters = array()); - - /** - * Returns the validator. - * - * Useful if you want to validate additional constraints: - * - * public function validate($value, Constraint $constraint) - * { - * $validator = $this->context->getValidator(); - * - * $violations = $validator->validateValue($value, new Length(array('min' => 3))); - * - * if (count($violations) > 0) { - * // ... - * } - * } - * - * @return ValidatorInterface - */ - public function getValidator(); - - /** - * Returns the currently validated object. - * - * If the validator is currently validating a class constraint, the - * object of that class is returned. If it is a validating a property or - * getter constraint, the object that the property/getter belongs to is - * returned. - * - * In other cases, null is returned. - * - * @return object|null The currently validated object or null. - */ - public function getObject(); - - /** - * Sets the currently validated value. - * - * @param mixed $value The validated value - * @param object|null $object The currently validated object - * @param MetadataInterface|null $metadata The validation metadata - * @param string $propertyPath The property path to the current value - * - * @internal Used by the validator engine. Should not be called by user - * code. - */ - public function setNode($value, $object, MetadataInterface $metadata = null, $propertyPath); - - /** - * Sets the currently validated group. - * - * @param string|null $group The validated group - * - * @internal Used by the validator engine. Should not be called by user - * code. - */ - public function setGroup($group); - - /** - * Sets the currently validated constraint. - * - * @param Constraint $constraint The validated constraint - * - * @internal Used by the validator engine. Should not be called by user - * code. - */ - public function setConstraint(Constraint $constraint); - - /** - * Marks an object as validated in a specific validation group. - * - * @param string $cacheKey The hash of the object - * @param string $groupHash The group's name or hash, if it is group - * sequence - * - * @internal Used by the validator engine. Should not be called by user - * code. - */ - public function markGroupAsValidated($cacheKey, $groupHash); - - /** - * Returns whether an object was validated in a specific validation group. - * - * @param string $cacheKey The hash of the object - * @param string $groupHash The group's name or hash, if it is group - * sequence - * - * @return bool Whether the object was already validated for that - * group - * - * @internal Used by the validator engine. Should not be called by user - * code. - */ - public function isGroupValidated($cacheKey, $groupHash); - - /** - * Marks a constraint as validated for an object. - * - * @param string $cacheKey The hash of the object - * @param string $constraintHash The hash of the constraint - * - * @internal Used by the validator engine. Should not be called by user - * code. - */ - public function markConstraintAsValidated($cacheKey, $constraintHash); - - /** - * Returns whether a constraint was validated for an object. - * - * @param string $cacheKey The hash of the object - * @param string $constraintHash The hash of the constraint - * - * @return bool Whether the constraint was already validated - * - * @internal Used by the validator engine. Should not be called by user - * code. - */ - public function isConstraintValidated($cacheKey, $constraintHash); - - /** - * Marks that an object was initialized. - * - * @param string $cacheKey The hash of the object - * - * @internal Used by the validator engine. Should not be called by user - * code. - * - * @see ObjectInitializerInterface - */ - public function markObjectAsInitialized($cacheKey); - - /** - * Returns whether an object was initialized. - * - * @param string $cacheKey The hash of the object - * - * @return bool Whether the object was already initialized - * - * @internal Used by the validator engine. Should not be called by user - * code. - * - * @see ObjectInitializerInterface - */ - public function isObjectInitialized($cacheKey); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Context/LegacyExecutionContext.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Context/LegacyExecutionContext.php deleted file mode 100644 index de34b1f..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Context/LegacyExecutionContext.php +++ /dev/null @@ -1,156 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Context; - -use Symfony\Component\Translation\TranslatorInterface; -use Symfony\Component\Validator\Constraints\Valid; -use Symfony\Component\Validator\MetadataFactoryInterface; -use Symfony\Component\Validator\Validator\ValidatorInterface; - -/** - * An execution context that is compatible with the legacy API (< 2.5). - * - * @since 2.5 - * @author Bernhard Schussek - * - * @deprecated Implemented for backwards compatibility with Symfony < 2.5. - * To be removed in Symfony 3.0. - */ -class LegacyExecutionContext extends ExecutionContext -{ - /** - * @var MetadataFactoryInterface - */ - private $metadataFactory; - - /** - * Creates a new context. - * - * @see ExecutionContext::__construct() - * - * @internal Called by {@link LegacyExecutionContextFactory}. Should not be used - * in user code. - */ - public function __construct(ValidatorInterface $validator, $root, MetadataFactoryInterface $metadataFactory, TranslatorInterface $translator, $translationDomain = null) - { - parent::__construct( - $validator, - $root, - $translator, - $translationDomain - ); - - $this->metadataFactory = $metadataFactory; - } - - /** - * {@inheritdoc} - */ - public function addViolation($message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null) - { - if (func_num_args() > 2) { - $this - ->buildViolation($message, $parameters) - ->setInvalidValue($invalidValue) - ->setPlural($plural) - ->setCode($code) - ->addViolation() - ; - - return; - } - - parent::addViolation($message, $parameters); - } - - /** - * {@inheritdoc} - */ - public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null) - { - if (func_num_args() > 2) { - $this - ->buildViolation($message, $parameters) - ->atPath($subPath) - ->setInvalidValue($invalidValue) - ->setPlural($plural) - ->setCode($code) - ->addViolation() - ; - - return; - } - - $this - ->buildViolation($message, $parameters) - ->atPath($subPath) - ->addViolation() - ; - } - - /** - * {@inheritdoc} - */ - public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false) - { - if (is_array($value)) { - // The $traverse flag is ignored for arrays - $constraint = new Valid(array('traverse' => true, 'deep' => $deep)); - - return $this - ->getValidator() - ->inContext($this) - ->atPath($subPath) - ->validate($value, $constraint, $groups) - ; - } - - if ($traverse && $value instanceof \Traversable) { - $constraint = new Valid(array('traverse' => true, 'deep' => $deep)); - - return $this - ->getValidator() - ->inContext($this) - ->atPath($subPath) - ->validate($value, $constraint, $groups) - ; - } - - return $this - ->getValidator() - ->inContext($this) - ->atPath($subPath) - ->validate($value, null, $groups) - ; - } - - /** - * {@inheritdoc} - */ - public function validateValue($value, $constraints, $subPath = '', $groups = null) - { - return $this - ->getValidator() - ->inContext($this) - ->atPath($subPath) - ->validate($value, $constraints, $groups) - ; - } - - /** - * {@inheritdoc} - */ - public function getMetadataFactory() - { - return $this->metadataFactory; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Context/LegacyExecutionContextFactory.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Context/LegacyExecutionContextFactory.php deleted file mode 100644 index cf5cd07..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Context/LegacyExecutionContextFactory.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Context; - -use Symfony\Component\Translation\TranslatorInterface; -use Symfony\Component\Validator\MetadataFactoryInterface; -use Symfony\Component\Validator\Validator\ValidatorInterface; - -/** - * Creates new {@link LegacyExecutionContext} instances. - * - * @since 2.5 - * @author Bernhard Schussek - * - * @deprecated Implemented for backwards compatibility with Symfony < 2.5. - * To be removed in Symfony 3.0. - */ -class LegacyExecutionContextFactory implements ExecutionContextFactoryInterface -{ - /** - * @var MetadataFactoryInterface - */ - private $metadataFactory; - - /** - * @var TranslatorInterface - */ - private $translator; - - /** - * @var string|null - */ - private $translationDomain; - - /** - * Creates a new context factory. - * - * @param MetadataFactoryInterface $metadataFactory The metadata factory - * @param TranslatorInterface $translator The translator - * @param string|null $translationDomain The translation domain - * to use for translating - * violation messages - */ - public function __construct(MetadataFactoryInterface $metadataFactory, TranslatorInterface $translator, $translationDomain = null) - { - $this->metadataFactory = $metadataFactory; - $this->translator = $translator; - $this->translationDomain = $translationDomain; - } - - /** - * {@inheritdoc} - */ - public function createContext(ValidatorInterface $validator, $root) - { - return new LegacyExecutionContext( - $validator, - $root, - $this->metadataFactory, - $this->translator, - $this->translationDomain - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/DefaultTranslator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/DefaultTranslator.php deleted file mode 100644 index 06967de..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/DefaultTranslator.php +++ /dev/null @@ -1,167 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -use Symfony\Component\Translation\TranslatorInterface; -use Symfony\Component\Validator\Exception\BadMethodCallException; -use Symfony\Component\Validator\Exception\InvalidArgumentException; - -/** - * Simple translator implementation that simply replaces the parameters in - * the message IDs. - * - * Example usage: - * - * $translator = new DefaultTranslator(); - * - * echo $translator->trans( - * 'This is a {{ var }}.', - * array('{{ var }}' => 'donkey') - * ); - * - * // -> This is a donkey. - * - * echo $translator->transChoice( - * 'This is {{ count }} donkey.|These are {{ count }} donkeys.', - * 3, - * array('{{ count }}' => 'three') - * ); - * - * // -> These are three donkeys. - * - * This translator does not support message catalogs, translation domains or - * locales. Instead, it implements a subset of the capabilities of - * {@link \Symfony\Component\Translation\Translator} and can be used in places - * where translation is not required by default but should be optional. - * - * @author Bernhard Schussek - */ -class DefaultTranslator implements TranslatorInterface -{ - /** - * Interpolates the given message. - * - * Parameters are replaced in the message in the same manner that - * {@link strtr()} uses. - * - * Example usage: - * - * $translator = new DefaultTranslator(); - * - * echo $translator->trans( - * 'This is a {{ var }}.', - * array('{{ var }}' => 'donkey') - * ); - * - * // -> This is a donkey. - * - * @param string $id The message id - * @param array $parameters An array of parameters for the message - * @param string $domain Ignored - * @param string $locale Ignored - * - * @return string The interpolated string - */ - public function trans($id, array $parameters = array(), $domain = null, $locale = null) - { - return strtr($id, $parameters); - } - - /** - * Interpolates the given choice message by choosing a variant according to a number. - * - * The variants are passed in the message ID using the format - * "|". "" is chosen if the passed $number is - * exactly 1. "" is chosen otherwise. - * - * This format is consistent with the format supported by - * {@link \Symfony\Component\Translation\Translator}, but it does not - * have the same expressiveness. While Translator supports intervals in - * message translations, which are needed for languages other than English, - * this translator does not. You should use Translator or a custom - * implementation of {@link TranslatorInterface} if you need this or similar - * functionality. - * - * Example usage: - * - * echo $translator->transChoice( - * 'This is {{ count }} donkey.|These are {{ count }} donkeys.', - * 0, - * array('{{ count }}' => 0) - * ); - * - * // -> These are 0 donkeys. - * - * echo $translator->transChoice( - * 'This is {{ count }} donkey.|These are {{ count }} donkeys.', - * 1, - * array('{{ count }}' => 1) - * ); - * - * // -> This is 1 donkey. - * - * echo $translator->transChoice( - * 'This is {{ count }} donkey.|These are {{ count }} donkeys.', - * 3, - * array('{{ count }}' => 3) - * ); - * - * // -> These are 3 donkeys. - * - * @param string $id The message id - * @param int $number The number to use to find the index of the message - * @param array $parameters An array of parameters for the message - * @param string $domain Ignored - * @param string $locale Ignored - * - * @return string The translated string - * - * @throws InvalidArgumentException If the message id does not have the format - * "singular|plural". - */ - public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null) - { - $ids = explode('|', $id); - - if (1 == $number) { - return strtr($ids[0], $parameters); - } - - if (!isset($ids[1])) { - throw new InvalidArgumentException(sprintf('The message "%s" cannot be pluralized, because it is missing a plural (e.g. "There is one apple|There are %%count%% apples").', $id)); - } - - return strtr($ids[1], $parameters); - } - - /** - * Not supported. - * - * @param string $locale The locale - * - * @throws BadMethodCallException - */ - public function setLocale($locale) - { - throw new BadMethodCallException('Unsupported method.'); - } - - /** - * Returns the locale of the translator. - * - * @return string Always returns 'en' - */ - public function getLocale() - { - return 'en'; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/BadMethodCallException.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/BadMethodCallException.php deleted file mode 100644 index 939161b..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/BadMethodCallException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Exception; - -/** - * Base BadMethodCallException for the Validator component. - * - * @author Bernhard Schussek - */ -class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/ConstraintDefinitionException.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/ConstraintDefinitionException.php deleted file mode 100644 index b24fdd6..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/ConstraintDefinitionException.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Exception; - -class ConstraintDefinitionException extends ValidatorException -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/ExceptionInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/ExceptionInterface.php deleted file mode 100644 index 77d09b9..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/ExceptionInterface.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Exception; - -/** - * Base ExceptionInterface for the Validator component. - * - * @author Bernhard Schussek - */ -interface ExceptionInterface -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/GroupDefinitionException.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/GroupDefinitionException.php deleted file mode 100644 index ab7e91d..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/GroupDefinitionException.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Exception; - -class GroupDefinitionException extends ValidatorException -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/InvalidArgumentException.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/InvalidArgumentException.php deleted file mode 100644 index 22da39b..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/InvalidArgumentException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Exception; - -/** - * Base InvalidArgumentException for the Validator component. - * - * @author Bernhard Schussek - */ -class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/InvalidOptionsException.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/InvalidOptionsException.php deleted file mode 100644 index ce87c42..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/InvalidOptionsException.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Exception; - -class InvalidOptionsException extends ValidatorException -{ - private $options; - - public function __construct($message, array $options) - { - parent::__construct($message); - - $this->options = $options; - } - - public function getOptions() - { - return $this->options; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/MappingException.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/MappingException.php deleted file mode 100644 index 4c8c057..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/MappingException.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Exception; - -class MappingException extends ValidatorException -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/MissingOptionsException.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/MissingOptionsException.php deleted file mode 100644 index 07c5d9e..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/MissingOptionsException.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Exception; - -class MissingOptionsException extends ValidatorException -{ - private $options; - - public function __construct($message, array $options) - { - parent::__construct($message); - - $this->options = $options; - } - - public function getOptions() - { - return $this->options; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/NoSuchMetadataException.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/NoSuchMetadataException.php deleted file mode 100644 index 4cac74c..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/NoSuchMetadataException.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Exception; - -/** - * @author Bernhard Schussek - */ -class NoSuchMetadataException extends ValidatorException -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/OutOfBoundsException.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/OutOfBoundsException.php deleted file mode 100644 index 30906e8..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/OutOfBoundsException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Exception; - -/** - * Base OutOfBoundsException for the Validator component. - * - * @author Bernhard Schussek - */ -class OutOfBoundsException extends \OutOfBoundsException implements ExceptionInterface -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/RuntimeException.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/RuntimeException.php deleted file mode 100644 index df4a50c..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/RuntimeException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Exception; - -/** - * Base RuntimeException for the Validator component. - * - * @author Bernhard Schussek - */ -class RuntimeException extends \RuntimeException implements ExceptionInterface -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/UnexpectedTypeException.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/UnexpectedTypeException.php deleted file mode 100644 index 49d8cc2..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/UnexpectedTypeException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Exception; - -class UnexpectedTypeException extends ValidatorException -{ - public function __construct($value, $expectedType) - { - parent::__construct(sprintf('Expected argument of type "%s", "%s" given', $expectedType, is_object($value) ? get_class($value) : gettype($value))); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/UnsupportedMetadataException.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/UnsupportedMetadataException.php deleted file mode 100644 index c6ece50..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/UnsupportedMetadataException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Exception; - -/** - * @since 2.5 - * @author Bernhard Schussek - */ -class UnsupportedMetadataException extends InvalidArgumentException -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/ValidatorException.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/ValidatorException.php deleted file mode 100644 index 28bd470..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Exception/ValidatorException.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Exception; - -class ValidatorException extends RuntimeException -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/ExecutionContext.php b/core/vendor/symfony/validator/Symfony/Component/Validator/ExecutionContext.php deleted file mode 100644 index 31911b8..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/ExecutionContext.php +++ /dev/null @@ -1,293 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -use Symfony\Component\Translation\TranslatorInterface; - -/** - * Default implementation of {@link ExecutionContextInterface}. - * - * This class is immutable by design. - * - * @author Fabien Potencier - * @author Bernhard Schussek - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link Context\ExecutionContext} instead. - */ -class ExecutionContext implements ExecutionContextInterface -{ - /** - * @var GlobalExecutionContextInterface - */ - private $globalContext; - - /** - * @var TranslatorInterface - */ - private $translator; - - /** - * @var null|string - */ - private $translationDomain; - - /** - * @var MetadataInterface - */ - private $metadata; - - /** - * @var mixed - */ - private $value; - - /** - * @var string - */ - private $group; - - /** - * @var string - */ - private $propertyPath; - - /** - * Creates a new execution context. - * - * @param GlobalExecutionContextInterface $globalContext The global context storing node-independent state. - * @param TranslatorInterface $translator The translator for translating violation messages. - * @param null|string $translationDomain The domain of the validation messages. - * @param MetadataInterface $metadata The metadata of the validated node. - * @param mixed $value The value of the validated node. - * @param string $group The current validation group. - * @param string $propertyPath The property path to the current node. - */ - public function __construct(GlobalExecutionContextInterface $globalContext, TranslatorInterface $translator, $translationDomain = null, MetadataInterface $metadata = null, $value = null, $group = null, $propertyPath = '') - { - if (null === $group) { - $group = Constraint::DEFAULT_GROUP; - } - - $this->globalContext = $globalContext; - $this->translator = $translator; - $this->translationDomain = $translationDomain; - $this->metadata = $metadata; - $this->value = $value; - $this->propertyPath = $propertyPath; - $this->group = $group; - } - - /** - * {@inheritdoc} - */ - public function addViolation($message, array $params = array(), $invalidValue = null, $plural = null, $code = null) - { - if (null === $plural) { - $translatedMessage = $this->translator->trans($message, $params, $this->translationDomain); - } else { - try { - $translatedMessage = $this->translator->transChoice($message, $plural, $params, $this->translationDomain); - } catch (\InvalidArgumentException $e) { - $translatedMessage = $this->translator->trans($message, $params, $this->translationDomain); - } - } - - $this->globalContext->getViolations()->add(new ConstraintViolation( - $translatedMessage, - $message, - $params, - $this->globalContext->getRoot(), - $this->propertyPath, - // check using func_num_args() to allow passing null values - func_num_args() >= 3 ? $invalidValue : $this->value, - $plural, - $code - )); - } - - /** - * {@inheritdoc} - */ - public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null) - { - $this->globalContext->getViolations()->add(new ConstraintViolation( - null === $plural - ? $this->translator->trans($message, $parameters, $this->translationDomain) - : $this->translator->transChoice($message, $plural, $parameters, $this->translationDomain), - $message, - $parameters, - $this->globalContext->getRoot(), - $this->getPropertyPath($subPath), - // check using func_num_args() to allow passing null values - func_num_args() >= 4 ? $invalidValue : $this->value, - $plural, - $code - )); - } - - /** - * {@inheritdoc} - */ - public function getViolations() - { - return $this->globalContext->getViolations(); - } - - /** - * {@inheritdoc} - */ - public function getRoot() - { - return $this->globalContext->getRoot(); - } - - /** - * {@inheritdoc} - */ - public function getPropertyPath($subPath = '') - { - if ('' != $subPath && '' !== $this->propertyPath && '[' !== $subPath[0]) { - return $this->propertyPath.'.'.$subPath; - } - - return $this->propertyPath.$subPath; - } - - /** - * {@inheritdoc} - */ - public function getClassName() - { - if ($this->metadata instanceof ClassBasedInterface) { - return $this->metadata->getClassName(); - } - } - - /** - * {@inheritdoc} - */ - public function getPropertyName() - { - if ($this->metadata instanceof PropertyMetadataInterface) { - return $this->metadata->getPropertyName(); - } - } - - /** - * {@inheritdoc} - */ - public function getValue() - { - return $this->value; - } - - /** - * {@inheritdoc} - */ - public function getGroup() - { - return $this->group; - } - - /** - * {@inheritdoc} - */ - public function getMetadata() - { - return $this->metadata; - } - - /** - * {@inheritdoc} - */ - public function getMetadataFor($value) - { - return $this->globalContext->getMetadataFactory()->getMetadataFor($value); - } - - /** - * {@inheritdoc} - */ - public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false) - { - $propertyPath = $this->getPropertyPath($subPath); - - foreach ($this->resolveGroups($groups) as $group) { - $this->globalContext->getVisitor()->validate($value, $group, $propertyPath, $traverse, $deep); - } - } - - /** - * {@inheritdoc} - */ - public function validateValue($value, $constraints, $subPath = '', $groups = null) - { - $constraints = is_array($constraints) ? $constraints : array($constraints); - - if (null === $groups && '' === $subPath) { - $context = clone $this; - $context->value = $value; - $context->executeConstraintValidators($value, $constraints); - - return; - } - - $propertyPath = $this->getPropertyPath($subPath); - - foreach ($this->resolveGroups($groups) as $group) { - $context = clone $this; - $context->value = $value; - $context->group = $group; - $context->propertyPath = $propertyPath; - $context->executeConstraintValidators($value, $constraints); - } - } - - /** - * {@inheritdoc} - */ - public function getMetadataFactory() - { - return $this->globalContext->getMetadataFactory(); - } - - /** - * Executes the validators of the given constraints for the given value. - * - * @param mixed $value The value to validate. - * @param Constraint[] $constraints The constraints to match against. - */ - private function executeConstraintValidators($value, array $constraints) - { - foreach ($constraints as $constraint) { - $validator = $this->globalContext->getValidatorFactory()->getInstance($constraint); - $validator->initialize($this); - $validator->validate($value, $constraint); - } - } - - /** - * Returns an array of group names. - * - * @param null|string|string[] $groups The groups to resolve. If a single string is - * passed, it is converted to an array. If null - * is passed, an array containing the current - * group of the context is returned. - * - * @return array An array of validation groups. - */ - private function resolveGroups($groups) - { - return $groups ? (array) $groups : (array) $this->group; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/ExecutionContextInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/ExecutionContextInterface.php deleted file mode 100644 index ebef4bd..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/ExecutionContextInterface.php +++ /dev/null @@ -1,329 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -/** - * Stores the validator's state during validation. - * - * For example, let's validate the following object graph: - * - *
- * (Person)---($firstName: string)
- *      \
- *   ($address: Address)---($street: string)
- * 
- * - * We validate the Person instance, which becomes the "root" of the - * validation run (see {@link getRoot}). The state of the context after the - * first step will be like this: - * - *
- * (Person)---($firstName: string)
- *    ^ \
- *   ($address: Address)---($street: string)
- * 
- * - * The validator is stopped at the Person node, both the root and the - * value (see {@link getValue}) of the context point to the Person - * instance. The property path is empty at this point (see {@link getPropertyPath}). - * The metadata of the context is the metadata of the Person node - * (see {@link getMetadata}). - * - * After advancing to the property $firstName of the Person - * instance, the state of the context looks like this: - * - *
- * (Person)---($firstName: string)
- *      \              ^
- *   ($address: Address)---($street: string)
- * 
- * - * The validator is stopped at the property $firstName. The root still - * points to the Person instance, because this is where the validation - * started. The property path is now "firstName" and the current value is the - * value of that property. - * - * After advancing to the $address property and then to the - * $street property of the Address instance, the context state - * looks like this: - * - *
- * (Person)---($firstName: string)
- *      \
- *   ($address: Address)---($street: string)
- *                               ^
- * 
- * - * The validator is stopped at the property $street. The root still - * points to the Person instance, but the property path is now - * "address.street" and the validated value is the value of that property. - * - * Apart from the root, the property path and the currently validated value, - * the execution context also knows the metadata of the current node (see - * {@link getMetadata}) which for example returns a {@link Mapping\PropertyMetadata} - * or a {@link Mapping\ClassMetadata} object. he context also contains the - * validation group that is currently being validated (see {@link getGroup}) and - * the violations that happened up until now (see {@link getViolations}). - * - * Apart from reading the execution context, you can also use - * {@link addViolation} or {@link addViolationAt} to add new violations and - * {@link validate} or {@link validateValue} to validate values that the - * validator otherwise would not reach. - * - * @author Bernhard Schussek - * - * @api - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link Context\ExecutionContextInterface} instead. - */ -interface ExecutionContextInterface -{ - /** - * Adds a violation at the current node of the validation graph. - * - * @param string $message The error message - * @param array $params The parameters substituted in the error message - * @param mixed $invalidValue The invalid, validated value - * @param int|null $plural The number to use to pluralize of the message - * @param int|null $code The violation code - * - * @api - * - * @deprecated The parameters $invalidValue, $pluralization and $code are - * deprecated since version 2.5 and will be removed in - * Symfony 3.0. - */ - public function addViolation($message, array $params = array(), $invalidValue = null, $plural = null, $code = null); - - /** - * Adds a violation at the validation graph node with the given property - * path relative to the current property path. - * - * @param string $subPath The relative property path for the violation - * @param string $message The error message - * @param array $parameters The parameters substituted in the error message - * @param mixed $invalidValue The invalid, validated value - * @param int|null $plural The number to use to pluralize of the message - * @param int|null $code The violation code - * - * @api - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link Context\ExecutionContextInterface::buildViolation()} - * instead. - */ - public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null); - - /** - * Validates the given value within the scope of the current validation. - * - * The value may be any value recognized by the used metadata factory - * (see {@link MetadataFactoryInterface::getMetadata}), or an array or a - * traversable object of such values. - * - * Usually you validate a value that is not the current node of the - * execution context. For this case, you can pass the {@link $subPath} - * argument which is appended to the current property path when a violation - * is created. For example, take the following object graph: - * - *
-     * (Person)---($address: Address)---($phoneNumber: PhoneNumber)
-     *                     ^
-     * 
- * - * When the execution context stops at the Person instance, the - * property path is "address". When you validate the PhoneNumber - * instance now, pass "phoneNumber" as sub path to correct the property path - * to "address.phoneNumber": - * - *
-     * $context->validate($address->phoneNumber, 'phoneNumber');
-     * 
- * - * Any violations generated during the validation will be added to the - * violation list that you can access with {@link getViolations}. - * - * @param mixed $value The value to validate. - * @param string $subPath The path to append to the context's property path. - * @param null|string|string[] $groups The groups to validate in. If you don't pass any - * groups here, the current group of the context - * will be used. - * @param bool $traverse Whether to traverse the value if it is an array - * or an instance of \Traversable. - * @param bool $deep Whether to traverse the value recursively if - * it is a collection of collections. - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link Context\ExecutionContextInterface::getValidator()} - * instead. - */ - public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false); - - /** - * Validates a value against a constraint. - * - * Use the parameter $subPath to adapt the property path for the - * validated value. For example, take the following object graph: - * - *
-     * (Person)---($address: Address)---($street: string)
-     *                     ^
-     * 
- * - * When the validator validates the Address instance, the - * property path stored in the execution context is "address". When you - * manually validate the property $street now, pass the sub path - * "street" to adapt the full property path to "address.street": - * - *
-     * $context->validate($address->street, new NotNull(), 'street');
-     * 
- * - * @param mixed $value The value to validate. - * @param Constraint|Constraint[] $constraints The constraint(s) to validate against. - * @param string $subPath The path to append to the context's property path. - * @param null|string|string[] $groups The groups to validate in. If you don't pass any - * groups here, the current group of the context - * will be used. - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link Context\ExecutionContextInterface::getValidator()} - * instead. - */ - public function validateValue($value, $constraints, $subPath = '', $groups = null); - - /** - * Returns the violations generated by the validator so far. - * - * @return ConstraintViolationListInterface The constraint violation list. - * - * @api - */ - public function getViolations(); - - /** - * Returns the value at which validation was started in the object graph. - * - * The validator, when given an object, traverses the properties and - * related objects and their properties. The root of the validation is the - * object from which the traversal started. - * - * The current value is returned by {@link getValue}. - * - * @return mixed The root value of the validation. - */ - public function getRoot(); - - /** - * Returns the value that the validator is currently validating. - * - * If you want to retrieve the object that was originally passed to the - * validator, use {@link getRoot}. - * - * @return mixed The currently validated value. - */ - public function getValue(); - - /** - * Returns the metadata for the currently validated value. - * - * With the core implementation, this method returns a - * {@link Mapping\ClassMetadata} instance if the current value is an object, - * a {@link Mapping\PropertyMetadata} instance if the current value is - * the value of a property and a {@link Mapping\GetterMetadata} instance if - * the validated value is the result of a getter method. - * - * If the validated value is neither of these, for example if the validator - * has been called with a plain value and constraint, this method returns - * null. - * - * @return MetadataInterface|null The metadata of the currently validated - * value. - */ - public function getMetadata(); - - /** - * Returns the used metadata factory. - * - * @return MetadataFactoryInterface The metadata factory. - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link Context\ExecutionContextInterface::getValidator()} - * instead and call - * {@link Validator\ValidatorInterface::getMetadataFor()} or - * {@link Validator\ValidatorInterface::hasMetadataFor()} there. - */ - public function getMetadataFactory(); - - /** - * Returns the validation group that is currently being validated. - * - * @return string The current validation group. - */ - public function getGroup(); - - /** - * Returns the class name of the current node. - * - * If the metadata of the current node does not implement - * {@link ClassBasedInterface} or if no metadata is available for the - * current node, this method returns null. - * - * @return string|null The class name or null, if no class name could be found. - */ - public function getClassName(); - - /** - * Returns the property name of the current node. - * - * If the metadata of the current node does not implement - * {@link PropertyMetadataInterface} or if no metadata is available for the - * current node, this method returns null. - * - * @return string|null The property name or null, if no property name could be found. - */ - public function getPropertyName(); - - /** - * Returns the property path to the value that the validator is currently - * validating. - * - * For example, take the following object graph: - * - *
-     * (Person)---($address: Address)---($street: string)
-     * 
- * - * When the Person instance is passed to the validator, the - * property path is initially empty. When the $address property - * of that person is validated, the property path is "address". When - * the $street property of the related Address instance - * is validated, the property path is "address.street". - * - * Properties of objects are prefixed with a dot in the property path. - * Indices of arrays or objects implementing the {@link \ArrayAccess} - * interface are enclosed in brackets. For example, if the property in - * the previous example is $addresses and contains an array - * of Address instance, the property path generated for the - * $street property of one of these addresses is for example - * "addresses[0].street". - * - * @param string $subPath Optional. The suffix appended to the current - * property path. - * - * @return string The current property path. The result may be an empty - * string if the validator is currently validating the - * root value of the validation graph. - */ - public function getPropertyPath($subPath = ''); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/GlobalExecutionContextInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/GlobalExecutionContextInterface.php deleted file mode 100644 index 06dbf3e..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/GlobalExecutionContextInterface.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -/** - * Stores the node-independent state of a validation run. - * - * When the validator validates a graph of objects, it uses two classes to - * store the state during the validation: - * - *
    - *
  • For each node in the validation graph (objects, properties, getters) the - * validator creates an instance of {@link ExecutionContextInterface} that - * stores the information about that node.
  • - *
  • One single GlobalExecutionContextInterface stores the state - * that is independent of the current node.
  • - *
- * - * @author Bernhard Schussek - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link Context\ExecutionContextInterface} instead. - */ -interface GlobalExecutionContextInterface -{ - /** - * Returns the violations generated by the validator so far. - * - * @return ConstraintViolationListInterface A list of constraint violations. - */ - public function getViolations(); - - /** - * Returns the value at which validation was started in the object graph. - * - * @return mixed The root value. - * - * @see ExecutionContextInterface::getRoot() - */ - public function getRoot(); - - /** - * Returns the visitor instance used to validate the object graph nodes. - * - * @return ValidationVisitorInterface The validation visitor. - */ - public function getVisitor(); - - /** - * Returns the factory for constraint validators. - * - * @return ConstraintValidatorFactoryInterface The constraint validator factory. - */ - public function getValidatorFactory(); - - /** - * Returns the factory for validation metadata objects. - * - * @return MetadataFactoryInterface The metadata factory. - */ - public function getMetadataFactory(); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/GroupSequenceProviderInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/GroupSequenceProviderInterface.php deleted file mode 100644 index 62e8a5e..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/GroupSequenceProviderInterface.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -/** - * Defines the interface for a group sequence provider. - */ -interface GroupSequenceProviderInterface -{ - /** - * Returns which validation groups should be used for a certain state - * of the object. - * - * @return array An array of validation groups - */ - public function getGroupSequence(); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/LICENSE b/core/vendor/symfony/validator/Symfony/Component/Validator/LICENSE deleted file mode 100644 index 43028bc..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2015 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/BlackholeMetadataFactory.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/BlackholeMetadataFactory.php deleted file mode 100644 index 7913e15..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/BlackholeMetadataFactory.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping; - -/** - * Alias of {@link Factory\BlackHoleMetadataFactory}. - * - * @author Fabien Potencier - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link Factory\BlackHoleMetadataFactory} instead. - */ -class BlackholeMetadataFactory extends \Symfony\Component\Validator\Mapping\Factory\BlackHoleMetadataFactory -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Cache/ApcCache.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Cache/ApcCache.php deleted file mode 100644 index 64929b0..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Cache/ApcCache.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping\Cache; - -use Symfony\Component\Validator\Mapping\ClassMetadata; - -/** - * @deprecated Deprecated since version 2.5, to be removed in 3.0. - * Use DoctrineCache with Doctrine\Common\Cache\ApcCache instead. - */ -class ApcCache implements CacheInterface -{ - private $prefix; - - public function __construct($prefix) - { - if (!extension_loaded('apc')) { - throw new \RuntimeException('Unable to use ApcCache to cache validator mappings as APC is not enabled.'); - } - - $this->prefix = $prefix; - } - - public function has($class) - { - if (!function_exists('apc_exists')) { - $exists = false; - - apc_fetch($this->prefix.$class, $exists); - - return $exists; - } - - return apc_exists($this->prefix.$class); - } - - public function read($class) - { - return apc_fetch($this->prefix.$class); - } - - public function write(ClassMetadata $metadata) - { - apc_store($this->prefix.$metadata->getClassName(), $metadata); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Cache/CacheInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Cache/CacheInterface.php deleted file mode 100644 index e8047c6..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Cache/CacheInterface.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping\Cache; - -use Symfony\Component\Validator\Mapping\ClassMetadata; - -/** - * Persists ClassMetadata instances in a cache. - * - * @author Bernhard Schussek - */ -interface CacheInterface -{ - /** - * Returns whether metadata for the given class exists in the cache. - * - * @param string $class - */ - public function has($class); - - /** - * Returns the metadata for the given class from the cache. - * - * @param string $class Class Name - * - * @return ClassMetadata|false A ClassMetadata instance or false on miss - */ - public function read($class); - - /** - * Stores a class metadata in the cache. - * - * @param ClassMetadata $metadata A Class Metadata - */ - public function write(ClassMetadata $metadata); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Cache/DoctrineCache.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Cache/DoctrineCache.php deleted file mode 100644 index 6dd5447..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Cache/DoctrineCache.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping\Cache; - -use Doctrine\Common\Cache\Cache; -use Symfony\Component\Validator\Mapping\ClassMetadata; - -/** - * Adapts a Doctrine cache to a CacheInterface. - * - * @author Florian Voutzinos - */ -final class DoctrineCache implements CacheInterface -{ - private $cache; - - /** - * Creates a new Doctrine cache. - * - * @param Cache $cache The cache to adapt - */ - public function __construct(Cache $cache) - { - $this->cache = $cache; - } - - /** - * Sets the cache to adapt. - * - * @param Cache $cache The cache to adapt - */ - public function setCache(Cache $cache) - { - $this->cache = $cache; - } - - /** - * {@inheritdoc} - */ - public function has($class) - { - return $this->cache->contains($class); - } - - /** - * {@inheritdoc} - */ - public function read($class) - { - return $this->cache->fetch($class); - } - - /** - * {@inheritdoc} - */ - public function write(ClassMetadata $metadata) - { - $this->cache->save($metadata->getClassName(), $metadata); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/CascadingStrategy.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/CascadingStrategy.php deleted file mode 100644 index ff2853f..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/CascadingStrategy.php +++ /dev/null @@ -1,53 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping; - -/** - * Specifies whether an object should be cascaded. - * - * Cascading is relevant for any node type but class nodes. If such a node - * contains an object of value, and if cascading is enabled, then the node - * traverser will try to find class metadata for that object and validate the - * object against that metadata. - * - * If no metadata is found for a cascaded object, and if that object implements - * {@link \Traversable}, the node traverser will iterate over the object and - * cascade each object or collection contained within, unless iteration is - * prohibited by the specified {@link TraversalStrategy}. - * - * Although the constants currently represent a boolean switch, they are - * implemented as bit mask in order to allow future extensions. - * - * @since 2.5 - * @author Bernhard Schussek - * - * @see TraversalStrategy - */ -class CascadingStrategy -{ - /** - * Specifies that a node should not be cascaded. - */ - const NONE = 1; - - /** - * Specifies that a node should be cascaded. - */ - const CASCADE = 2; - - /** - * Not instantiable. - */ - private function __construct() - { - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/ClassMetadata.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/ClassMetadata.php deleted file mode 100644 index a234939..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/ClassMetadata.php +++ /dev/null @@ -1,548 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Constraints\GroupSequence; -use Symfony\Component\Validator\Constraints\Traverse; -use Symfony\Component\Validator\Constraints\Valid; -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; -use Symfony\Component\Validator\Exception\GroupDefinitionException; -use Symfony\Component\Validator\ValidationVisitorInterface; - -/** - * Default implementation of {@link ClassMetadataInterface}. - * - * This class supports serialization and cloning. - * - * @author Bernhard Schussek - * @author Fabien Potencier - */ -class ClassMetadata extends ElementMetadata implements ClassMetadataInterface -{ - /** - * @var string - * - * @internal This property is public in order to reduce the size of the - * class' serialized representation. Do not access it. Use - * {@link getClassName()} instead. - */ - public $name; - - /** - * @var string - * - * @internal This property is public in order to reduce the size of the - * class' serialized representation. Do not access it. Use - * {@link getDefaultGroup()} instead. - */ - public $defaultGroup; - - /** - * @var MemberMetadata[] - * - * @internal This property is public in order to reduce the size of the - * class' serialized representation. Do not access it. Use - * {@link getPropertyMetadata()} instead. - */ - public $members = array(); - - /** - * @var PropertyMetadata[] - * - * @internal This property is public in order to reduce the size of the - * class' serialized representation. Do not access it. Use - * {@link getPropertyMetadata()} instead. - */ - public $properties = array(); - - /** - * @var GetterMetadata[] - * - * @internal This property is public in order to reduce the size of the - * class' serialized representation. Do not access it. Use - * {@link getPropertyMetadata()} instead. - */ - public $getters = array(); - - /** - * @var array - * - * @internal This property is public in order to reduce the size of the - * class' serialized representation. Do not access it. Use - * {@link getGroupSequence()} instead. - */ - public $groupSequence = array(); - - /** - * @var bool - * - * @internal This property is public in order to reduce the size of the - * class' serialized representation. Do not access it. Use - * {@link isGroupSequenceProvider()} instead. - */ - public $groupSequenceProvider = false; - - /** - * The strategy for traversing traversable objects. - * - * By default, only instances of {@link \Traversable} are traversed. - * - * @var int - * - * @internal This property is public in order to reduce the size of the - * class' serialized representation. Do not access it. Use - * {@link getTraversalStrategy()} instead. - */ - public $traversalStrategy = TraversalStrategy::IMPLICIT; - - /** - * @var \ReflectionClass - */ - private $reflClass; - - /** - * Constructs a metadata for the given class. - * - * @param string $class - */ - public function __construct($class) - { - $this->name = $class; - // class name without namespace - if (false !== $nsSep = strrpos($class, '\\')) { - $this->defaultGroup = substr($class, $nsSep + 1); - } else { - $this->defaultGroup = $class; - } - } - - /** - * {@inheritdoc} - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - */ - public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath, $propagatedGroup = null) - { - if (null === $propagatedGroup && Constraint::DEFAULT_GROUP === $group - && ($this->hasGroupSequence() || $this->isGroupSequenceProvider())) { - if ($this->hasGroupSequence()) { - $groups = $this->getGroupSequence(); - } else { - $groups = $value->getGroupSequence(); - } - - foreach ($groups as $group) { - $this->accept($visitor, $value, $group, $propertyPath, Constraint::DEFAULT_GROUP); - - if (count($visitor->getViolations()) > 0) { - break; - } - } - - return; - } - - $visitor->visit($this, $value, $group, $propertyPath); - - if (null !== $value) { - $pathPrefix = empty($propertyPath) ? '' : $propertyPath.'.'; - - foreach ($this->getConstrainedProperties() as $property) { - foreach ($this->getPropertyMetadata($property) as $member) { - $member->accept($visitor, $member->getPropertyValue($value), $group, $pathPrefix.$property, $propagatedGroup); - } - } - } - } - - /** - * {@inheritdoc} - */ - public function __sleep() - { - $parentProperties = parent::__sleep(); - - // Don't store the cascading strategy. Classes never cascade. - unset($parentProperties[array_search('cascadingStrategy', $parentProperties)]); - - return array_merge($parentProperties, array( - 'getters', - 'groupSequence', - 'groupSequenceProvider', - 'members', - 'name', - 'properties', - 'defaultGroup', - )); - } - - /** - * {@inheritdoc} - */ - public function getClassName() - { - return $this->name; - } - - /** - * Returns the name of the default group for this class. - * - * For each class, the group "Default" is an alias for the group - * "", where is the non-namespaced name of the - * class. All constraints implicitly or explicitly assigned to group - * "Default" belong to both of these groups, unless the class defines - * a group sequence. - * - * If a class defines a group sequence, validating the class in "Default" - * will validate the group sequence. The constraints assigned to "Default" - * can still be validated by validating the class in "". - * - * @return string The name of the default group - */ - public function getDefaultGroup() - { - return $this->defaultGroup; - } - - /** - * {@inheritdoc} - */ - public function addConstraint(Constraint $constraint) - { - if (!in_array(Constraint::CLASS_CONSTRAINT, (array) $constraint->getTargets())) { - throw new ConstraintDefinitionException(sprintf( - 'The constraint "%s" cannot be put on classes.', - get_class($constraint) - )); - } - - if ($constraint instanceof Valid) { - throw new ConstraintDefinitionException(sprintf( - 'The constraint "%s" cannot be put on classes.', - get_class($constraint) - )); - } - - if ($constraint instanceof Traverse) { - if ($constraint->traverse) { - // If traverse is true, traversal should be explicitly enabled - $this->traversalStrategy = TraversalStrategy::TRAVERSE; - } else { - // If traverse is false, traversal should be explicitly disabled - $this->traversalStrategy = TraversalStrategy::NONE; - } - - // The constraint is not added - return $this; - } - - $constraint->addImplicitGroupName($this->getDefaultGroup()); - - parent::addConstraint($constraint); - - return $this; - } - - /** - * Adds a constraint to the given property. - * - * @param string $property The name of the property - * @param Constraint $constraint The constraint - * - * @return ClassMetadata This object - */ - public function addPropertyConstraint($property, Constraint $constraint) - { - if (!isset($this->properties[$property])) { - $this->properties[$property] = new PropertyMetadata($this->getClassName(), $property); - - $this->addPropertyMetadata($this->properties[$property]); - } - - $constraint->addImplicitGroupName($this->getDefaultGroup()); - - $this->properties[$property]->addConstraint($constraint); - - return $this; - } - - /** - * @param string $property - * @param Constraint[] $constraints - * - * @return ClassMetadata - */ - public function addPropertyConstraints($property, array $constraints) - { - foreach ($constraints as $constraint) { - $this->addPropertyConstraint($property, $constraint); - } - - return $this; - } - - /** - * Adds a constraint to the getter of the given property. - * - * The name of the getter is assumed to be the name of the property with an - * uppercased first letter and either the prefix "get" or "is". - * - * @param string $property The name of the property - * @param Constraint $constraint The constraint - * - * @return ClassMetadata This object - */ - public function addGetterConstraint($property, Constraint $constraint) - { - if (!isset($this->getters[$property])) { - $this->getters[$property] = new GetterMetadata($this->getClassName(), $property); - - $this->addPropertyMetadata($this->getters[$property]); - } - - $constraint->addImplicitGroupName($this->getDefaultGroup()); - - $this->getters[$property]->addConstraint($constraint); - - return $this; - } - - /** - * @param string $property - * @param Constraint[] $constraints - * - * @return ClassMetadata - */ - public function addGetterConstraints($property, array $constraints) - { - foreach ($constraints as $constraint) { - $this->addGetterConstraint($property, $constraint); - } - - return $this; - } - - /** - * Merges the constraints of the given metadata into this object. - * - * @param ClassMetadata $source The source metadata - */ - public function mergeConstraints(ClassMetadata $source) - { - foreach ($source->getConstraints() as $constraint) { - $this->addConstraint(clone $constraint); - } - - foreach ($source->getConstrainedProperties() as $property) { - foreach ($source->getPropertyMetadata($property) as $member) { - $member = clone $member; - - foreach ($member->getConstraints() as $constraint) { - $constraint->addImplicitGroupName($this->getDefaultGroup()); - } - - $this->addPropertyMetadata($member); - - if ($member instanceof MemberMetadata && !$member->isPrivate($this->name)) { - $property = $member->getPropertyName(); - - if ($member instanceof PropertyMetadata && !isset($this->properties[$property])) { - $this->properties[$property] = $member; - } elseif ($member instanceof GetterMetadata && !isset($this->getters[$property])) { - $this->getters[$property] = $member; - } - } - } - } - } - - /** - * Adds a member metadata. - * - * @param MemberMetadata $metadata - * - * @deprecated Deprecated since version 2.6, to be removed in 3.0. - */ - protected function addMemberMetadata(MemberMetadata $metadata) - { - $this->addPropertyMetadata($metadata); - } - - /** - * Returns true if metadatas of members is present for the given property. - * - * @param string $property The name of the property - * - * @return bool - * - * @deprecated Deprecated since version 2.6, to be removed in 3.0. Use {@link hasPropertyMetadata} instead. - */ - public function hasMemberMetadatas($property) - { - return $this->hasPropertyMetadata($property); - } - - /** - * Returns all metadatas of members describing the given property. - * - * @param string $property The name of the property - * - * @return MemberMetadata[] An array of MemberMetadata - * - * @deprecated Deprecated since version 2.6, to be removed in 3.0. Use {@link getPropertyMetadata} instead. - */ - public function getMemberMetadatas($property) - { - return $this->getPropertyMetadata($property); - } - - /** - * {@inheritdoc} - */ - public function hasPropertyMetadata($property) - { - return array_key_exists($property, $this->members); - } - - /** - * {@inheritdoc} - */ - public function getPropertyMetadata($property) - { - if (!isset($this->members[$property])) { - return array(); - } - - return $this->members[$property]; - } - - /** - * {@inheritdoc} - */ - public function getConstrainedProperties() - { - return array_keys($this->members); - } - - /** - * Sets the default group sequence for this class. - * - * @param array $groupSequence An array of group names - * - * @return ClassMetadata - * - * @throws GroupDefinitionException - */ - public function setGroupSequence($groupSequence) - { - if ($this->isGroupSequenceProvider()) { - throw new GroupDefinitionException('Defining a static group sequence is not allowed with a group sequence provider'); - } - - if (is_array($groupSequence)) { - $groupSequence = new GroupSequence($groupSequence); - } - - if (in_array(Constraint::DEFAULT_GROUP, $groupSequence->groups, true)) { - throw new GroupDefinitionException(sprintf('The group "%s" is not allowed in group sequences', Constraint::DEFAULT_GROUP)); - } - - if (!in_array($this->getDefaultGroup(), $groupSequence->groups, true)) { - throw new GroupDefinitionException(sprintf('The group "%s" is missing in the group sequence', $this->getDefaultGroup())); - } - - $this->groupSequence = $groupSequence; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function hasGroupSequence() - { - return count($this->groupSequence) > 0; - } - - /** - * {@inheritdoc} - */ - public function getGroupSequence() - { - return $this->groupSequence; - } - - /** - * Returns a ReflectionClass instance for this class. - * - * @return \ReflectionClass - */ - public function getReflectionClass() - { - if (!$this->reflClass) { - $this->reflClass = new \ReflectionClass($this->getClassName()); - } - - return $this->reflClass; - } - - /** - * Sets whether a group sequence provider should be used. - * - * @param bool $active - * - * @throws GroupDefinitionException - */ - public function setGroupSequenceProvider($active) - { - if ($this->hasGroupSequence()) { - throw new GroupDefinitionException('Defining a group sequence provider is not allowed with a static group sequence'); - } - - if (!$this->getReflectionClass()->implementsInterface('Symfony\Component\Validator\GroupSequenceProviderInterface')) { - throw new GroupDefinitionException(sprintf('Class "%s" must implement GroupSequenceProviderInterface', $this->name)); - } - - $this->groupSequenceProvider = $active; - } - - /** - * {@inheritdoc} - */ - public function isGroupSequenceProvider() - { - return $this->groupSequenceProvider; - } - - /** - * Class nodes are never cascaded. - * - * {@inheritdoc} - */ - public function getCascadingStrategy() - { - return CascadingStrategy::NONE; - } - - /** - * Adds a property metadata. - * - * @param PropertyMetadataInterface $metadata - */ - private function addPropertyMetadata(PropertyMetadataInterface $metadata) - { - $property = $metadata->getPropertyName(); - - $this->members[$property][] = $metadata; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/ClassMetadataFactory.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/ClassMetadataFactory.php deleted file mode 100644 index 9b05edd..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/ClassMetadataFactory.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping; - -use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory; - -/** - * Alias of {@link LazyLoadingMetadataFactory}. - * - * @author Bernhard Schussek - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link LazyLoadingMetadataFactory} instead. - */ -class ClassMetadataFactory extends LazyLoadingMetadataFactory -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/ClassMetadataInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/ClassMetadataInterface.php deleted file mode 100644 index bb76c2c..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/ClassMetadataInterface.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping; - -use Symfony\Component\Validator\ClassBasedInterface; -use Symfony\Component\Validator\PropertyMetadataContainerInterface as LegacyPropertyMetadataContainerInterface; - -/** - * Stores all metadata needed for validating objects of specific class. - * - * Most importantly, the metadata stores the constraints against which an object - * and its properties should be validated. - * - * Additionally, the metadata stores whether the "Default" group is overridden - * by a group sequence for that class and whether instances of that class - * should be traversed or not. - * - * @since 2.5 - * @author Bernhard Schussek - * - * @see MetadataInterface - * @see \Symfony\Component\Validator\Constraints\GroupSequence - * @see \Symfony\Component\Validator\GroupSequenceProviderInterface - * @see TraversalStrategy - */ -interface ClassMetadataInterface extends MetadataInterface, LegacyPropertyMetadataContainerInterface, ClassBasedInterface -{ - /** - * Returns the names of all constrained properties. - * - * @return string[] A list of property names - */ - public function getConstrainedProperties(); - - /** - * Returns whether the "Default" group is overridden by a group sequence. - * - * If it is, you can access the group sequence with {@link getGroupSequence()}. - * - * @return bool Returns true if the "Default" group is overridden - * - * @see \Symfony\Component\Validator\Constraints\GroupSequence - */ - public function hasGroupSequence(); - - /** - * Returns the group sequence that overrides the "Default" group for this - * class. - * - * @return \Symfony\Component\Validator\Constraints\GroupSequence|null The group sequence or null - * - * @see \Symfony\Component\Validator\Constraints\GroupSequence - */ - public function getGroupSequence(); - - /** - * Returns whether the "Default" group is overridden by a dynamic group - * sequence obtained by the validated objects. - * - * If this method returns true, the class must implement - * {@link \Symfony\Component\Validator\GroupSequenceProviderInterface}. - * This interface will be used to obtain the group sequence when an object - * of this class is validated. - * - * @return bool Returns true if the "Default" group is overridden by - * a dynamic group sequence - * - * @see \Symfony\Component\Validator\GroupSequenceProviderInterface - */ - public function isGroupSequenceProvider(); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/ElementMetadata.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/ElementMetadata.php deleted file mode 100644 index 1b971c9..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/ElementMetadata.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping; - -/** - * Contains the metadata of a structural element. - * - * @author Bernhard Schussek - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Extend {@link GenericMetadata} instead. - */ -abstract class ElementMetadata extends GenericMetadata -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Factory/BlackHoleMetadataFactory.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Factory/BlackHoleMetadataFactory.php deleted file mode 100644 index 5b38d0c..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Factory/BlackHoleMetadataFactory.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping\Factory; - -/** - * Metadata factory that does not store metadata. - * - * This implementation is useful if you want to validate values against - * constraints only and you don't need to add constraints to classes and - * properties. - * - * @author Fabien Potencier - */ -class BlackHoleMetadataFactory implements MetadataFactoryInterface -{ - /** - * {@inheritdoc} - */ - public function getMetadataFor($value) - { - throw new \LogicException('This class does not support metadata.'); - } - - /** - * {@inheritdoc} - */ - public function hasMetadataFor($value) - { - return false; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php deleted file mode 100644 index b6ef076..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php +++ /dev/null @@ -1,153 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping\Factory; - -use Symfony\Component\Validator\Exception\NoSuchMetadataException; -use Symfony\Component\Validator\Mapping\Cache\CacheInterface; -use Symfony\Component\Validator\Mapping\ClassMetadata; -use Symfony\Component\Validator\Mapping\Loader\LoaderInterface; - -/** - * Creates new {@link ClassMetadataInterface} instances. - * - * Whenever {@link getMetadataFor()} is called for the first time with a given - * class name or object of that class, a new metadata instance is created and - * returned. On subsequent requests for the same class, the same metadata - * instance will be returned. - * - * You can optionally pass a {@link LoaderInterface} instance to the constructor. - * Whenever a new metadata instance is created, it is passed to the loader, - * which can configure the metadata based on configuration loaded from the - * filesystem or a database. If you want to use multiple loaders, wrap them in a - * {@link Loader\LoaderChain}. - * - * You can also optionally pass a {@link CacheInterface} instance to the - * constructor. This cache will be used for persisting the generated metadata - * between multiple PHP requests. - * - * @author Bernhard Schussek - */ -class LazyLoadingMetadataFactory implements MetadataFactoryInterface -{ - /** - * The loader for loading the class metadata - * - * @var LoaderInterface|null - */ - protected $loader; - - /** - * The cache for caching class metadata - * - * @var CacheInterface|null - */ - protected $cache; - - /** - * The loaded metadata, indexed by class name - * - * @var ClassMetadata[] - */ - protected $loadedClasses = array(); - - /** - * Creates a new metadata factory. - * - * @param LoaderInterface|null $loader The loader for configuring new metadata - * @param CacheInterface|null $cache The cache for persisting metadata - * between multiple PHP requests - */ - public function __construct(LoaderInterface $loader = null, CacheInterface $cache = null) - { - $this->loader = $loader; - $this->cache = $cache; - } - - /** - * {@inheritdoc} - * - * If the method was called with the same class name (or an object of that - * class) before, the same metadata instance is returned. - * - * If the factory was configured with a cache, this method will first look - * for an existing metadata instance in the cache. If an existing instance - * is found, it will be returned without further ado. - * - * Otherwise, a new metadata instance is created. If the factory was - * configured with a loader, the metadata is passed to the - * {@link LoaderInterface::loadClassMetadata()} method for further - * configuration. At last, the new object is returned. - */ - public function getMetadataFor($value) - { - if (!is_object($value) && !is_string($value)) { - throw new NoSuchMetadataException(sprintf('Cannot create metadata for non-objects. Got: %s', gettype($value))); - } - - $class = ltrim(is_object($value) ? get_class($value) : $value, '\\'); - - if (isset($this->loadedClasses[$class])) { - return $this->loadedClasses[$class]; - } - - if (null !== $this->cache && false !== ($this->loadedClasses[$class] = $this->cache->read($class))) { - return $this->loadedClasses[$class]; - } - - if (!class_exists($class) && !interface_exists($class)) { - throw new NoSuchMetadataException(sprintf('The class or interface "%s" does not exist.', $class)); - } - - $metadata = new ClassMetadata($class); - - // Include constraints from the parent class - if ($parent = $metadata->getReflectionClass()->getParentClass()) { - $metadata->mergeConstraints($this->getMetadataFor($parent->name)); - } - - // Include constraints from all implemented interfaces - foreach ($metadata->getReflectionClass()->getInterfaces() as $interface) { - if ('Symfony\Component\Validator\GroupSequenceProviderInterface' === $interface->name) { - continue; - } - $metadata->mergeConstraints($this->getMetadataFor($interface->name)); - } - - if (null !== $this->loader) { - $this->loader->loadClassMetadata($metadata); - } - - if (null !== $this->cache) { - $this->cache->write($metadata); - } - - return $this->loadedClasses[$class] = $metadata; - } - - /** - * {@inheritdoc} - */ - public function hasMetadataFor($value) - { - if (!is_object($value) && !is_string($value)) { - return false; - } - - $class = ltrim(is_object($value) ? get_class($value) : $value, '\\'); - - if (class_exists($class) || interface_exists($class)) { - return true; - } - - return false; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Factory/MetadataFactoryInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Factory/MetadataFactoryInterface.php deleted file mode 100644 index ef25174..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Factory/MetadataFactoryInterface.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping\Factory; - -use Symfony\Component\Validator\MetadataFactoryInterface as LegacyMetadataFactoryInterface; - -/** - * Returns {@link MetadataInterface} instances for values. - * - * @since 2.5 - * @author Bernhard Schussek - */ -interface MetadataFactoryInterface extends LegacyMetadataFactoryInterface -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/GenericMetadata.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/GenericMetadata.php deleted file mode 100644 index 904dcd7..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/GenericMetadata.php +++ /dev/null @@ -1,243 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Constraints\Traverse; -use Symfony\Component\Validator\Constraints\Valid; -use Symfony\Component\Validator\Exception\BadMethodCallException; -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; -use Symfony\Component\Validator\ValidationVisitorInterface; - -/** - * A generic container of {@link Constraint} objects. - * - * This class supports serialization and cloning. - * - * @since 2.5 - * @author Bernhard Schussek - */ -class GenericMetadata implements MetadataInterface -{ - /** - * @var Constraint[] - * - * @internal This property is public in order to reduce the size of the - * class' serialized representation. Do not access it. Use - * {@link getConstraints()} and {@link findConstraints()} instead. - */ - public $constraints = array(); - - /** - * @var array - * - * @internal This property is public in order to reduce the size of the - * class' serialized representation. Do not access it. Use - * {@link findConstraints()} instead. - */ - public $constraintsByGroup = array(); - - /** - * The strategy for cascading objects. - * - * By default, objects are not cascaded. - * - * @var int - * - * @see CascadingStrategy - * - * @internal This property is public in order to reduce the size of the - * class' serialized representation. Do not access it. Use - * {@link getCascadingStrategy()} instead. - */ - public $cascadingStrategy = CascadingStrategy::NONE; - - /** - * The strategy for traversing traversable objects. - * - * By default, traversable objects are not traversed. - * - * @var int - * - * @see TraversalStrategy - * - * @internal This property is public in order to reduce the size of the - * class' serialized representation. Do not access it. Use - * {@link getTraversalStrategy()} instead. - */ - public $traversalStrategy = TraversalStrategy::NONE; - - /** - * Returns the names of the properties that should be serialized. - * - * @return string[] - */ - public function __sleep() - { - return array( - 'constraints', - 'constraintsByGroup', - 'cascadingStrategy', - 'traversalStrategy', - ); - } - - /** - * Clones this object. - */ - public function __clone() - { - $constraints = $this->constraints; - - $this->constraints = array(); - $this->constraintsByGroup = array(); - - foreach ($constraints as $constraint) { - $this->addConstraint(clone $constraint); - } - } - - /** - * Adds a constraint. - * - * If the constraint {@link Valid} is added, the cascading strategy will be - * changed to {@link CascadingStrategy::CASCADE}. Depending on the - * properties $traverse and $deep of that constraint, the traversal strategy - * will be set to one of the following: - * - * - {@link TraversalStrategy::IMPLICIT} if $traverse is enabled and $deep - * is enabled - * - {@link TraversalStrategy::IMPLICIT} | {@link TraversalStrategy::STOP_RECURSION} - * if $traverse is enabled, but $deep is disabled - * - {@link TraversalStrategy::NONE} if $traverse is disabled - * - * @param Constraint $constraint The constraint to add - * - * @return GenericMetadata This object - * - * @throws ConstraintDefinitionException When trying to add the - * {@link Traverse} constraint - */ - public function addConstraint(Constraint $constraint) - { - if ($constraint instanceof Traverse) { - throw new ConstraintDefinitionException(sprintf( - 'The constraint "%s" can only be put on classes. Please use '. - '"Symfony\Component\Validator\Constraints\Valid" instead.', - get_class($constraint) - )); - } - - if ($constraint instanceof Valid) { - $this->cascadingStrategy = CascadingStrategy::CASCADE; - - if ($constraint->traverse) { - // Traverse unless the value is not traversable - $this->traversalStrategy = TraversalStrategy::IMPLICIT; - - if (!$constraint->deep) { - $this->traversalStrategy |= TraversalStrategy::STOP_RECURSION; - } - } else { - $this->traversalStrategy = TraversalStrategy::NONE; - } - - return $this; - } - - $this->constraints[] = $constraint; - - foreach ($constraint->groups as $group) { - $this->constraintsByGroup[$group][] = $constraint; - } - - return $this; - } - - /** - * Adds an list of constraints. - * - * @param Constraint[] $constraints The constraints to add - * - * @return GenericMetadata This object - */ - public function addConstraints(array $constraints) - { - foreach ($constraints as $constraint) { - $this->addConstraint($constraint); - } - - return $this; - } - - /** - * {@inheritdoc} - */ - public function getConstraints() - { - return $this->constraints; - } - - /** - * Returns whether this element has any constraints. - * - * @return bool - */ - public function hasConstraints() - { - return count($this->constraints) > 0; - } - - /** - * {@inheritdoc} - * - * Aware of the global group (* group). - */ - public function findConstraints($group) - { - return isset($this->constraintsByGroup[$group]) - ? $this->constraintsByGroup[$group] - : array(); - } - - /** - * {@inheritdoc} - */ - public function getCascadingStrategy() - { - return $this->cascadingStrategy; - } - - /** - * {@inheritdoc} - */ - public function getTraversalStrategy() - { - return $this->traversalStrategy; - } - - /** - * Exists for compatibility with the deprecated - * {@link Symfony\Component\Validator\MetadataInterface}. - * - * Should not be used. - * - * @throws BadMethodCallException - * - * @deprecated Implemented for backwards compatibility with Symfony < 2.5. - * Will be removed in Symfony 3.0. - */ - public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath) - { - throw new BadMethodCallException('Not supported.'); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/GetterMetadata.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/GetterMetadata.php deleted file mode 100644 index 0cf9992..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/GetterMetadata.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping; - -use Symfony\Component\Validator\Exception\ValidatorException; - -/** - * Stores all metadata needed for validating a class property via its getter - * method. - * - * A property getter is any method that is equal to the property's name, - * prefixed with either "get" or "is". That method will be used to access the - * property's value. - * - * The getter will be invoked by reflection, so the access of private and - * protected getters is supported. - * - * This class supports serialization and cloning. - * - * @author Bernhard Schussek - * - * @see PropertyMetadataInterface - */ -class GetterMetadata extends MemberMetadata -{ - /** - * Constructor. - * - * @param string $class The class the getter is defined on - * @param string $property The property which the getter returns - * - * @throws ValidatorException - */ - public function __construct($class, $property) - { - $getMethod = 'get'.ucfirst($property); - $isMethod = 'is'.ucfirst($property); - $hasMethod = 'has'.ucfirst($property); - - if (method_exists($class, $getMethod)) { - $method = $getMethod; - } elseif (method_exists($class, $isMethod)) { - $method = $isMethod; - } elseif (method_exists($class, $hasMethod)) { - $method = $hasMethod; - } else { - throw new ValidatorException(sprintf('Neither of these methods exist in class %s: %s, %s, %s', $class, $getMethod, $isMethod, $hasMethod)); - } - - parent::__construct($class, $method, $property); - } - - /** - * {@inheritdoc} - */ - public function getPropertyValue($object) - { - return $this->newReflectionMember($object)->invoke($object); - } - - /** - * {@inheritdoc} - */ - protected function newReflectionMember($objectOrClassName) - { - return new \ReflectionMethod($objectOrClassName, $this->getName()); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php deleted file mode 100644 index 2ae8988..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php +++ /dev/null @@ -1,91 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping\Loader; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Exception\MappingException; - -/** - * Base loader for validation metadata. - * - * This loader supports the loading of constraints from Symfony's default - * namespace (see {@link DEFAULT_NAMESPACE}) using the short class names of - * those constraints. Constraints can also be loaded using their fully - * qualified class names. At last, namespace aliases can be defined to load - * constraints with the syntax "alias:ShortName". - * - * @author Bernhard Schussek - */ -abstract class AbstractLoader implements LoaderInterface -{ - /** - * The namespace to load constraints from by default. - */ - const DEFAULT_NAMESPACE = '\\Symfony\\Component\\Validator\\Constraints\\'; - - /** - * @var array - */ - protected $namespaces = array(); - - /** - * Adds a namespace alias. - * - * The namespace alias can be used to reference constraints from specific - * namespaces in {@link newConstraint()}: - * - * $this->addNamespaceAlias('mynamespace', '\\Acme\\Package\\Constraints\\'); - * - * $constraint = $this->newConstraint('mynamespace:NotNull'); - * - * @param string $alias The alias - * @param string $namespace The PHP namespace - */ - protected function addNamespaceAlias($alias, $namespace) - { - $this->namespaces[$alias] = $namespace; - } - - /** - * Creates a new constraint instance for the given constraint name. - * - * @param string $name The constraint name. Either a constraint relative - * to the default constraint namespace, or a fully - * qualified class name. Alternatively, the constraint - * may be preceded by a namespace alias and a colon. - * The namespace alias must have been defined using - * {@link addNamespaceAlias()}. - * @param mixed $options The constraint options - * - * @return Constraint - * - * @throws MappingException If the namespace prefix is undefined - */ - protected function newConstraint($name, $options = null) - { - if (strpos($name, '\\') !== false && class_exists($name)) { - $className = (string) $name; - } elseif (strpos($name, ':') !== false) { - list($prefix, $className) = explode(':', $name, 2); - - if (!isset($this->namespaces[$prefix])) { - throw new MappingException(sprintf('Undefined namespace prefix "%s"', $prefix)); - } - - $className = $this->namespaces[$prefix].$className; - } else { - $className = self::DEFAULT_NAMESPACE.$name; - } - - return new $className($options); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/AnnotationLoader.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/AnnotationLoader.php deleted file mode 100644 index af0bf52..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/AnnotationLoader.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping\Loader; - -use Doctrine\Common\Annotations\Reader; -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Constraints\Callback; -use Symfony\Component\Validator\Constraints\GroupSequence; -use Symfony\Component\Validator\Constraints\GroupSequenceProvider; -use Symfony\Component\Validator\Exception\MappingException; -use Symfony\Component\Validator\Mapping\ClassMetadata; - -/** - * Loads validation metadata using a Doctrine annotation {@link Reader}. - * - * @author Bernhard Schussek - */ -class AnnotationLoader implements LoaderInterface -{ - /** - * @var Reader - */ - protected $reader; - - public function __construct(Reader $reader) - { - $this->reader = $reader; - } - - /** - * {@inheritdoc} - */ - public function loadClassMetadata(ClassMetadata $metadata) - { - $reflClass = $metadata->getReflectionClass(); - $className = $reflClass->name; - $success = false; - - foreach ($this->reader->getClassAnnotations($reflClass) as $constraint) { - if ($constraint instanceof GroupSequence) { - $metadata->setGroupSequence($constraint->groups); - } elseif ($constraint instanceof GroupSequenceProvider) { - $metadata->setGroupSequenceProvider(true); - } elseif ($constraint instanceof Constraint) { - $metadata->addConstraint($constraint); - } - - $success = true; - } - - foreach ($reflClass->getProperties() as $property) { - if ($property->getDeclaringClass()->name == $className) { - foreach ($this->reader->getPropertyAnnotations($property) as $constraint) { - if ($constraint instanceof Constraint) { - $metadata->addPropertyConstraint($property->name, $constraint); - } - - $success = true; - } - } - } - - foreach ($reflClass->getMethods() as $method) { - if ($method->getDeclaringClass()->name == $className) { - foreach ($this->reader->getMethodAnnotations($method) as $constraint) { - if ($constraint instanceof Callback) { - $constraint->callback = $method->getName(); - $constraint->methods = null; - - $metadata->addConstraint($constraint); - } elseif ($constraint instanceof Constraint) { - if (preg_match('/^(get|is|has)(.+)$/i', $method->name, $matches)) { - $metadata->addGetterConstraint(lcfirst($matches[2]), $constraint); - } else { - throw new MappingException(sprintf('The constraint on "%s::%s" cannot be added. Constraints can only be added on methods beginning with "get", "is" or "has".', $className, $method->name)); - } - } - - $success = true; - } - } - } - - return $success; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/FileLoader.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/FileLoader.php deleted file mode 100644 index 326bbdf..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/FileLoader.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping\Loader; - -use Symfony\Component\Validator\Exception\MappingException; - -/** - * Base loader for loading validation metadata from a file. - * - * @author Bernhard Schussek - * - * @see YamlFileLoader - * @see XmlFileLoader - */ -abstract class FileLoader extends AbstractLoader -{ - /** - * The file to load. - * - * @var string - */ - protected $file; - - /** - * Creates a new loader. - * - * @param string $file The mapping file to load - * - * @throws MappingException If the file does not exist or is not readable - */ - public function __construct($file) - { - if (!is_file($file)) { - throw new MappingException(sprintf('The mapping file "%s" does not exist', $file)); - } - - if (!is_readable($file)) { - throw new MappingException(sprintf('The mapping file "%s" is not readable', $file)); - } - - if (!stream_is_local($this->file)) { - throw new MappingException(sprintf('The mapping file "%s" is not a local file', $file)); - } - - $this->file = $file; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/FilesLoader.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/FilesLoader.php deleted file mode 100644 index 571c7e7..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/FilesLoader.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping\Loader; - -/** - * Base loader for loading validation metadata from a list of files. - * - * @author Bulat Shakirzyanov - * @author Bernhard Schussek - * - * @see YamlFilesLoader - * @see XmlFilesLoader - */ -abstract class FilesLoader extends LoaderChain -{ - /** - * Creates a new loader. - * - * @param array $paths An array of file paths - */ - public function __construct(array $paths) - { - parent::__construct($this->getFileLoaders($paths)); - } - - /** - * Returns an array of file loaders for the given file paths. - * - * @param array $paths An array of file paths - * - * @return LoaderInterface[] The metadata loaders - */ - protected function getFileLoaders($paths) - { - $loaders = array(); - - foreach ($paths as $path) { - $loaders[] = $this->getFileLoaderInstance($path); - } - - return $loaders; - } - - /** - * Creates a loader for the given file path. - * - * @param string $path The file path - * - * @return LoaderInterface The created loader - */ - abstract protected function getFileLoaderInstance($path); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/LoaderChain.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/LoaderChain.php deleted file mode 100644 index 970d906..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/LoaderChain.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping\Loader; - -use Symfony\Component\Validator\Exception\MappingException; -use Symfony\Component\Validator\Mapping\ClassMetadata; - -/** - * Loads validation metadata from multiple {@link LoaderInterface} instances. - * - * Pass the loaders when constructing the chain. Once - * {@link loadClassMetadata()} is called, that method will be called on all - * loaders in the chain. - * - * @author Bernhard Schussek - */ -class LoaderChain implements LoaderInterface -{ - /** - * @var LoaderInterface[] - */ - protected $loaders; - - /** - * @param LoaderInterface[] $loaders The metadata loaders to use - * - * @throws MappingException If any of the loaders has an invalid type - */ - public function __construct(array $loaders) - { - foreach ($loaders as $loader) { - if (!$loader instanceof LoaderInterface) { - throw new MappingException(sprintf('Class %s is expected to implement LoaderInterface', get_class($loader))); - } - } - - $this->loaders = $loaders; - } - - /** - * {@inheritdoc} - */ - public function loadClassMetadata(ClassMetadata $metadata) - { - $success = false; - - foreach ($this->loaders as $loader) { - $success = $loader->loadClassMetadata($metadata) || $success; - } - - return $success; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/LoaderInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/LoaderInterface.php deleted file mode 100644 index 5dadc82..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/LoaderInterface.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping\Loader; - -use Symfony\Component\Validator\Mapping\ClassMetadata; - -/** - * Loads validation metadata into {@link ClassMetadata} instances. - * - * @author Bernhard Schussek - */ -interface LoaderInterface -{ - /** - * Loads validation metadata into a {@link ClassMetadata} instance. - * - * @param ClassMetadata $metadata The metadata to load - * - * @return bool Whether the loader succeeded - */ - public function loadClassMetadata(ClassMetadata $metadata); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php deleted file mode 100644 index 4ff2257..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping\Loader; - -use Symfony\Component\Validator\Exception\MappingException; -use Symfony\Component\Validator\Mapping\ClassMetadata; - -/** - * Loads validation metadata by calling a static method on the loaded class. - * - * @author Bernhard Schussek - */ -class StaticMethodLoader implements LoaderInterface -{ - /** - * The name of the method to call. - * - * @var string - */ - protected $methodName; - - /** - * Creates a new loader. - * - * @param string $methodName The name of the static method to call - */ - public function __construct($methodName = 'loadValidatorMetadata') - { - $this->methodName = $methodName; - } - - /** - * {@inheritdoc} - */ - public function loadClassMetadata(ClassMetadata $metadata) - { - /** @var \ReflectionClass $reflClass */ - $reflClass = $metadata->getReflectionClass(); - - if (!$reflClass->isInterface() && $reflClass->hasMethod($this->methodName)) { - $reflMethod = $reflClass->getMethod($this->methodName); - - if ($reflMethod->isAbstract()) { - return false; - } - - if (!$reflMethod->isStatic()) { - throw new MappingException(sprintf('The method %s::%s should be static', $reflClass->name, $this->methodName)); - } - - if ($reflMethod->getDeclaringClass()->name != $reflClass->name) { - return false; - } - - $reflMethod->invoke(null, $metadata); - - return true; - } - - return false; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php deleted file mode 100644 index 2961b00..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php +++ /dev/null @@ -1,219 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping\Loader; - -use Symfony\Component\Config\Util\XmlUtils; -use Symfony\Component\Validator\Exception\MappingException; -use Symfony\Component\Validator\Mapping\ClassMetadata; - -/** - * Loads validation metadata from an XML file. - * - * @author Bernhard Schussek - */ -class XmlFileLoader extends FileLoader -{ - /** - * The XML nodes of the mapping file. - * - * @var \SimpleXMLElement[]|null - */ - protected $classes; - - /** - * {@inheritdoc} - */ - public function loadClassMetadata(ClassMetadata $metadata) - { - if (null === $this->classes) { - // This method may throw an exception. Do not modify the class' - // state before it completes - $xml = $this->parseFile($this->file); - - $this->classes = array(); - - foreach ($xml->namespace as $namespace) { - $this->addNamespaceAlias((string) $namespace['prefix'], trim((string) $namespace)); - } - - foreach ($xml->class as $class) { - $this->classes[(string) $class['name']] = $class; - } - } - - if (isset($this->classes[$metadata->getClassName()])) { - $classDescription = $this->classes[$metadata->getClassName()]; - - $this->loadClassMetadataFromXml($metadata, $classDescription); - - return true; - } - - return false; - } - - /** - * Parses a collection of "constraint" XML nodes. - * - * @param \SimpleXMLElement $nodes The XML nodes - * - * @return array The Constraint instances - */ - protected function parseConstraints(\SimpleXMLElement $nodes) - { - $constraints = array(); - - foreach ($nodes as $node) { - if (count($node) > 0) { - if (count($node->value) > 0) { - $options = $this->parseValues($node->value); - } elseif (count($node->constraint) > 0) { - $options = $this->parseConstraints($node->constraint); - } elseif (count($node->option) > 0) { - $options = $this->parseOptions($node->option); - } else { - $options = array(); - } - } elseif (strlen((string) $node) > 0) { - $options = trim($node); - } else { - $options = null; - } - - $constraints[] = $this->newConstraint((string) $node['name'], $options); - } - - return $constraints; - } - - /** - * Parses a collection of "value" XML nodes. - * - * @param \SimpleXMLElement $nodes The XML nodes - * - * @return array The values - */ - protected function parseValues(\SimpleXMLElement $nodes) - { - $values = array(); - - foreach ($nodes as $node) { - if (count($node) > 0) { - if (count($node->value) > 0) { - $value = $this->parseValues($node->value); - } elseif (count($node->constraint) > 0) { - $value = $this->parseConstraints($node->constraint); - } else { - $value = array(); - } - } else { - $value = trim($node); - } - - if (isset($node['key'])) { - $values[(string) $node['key']] = $value; - } else { - $values[] = $value; - } - } - - return $values; - } - - /** - * Parses a collection of "option" XML nodes. - * - * @param \SimpleXMLElement $nodes The XML nodes - * - * @return array The options - */ - protected function parseOptions(\SimpleXMLElement $nodes) - { - $options = array(); - - foreach ($nodes as $node) { - if (count($node) > 0) { - if (count($node->value) > 0) { - $value = $this->parseValues($node->value); - } elseif (count($node->constraint) > 0) { - $value = $this->parseConstraints($node->constraint); - } else { - $value = array(); - } - } else { - $value = XmlUtils::phpize($node); - if (is_string($value)) { - $value = trim($value); - } - } - - $options[(string) $node['name']] = $value; - } - - return $options; - } - - /** - * Loads the XML class descriptions from the given file. - * - * @param string $path The path of the XML file - * - * @return \SimpleXMLElement The class descriptions - * - * @throws MappingException If the file could not be loaded - */ - protected function parseFile($path) - { - try { - $dom = XmlUtils::loadFile($path, __DIR__.'/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd'); - } catch (\Exception $e) { - throw new MappingException($e->getMessage(), $e->getCode(), $e); - } - - return simplexml_import_dom($dom); - } - - /** - * Loads the validation metadata from the given XML class description. - * - * @param ClassMetadata $metadata The metadata to load - * @param array $classDescription The XML class description - */ - private function loadClassMetadataFromXml(ClassMetadata $metadata, $classDescription) - { - foreach ($classDescription->{'group-sequence-provider'} as $_) { - $metadata->setGroupSequenceProvider(true); - } - - foreach ($classDescription->{'group-sequence'} as $groupSequence) { - if (count($groupSequence->value) > 0) { - $metadata->setGroupSequence($this->parseValues($groupSequence[0]->value)); - } - } - - foreach ($this->parseConstraints($classDescription->constraint) as $constraint) { - $metadata->addConstraint($constraint); - } - - foreach ($classDescription->property as $property) { - foreach ($this->parseConstraints($property->constraint) as $constraint) { - $metadata->addPropertyConstraint((string) $property['name'], $constraint); - } - } - - foreach ($classDescription->getter as $getter) { - foreach ($this->parseConstraints($getter->constraint) as $constraint) { - $metadata->addGetterConstraint((string) $getter['property'], $constraint); - } - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/XmlFilesLoader.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/XmlFilesLoader.php deleted file mode 100644 index 6017c3f..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/XmlFilesLoader.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping\Loader; - -/** - * Loads validation metadata from a list of XML files. - * - * @author Bulat Shakirzyanov - * @author Bernhard Schussek - * - * @see FilesLoader - */ -class XmlFilesLoader extends FilesLoader -{ - /** - * {@inheritdoc} - */ - public function getFileLoaderInstance($file) - { - return new XmlFileLoader($file); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php deleted file mode 100644 index e293a6e..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php +++ /dev/null @@ -1,179 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping\Loader; - -use Symfony\Component\Validator\Mapping\ClassMetadata; -use Symfony\Component\Yaml\Parser as YamlParser; - -/** - * Loads validation metadata from a YAML file. - * - * @author Bernhard Schussek - */ -class YamlFileLoader extends FileLoader -{ - /** - * An array of YAML class descriptions. - * - * @var array - */ - protected $classes = null; - - /** - * Caches the used YAML parser. - * - * @var YamlParser - */ - private $yamlParser; - - /** - * {@inheritdoc} - */ - public function loadClassMetadata(ClassMetadata $metadata) - { - if (null === $this->classes) { - if (null === $this->yamlParser) { - $this->yamlParser = new YamlParser(); - } - - // This method may throw an exception. Do not modify the class' - // state before it completes - if (false === ($classes = $this->parseFile($this->file))) { - return false; - } - - $this->classes = $classes; - - if (isset($this->classes['namespaces'])) { - foreach ($this->classes['namespaces'] as $alias => $namespace) { - $this->addNamespaceAlias($alias, $namespace); - } - - unset($this->classes['namespaces']); - } - } - - if (isset($this->classes[$metadata->getClassName()])) { - $classDescription = $this->classes[$metadata->getClassName()]; - - $this->loadClassMetadataFromYaml($metadata, $classDescription); - - return true; - } - - return false; - } - - /** - * Parses a collection of YAML nodes. - * - * @param array $nodes The YAML nodes - * - * @return array An array of values or Constraint instances - */ - protected function parseNodes(array $nodes) - { - $values = array(); - - foreach ($nodes as $name => $childNodes) { - if (is_numeric($name) && is_array($childNodes) && count($childNodes) == 1) { - $options = current($childNodes); - - if (is_array($options)) { - $options = $this->parseNodes($options); - } - - $values[] = $this->newConstraint(key($childNodes), $options); - } else { - if (is_array($childNodes)) { - $childNodes = $this->parseNodes($childNodes); - } - - $values[$name] = $childNodes; - } - } - - return $values; - } - - /** - * Loads the YAML class descriptions from the given file. - * - * @param string $path The path of the YAML file - * - * @return array|null The class descriptions or null, if the file was empty - * - * @throws \InvalidArgumentException If the file could not be loaded or did - * not contain a YAML array - */ - private function parseFile($path) - { - $classes = $this->yamlParser->parse(file_get_contents($path)); - - // empty file - if (null === $classes) { - return; - } - - // not an array - if (!is_array($classes)) { - throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $this->file)); - } - - return $classes; - } - - /** - * Loads the validation metadata from the given YAML class description. - * - * @param ClassMetadata $metadata The metadata to load - * @param array $classDescription The YAML class description - */ - private function loadClassMetadataFromYaml(ClassMetadata $metadata, array $classDescription) - { - if (isset($classDescription['group_sequence_provider'])) { - $metadata->setGroupSequenceProvider( - (bool) $classDescription['group_sequence_provider'] - ); - } - - if (isset($classDescription['group_sequence'])) { - $metadata->setGroupSequence($classDescription['group_sequence']); - } - - if (isset($classDescription['constraints']) && is_array($classDescription['constraints'])) { - foreach ($this->parseNodes($classDescription['constraints']) as $constraint) { - $metadata->addConstraint($constraint); - } - } - - if (isset($classDescription['properties']) && is_array($classDescription['properties'])) { - foreach ($classDescription['properties'] as $property => $constraints) { - if (null !== $constraints) { - foreach ($this->parseNodes($constraints) as $constraint) { - $metadata->addPropertyConstraint($property, $constraint); - } - } - } - } - - if (isset($classDescription['getters']) && is_array($classDescription['getters'])) { - foreach ($classDescription['getters'] as $getter => $constraints) { - if (null !== $constraints) { - foreach ($this->parseNodes($constraints) as $constraint) { - $metadata->addGetterConstraint($getter, $constraint); - } - } - } - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/YamlFilesLoader.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/YamlFilesLoader.php deleted file mode 100644 index 235856f..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/YamlFilesLoader.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping\Loader; - -/** - * Loads validation metadata from a list of YAML files. - * - * @author Bulat Shakirzyanov - * @author Bernhard Schussek - * - * @see FilesLoader - */ -class YamlFilesLoader extends FilesLoader -{ - /** - * {@inheritdoc} - */ - public function getFileLoaderInstance($file) - { - return new YamlFileLoader($file); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd deleted file mode 100644 index 1ca840b..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/Loader/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/MemberMetadata.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/MemberMetadata.php deleted file mode 100644 index a0bbe0d..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/MemberMetadata.php +++ /dev/null @@ -1,251 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; -use Symfony\Component\Validator\ValidationVisitorInterface; - -/** - * Stores all metadata needed for validating a class property. - * - * The method of accessing the property's value must be specified by subclasses - * by implementing the {@link newReflectionMember()} method. - * - * This class supports serialization and cloning. - * - * @author Bernhard Schussek - * - * @see PropertyMetadataInterface - */ -abstract class MemberMetadata extends ElementMetadata implements PropertyMetadataInterface -{ - /** - * @var string - * - * @internal This property is public in order to reduce the size of the - * class' serialized representation. Do not access it. Use - * {@link getClassName()} instead. - */ - public $class; - - /** - * @var string - * - * @internal This property is public in order to reduce the size of the - * class' serialized representation. Do not access it. Use - * {@link getName()} instead. - */ - public $name; - - /** - * @var string - * - * @internal This property is public in order to reduce the size of the - * class' serialized representation. Do not access it. Use - * {@link getPropertyName()} instead. - */ - public $property; - - /** - * @var \ReflectionMethod[]|\ReflectionProperty[] - */ - private $reflMember = array(); - - /** - * Constructor. - * - * @param string $class The name of the class this member is defined on - * @param string $name The name of the member - * @param string $property The property the member belongs to - */ - public function __construct($class, $name, $property) - { - $this->class = $class; - $this->name = $name; - $this->property = $property; - } - - /** - * {@inheritdoc} - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - */ - public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath, $propagatedGroup = null) - { - $visitor->visit($this, $value, $group, $propertyPath); - - if ($this->isCascaded()) { - $visitor->validate($value, $propagatedGroup ?: $group, $propertyPath, $this->isCollectionCascaded(), $this->isCollectionCascadedDeeply()); - } - } - - /** - * {@inheritdoc} - */ - public function addConstraint(Constraint $constraint) - { - if (!in_array(Constraint::PROPERTY_CONSTRAINT, (array) $constraint->getTargets())) { - throw new ConstraintDefinitionException(sprintf( - 'The constraint %s cannot be put on properties or getters', - get_class($constraint) - )); - } - - parent::addConstraint($constraint); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function __sleep() - { - return array_merge(parent::__sleep(), array( - 'class', - 'name', - 'property', - )); - } - - /** - * Returns the name of the member. - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * {@inheritdoc} - */ - public function getClassName() - { - return $this->class; - } - - /** - * {@inheritdoc} - */ - public function getPropertyName() - { - return $this->property; - } - - /** - * Returns whether this member is public. - * - * @param object|string $objectOrClassName The object or the class name - * - * @return bool - */ - public function isPublic($objectOrClassName) - { - return $this->getReflectionMember($objectOrClassName)->isPublic(); - } - - /** - * Returns whether this member is protected. - * - * @param object|string $objectOrClassName The object or the class name - * - * @return bool - */ - public function isProtected($objectOrClassName) - { - return $this->getReflectionMember($objectOrClassName)->isProtected(); - } - - /** - * Returns whether this member is private. - * - * @param object|string $objectOrClassName The object or the class name - * - * @return bool - */ - public function isPrivate($objectOrClassName) - { - return $this->getReflectionMember($objectOrClassName)->isPrivate(); - } - - /** - * Returns whether objects stored in this member should be validated. - * - * @return bool - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link getCascadingStrategy()} instead. - */ - public function isCascaded() - { - return (bool) ($this->cascadingStrategy & CascadingStrategy::CASCADE); - } - - /** - * Returns whether arrays or traversable objects stored in this member - * should be traversed and validated in each entry. - * - * @return bool - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link getTraversalStrategy()} instead. - */ - public function isCollectionCascaded() - { - return (bool) ($this->traversalStrategy & (TraversalStrategy::IMPLICIT | TraversalStrategy::TRAVERSE)); - } - - /** - * Returns whether arrays or traversable objects stored in this member - * should be traversed recursively for inner arrays/traversable objects. - * - * @return bool - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link getTraversalStrategy()} instead. - */ - public function isCollectionCascadedDeeply() - { - return !($this->traversalStrategy & TraversalStrategy::STOP_RECURSION); - } - - /** - * Returns the reflection instance for accessing the member's value. - * - * @param object|string $objectOrClassName The object or the class name - * - * @return \ReflectionMethod|\ReflectionProperty The reflection instance - */ - public function getReflectionMember($objectOrClassName) - { - $className = is_string($objectOrClassName) ? $objectOrClassName : get_class($objectOrClassName); - if (!isset($this->reflMember[$className])) { - $this->reflMember[$className] = $this->newReflectionMember($objectOrClassName); - } - - return $this->reflMember[$className]; - } - - /** - * Creates a new reflection instance for accessing the member's value. - * - * Must be implemented by subclasses. - * - * @param object|string $objectOrClassName The object or the class name - * - * @return \ReflectionMethod|\ReflectionProperty The reflection instance - */ - abstract protected function newReflectionMember($objectOrClassName); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/MetadataInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/MetadataInterface.php deleted file mode 100644 index fda1dbb..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/MetadataInterface.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping; - -use Symfony\Component\Validator\MetadataInterface as LegacyMetadataInterface; - -/** - * A container for validation metadata. - * - * Most importantly, the metadata stores the constraints against which an object - * and its properties should be validated. - * - * Additionally, the metadata stores whether objects should be validated - * against their class' metadata and whether traversable objects should be - * traversed or not. - * - * @since 2.5 - * @author Bernhard Schussek - * - * @see CascadingStrategy - * @see TraversalStrategy - */ -interface MetadataInterface extends LegacyMetadataInterface -{ - /** - * Returns the strategy for cascading objects. - * - * @return int The cascading strategy - * - * @see CascadingStrategy - */ - public function getCascadingStrategy(); - - /** - * Returns the strategy for traversing traversable objects. - * - * @return int The traversal strategy - * - * @see TraversalStrategy - */ - public function getTraversalStrategy(); - - /** - * Returns all constraints of this element. - * - * @return Constraint[] A list of Constraint instances - */ - public function getConstraints(); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/PropertyMetadata.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/PropertyMetadata.php deleted file mode 100644 index 7319294..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/PropertyMetadata.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping; - -use Symfony\Component\Validator\Exception\ValidatorException; - -/** - * Stores all metadata needed for validating a class property. - * - * The value of the property is obtained by directly accessing the property. - * The property will be accessed by reflection, so the access of private and - * protected properties is supported. - * - * This class supports serialization and cloning. - * - * @author Bernhard Schussek - * - * @see PropertyMetadataInterface - */ -class PropertyMetadata extends MemberMetadata -{ - /** - * Constructor. - * - * @param string $class The class this property is defined on - * @param string $name The name of this property - * - * @throws ValidatorException - */ - public function __construct($class, $name) - { - if (!property_exists($class, $name)) { - throw new ValidatorException(sprintf('Property %s does not exist in class %s', $name, $class)); - } - - parent::__construct($class, $name, $name); - } - - /** - * {@inheritdoc} - */ - public function getPropertyValue($object) - { - return $this->getReflectionMember($object)->getValue($object); - } - - /** - * {@inheritdoc} - */ - protected function newReflectionMember($objectOrClassName) - { - $class = new \ReflectionClass($objectOrClassName); - while (!$class->hasProperty($this->getName())) { - $class = $class->getParentClass(); - } - - $member = new \ReflectionProperty($class->getName(), $this->getName()); - $member->setAccessible(true); - - return $member; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/PropertyMetadataInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/PropertyMetadataInterface.php deleted file mode 100644 index 79e2c79..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/PropertyMetadataInterface.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping; - -use Symfony\Component\Validator\ClassBasedInterface; -use Symfony\Component\Validator\PropertyMetadataInterface as LegacyPropertyMetadataInterface; - -/** - * Stores all metadata needed for validating the value of a class property. - * - * Most importantly, the metadata stores the constraints against which the - * property's value should be validated. - * - * Additionally, the metadata stores whether objects stored in the property - * should be validated against their class' metadata and whether traversable - * objects should be traversed or not. - * - * @since 2.5 - * @author Bernhard Schussek - * - * @see MetadataInterface - * @see CascadingStrategy - * @see TraversalStrategy - */ -interface PropertyMetadataInterface extends MetadataInterface, LegacyPropertyMetadataInterface, ClassBasedInterface -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/TraversalStrategy.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/TraversalStrategy.php deleted file mode 100644 index 5122c47..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/TraversalStrategy.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Mapping; - -/** - * Specifies whether and how a traversable object should be traversed. - * - * If the node traverser traverses a node whose value is an instance of - * {@link \Traversable}, and if that node is either a class node or if - * cascading is enabled, then the node's traversal strategy will be checked. - * Depending on the requested traversal strategy, the node traverser will - * iterate over the object and cascade each object or collection returned by - * the iterator. - * - * The traversal strategy is ignored for arrays. Arrays are always iterated. - * - * @since 2.1 - * @author Bernhard Schussek - * - * @see CascadingStrategy - */ -class TraversalStrategy -{ - /** - * Specifies that a node's value should be iterated only if it is an - * instance of {@link \Traversable}. - */ - const IMPLICIT = 1; - - /** - * Specifies that a node's value should never be iterated. - */ - const NONE = 2; - - /** - * Specifies that a node's value should always be iterated. If the value is - * not an instance of {@link \Traversable}, an exception should be thrown. - */ - const TRAVERSE = 4; - - /** - * Specifies that nested instances of {@link \Traversable} should never be - * iterated. Can be combined with {@link IMPLICIT} or {@link TRAVERSE}. - * - * @deprecated This constant was added for backwards compatibility only. - * It will be removed in Symfony 3.0. - * @internal - */ - const STOP_RECURSION = 8; - - /** - * Not instantiable. - */ - private function __construct() - { - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/MetadataFactoryInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/MetadataFactoryInterface.php deleted file mode 100644 index 4c0cbad..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/MetadataFactoryInterface.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -/** - * Returns {@link MetadataInterface} instances for values. - * - * @author Bernhard Schussek - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link Mapping\Factory\MetadataFactoryInterface} instead. - */ -interface MetadataFactoryInterface -{ - /** - * Returns the metadata for the given value. - * - * @param mixed $value Some value - * - * @return MetadataInterface The metadata for the value - * - * @throws Exception\NoSuchMetadataException If no metadata exists for the given value - */ - public function getMetadataFor($value); - - /** - * Returns whether the class is able to return metadata for the given value. - * - * @param mixed $value Some value - * - * @return bool Whether metadata can be returned for that value - */ - public function hasMetadataFor($value); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/MetadataInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/MetadataInterface.php deleted file mode 100644 index 60abfeb..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/MetadataInterface.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -/** - * A container for validation metadata. - * - * The container contains constraints that may belong to different validation - * groups. Constraints for a specific group can be fetched by calling - * {@link findConstraints}. - * - * Implement this interface to add validation metadata to your own metadata - * layer. Each metadata may have named properties. Each property can be - * represented by one or more {@link PropertyMetadataInterface} instances that - * are returned by {@link getPropertyMetadata}. Since - * PropertyMetadataInterface inherits from MetadataInterface, - * each property may be divided into further properties. - * - * The {@link accept} method of each metadata implements the Visitor pattern. - * The method should forward the call to the visitor's - * {@link ValidationVisitorInterface::visit} method and additionally call - * accept() on all structurally related metadata instances. - * - * For example, to store constraints for PHP classes and their properties, - * create a class ClassMetadata (implementing MetadataInterface) - * and a class PropertyMetadata (implementing PropertyMetadataInterface). - * ClassMetadata::getPropertyMetadata($property) returns all - * PropertyMetadata instances for a property of that class. Its - * accept()-method simply forwards to ValidationVisitorInterface::visit() - * and calls accept() on all contained PropertyMetadata - * instances, which themselves call ValidationVisitorInterface::visit() - * again. - * - * @author Bernhard Schussek - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link Mapping\MetadataInterface} instead. - */ -interface MetadataInterface -{ - /** - * Implementation of the Visitor design pattern. - * - * Calls {@link ValidationVisitorInterface::visit} and then forwards the - * accept()-call to all property metadata instances. - * - * @param ValidationVisitorInterface $visitor The visitor implementing the validation logic - * @param mixed $value The value to validate - * @param string|string[] $group The validation group to validate in - * @param string $propertyPath The current property path in the validation graph - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - */ - public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath); - - /** - * Returns all constraints for a given validation group. - * - * @param string $group The validation group - * - * @return Constraint[] A list of constraint instances - */ - public function findConstraints($group); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/ObjectInitializerInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/ObjectInitializerInterface.php deleted file mode 100644 index 0426bc8..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/ObjectInitializerInterface.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -/** - * Prepares an object for validation. - * - * Concrete implementations of this interface are used by {@link ValidationVisitorInterface} - * to initialize objects just before validating them. - * - * @author Fabien Potencier - * @author Bernhard Schussek - * - * @api - */ -interface ObjectInitializerInterface -{ - /** - * Initializes an object just before validation. - * - * @param object $object The object to validate - * - * @api - */ - public function initialize($object); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/PropertyMetadataContainerInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/PropertyMetadataContainerInterface.php deleted file mode 100644 index 91b286a..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/PropertyMetadataContainerInterface.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -/** - * A container for {@link PropertyMetadataInterface} instances. - * - * @author Bernhard Schussek - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link Mapping\ClassMetadataInterface} instead. - */ -interface PropertyMetadataContainerInterface -{ - /** - * Check if there's any metadata attached to the given named property. - * - * @param string $property The property name. - * - * @return bool - */ - public function hasPropertyMetadata($property); - - /** - * Returns all metadata instances for the given named property. - * - * If your implementation does not support properties, simply throw an - * exception in this method (for example a BadMethodCallException). - * - * @param string $property The property name. - * - * @return PropertyMetadataInterface[] A list of metadata instances. Empty if - * no metadata exists for the property. - */ - public function getPropertyMetadata($property); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/PropertyMetadataInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/PropertyMetadataInterface.php deleted file mode 100644 index c18ae83..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/PropertyMetadataInterface.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -/** - * A container for validation metadata of a property. - * - * What exactly you define as "property" is up to you. The validator expects - * implementations of {@link MetadataInterface} that contain constraints and - * optionally a list of named properties that also have constraints (and may - * have further sub properties). Such properties are mapped by implementations - * of this interface. - * - * @author Bernhard Schussek - * - * @see MetadataInterface - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link Mapping\PropertyMetadataInterface} instead. - */ -interface PropertyMetadataInterface extends MetadataInterface -{ - /** - * Returns the name of the property. - * - * @return string The property name. - */ - public function getPropertyName(); - - /** - * Extracts the value of the property from the given container. - * - * @param mixed $containingValue The container to extract the property value from. - * - * @return mixed The value of the property. - */ - public function getPropertyValue($containingValue); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/README.md b/core/vendor/symfony/validator/Symfony/Component/Validator/README.md deleted file mode 100644 index f6891ff..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/README.md +++ /dev/null @@ -1,126 +0,0 @@ -Validator Component -=================== - -This component is based on the JSR-303 Bean Validation specification and -enables specifying validation rules for classes using XML, YAML, PHP or -annotations, which can then be checked against instances of these classes. - -Usage ------ - -The component provides "validation constraints", which are simple objects -containing the rules for the validation. Let's validate a simple string -as an example: - -```php -use Symfony\Component\Validator\Validation; -use Symfony\Component\Validator\Constraints\Length; - -$validator = Validation::createValidator(); - -$violations = $validator->validateValue('Bernhard', new Length(array('min' => 10))); -``` - -This validation will fail because the given string is shorter than ten -characters. The precise errors, here called "constraint violations", are -returned by the validator. You can analyze these or return them to the user. -If the violation list is empty, validation succeeded. - -Validation of arrays is possible using the `Collection` constraint: - -```php -use Symfony\Component\Validator\Validation; -use Symfony\Component\Validator\Constraints as Assert; - -$validator = Validation::createValidator(); - -$constraint = new Assert\Collection(array( - 'name' => new Assert\Collection(array( - 'first_name' => new Assert\Length(array('min' => 101)), - 'last_name' => new Assert\Length(array('min' => 1)), - )), - 'email' => new Assert\Email(), - 'simple' => new Assert\Length(array('min' => 102)), - 'gender' => new Assert\Choice(array(3, 4)), - 'file' => new Assert\File(), - 'password' => new Assert\Length(array('min' => 60)), -)); - -$violations = $validator->validateValue($input, $constraint); -``` - -Again, the validator returns the list of violations. - -Validation of objects is possible using "constraint mapping". With such -a mapping you can put constraints onto properties and objects of classes. -Whenever an object of this class is validated, its properties and -method results are matched against the constraints. - -```php -use Symfony\Component\Validator\Validation; -use Symfony\Component\Validator\Constraints as Assert; - -class User -{ - /** - * @Assert\Length(min = 3) - * @Assert\NotBlank - */ - private $name; - - /** - * @Assert\Email - * @Assert\NotBlank - */ - private $email; - - public function __construct($name, $email) - { - $this->name = $name; - $this->email = $email; - } - - /** - * @Assert\True(message = "The user should have a Google Mail account") - */ - public function isGmailUser() - { - return false !== strpos($this->email, '@gmail.com'); - } -} - -$validator = Validation::createValidatorBuilder() - ->enableAnnotationMapping() - ->getValidator(); - -$user = new User('John Doe', 'john@example.com'); - -$violations = $validator->validate($user); -``` - -This example uses the annotation support of Doctrine Common to -map constraints to properties and methods. You can also map constraints -using XML, YAML or plain PHP, if you dislike annotations or don't want -to include Doctrine. Check the documentation for more information about -these drivers. - -Resources ---------- - -Silex integration: - -https://github.com/fabpot/Silex/blob/master/src/Silex/Provider/ValidatorServiceProvider.php - -Documentation: - -http://symfony.com/doc/2.6/book/validation.html - -JSR-303 Specification: - -http://jcp.org/en/jsr/detail?id=303 - -You can run the unit tests with the following command: - - $ cd path/to/Symfony/Component/Validator/ - $ composer install - $ phpunit diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/ConstraintTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/ConstraintTest.php deleted file mode 100644 index f63570c..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/ConstraintTest.php +++ /dev/null @@ -1,209 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Tests\Fixtures\ClassConstraint; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintB; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintC; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintWithValue; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintWithValueAsDefault; - -class ConstraintTest extends \PHPUnit_Framework_TestCase -{ - public function testSetProperties() - { - $constraint = new ConstraintA(array( - 'property1' => 'foo', - 'property2' => 'bar', - )); - - $this->assertEquals('foo', $constraint->property1); - $this->assertEquals('bar', $constraint->property2); - } - - public function testSetNotExistingPropertyThrowsException() - { - $this->setExpectedException('Symfony\Component\Validator\Exception\InvalidOptionsException'); - - new ConstraintA(array( - 'foo' => 'bar', - )); - } - - public function testMagicPropertiesAreNotAllowed() - { - $constraint = new ConstraintA(); - - $this->setExpectedException('Symfony\Component\Validator\Exception\InvalidOptionsException'); - - $constraint->foo = 'bar'; - } - - public function testInvalidAndRequiredOptionsPassed() - { - $this->setExpectedException('Symfony\Component\Validator\Exception\InvalidOptionsException'); - - new ConstraintC(array( - 'option1' => 'default', - 'foo' => 'bar', - )); - } - - public function testSetDefaultProperty() - { - $constraint = new ConstraintA('foo'); - - $this->assertEquals('foo', $constraint->property2); - } - - public function testSetDefaultPropertyDoctrineStyle() - { - $constraint = new ConstraintA(array('value' => 'foo')); - - $this->assertEquals('foo', $constraint->property2); - } - - public function testSetDefaultPropertyDoctrineStylePlusOtherProperty() - { - $constraint = new ConstraintA(array('value' => 'foo', 'property1' => 'bar')); - - $this->assertEquals('foo', $constraint->property2); - $this->assertEquals('bar', $constraint->property1); - } - - public function testSetDefaultPropertyDoctrineStyleWhenDefaultPropertyIsNamedValue() - { - $constraint = new ConstraintWithValueAsDefault(array('value' => 'foo')); - - $this->assertEquals('foo', $constraint->value); - $this->assertNull($constraint->property); - } - - public function testDontSetDefaultPropertyIfValuePropertyExists() - { - $constraint = new ConstraintWithValue(array('value' => 'foo')); - - $this->assertEquals('foo', $constraint->value); - $this->assertNull($constraint->property); - } - - public function testSetUndefinedDefaultProperty() - { - $this->setExpectedException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); - - new ConstraintB('foo'); - } - - public function testRequiredOptionsMustBeDefined() - { - $this->setExpectedException('Symfony\Component\Validator\Exception\MissingOptionsException'); - - new ConstraintC(); - } - - public function testRequiredOptionsPassed() - { - new ConstraintC(array('option1' => 'default')); - } - - public function testGroupsAreConvertedToArray() - { - $constraint = new ConstraintA(array('groups' => 'Foo')); - - $this->assertEquals(array('Foo'), $constraint->groups); - } - - public function testAddDefaultGroupAddsGroup() - { - $constraint = new ConstraintA(array('groups' => 'Default')); - $constraint->addImplicitGroupName('Foo'); - $this->assertEquals(array('Default', 'Foo'), $constraint->groups); - } - - public function testAllowsSettingZeroRequiredPropertyValue() - { - $constraint = new ConstraintA(0); - $this->assertEquals(0, $constraint->property2); - } - - public function testCanCreateConstraintWithNoDefaultOptionAndEmptyArray() - { - new ConstraintB(array()); - } - - public function testGetTargetsCanBeString() - { - $constraint = new ClassConstraint(); - - $this->assertEquals('class', $constraint->getTargets()); - } - - public function testGetTargetsCanBeArray() - { - $constraint = new ConstraintA(); - - $this->assertEquals(array('property', 'class'), $constraint->getTargets()); - } - - public function testSerialize() - { - $constraint = new ConstraintA(array( - 'property1' => 'foo', - 'property2' => 'bar', - )); - - $restoredConstraint = unserialize(serialize($constraint)); - - $this->assertEquals($constraint, $restoredConstraint); - } - - public function testSerializeInitializesGroupsOptionToDefault() - { - $constraint = new ConstraintA(array( - 'property1' => 'foo', - 'property2' => 'bar', - )); - - $constraint = unserialize(serialize($constraint)); - - $expected = new ConstraintA(array( - 'property1' => 'foo', - 'property2' => 'bar', - 'groups' => 'Default', - )); - - $this->assertEquals($expected, $constraint); - } - - public function testSerializeKeepsCustomGroups() - { - $constraint = new ConstraintA(array( - 'property1' => 'foo', - 'property2' => 'bar', - 'groups' => 'MyGroup', - )); - - $constraint = unserialize(serialize($constraint)); - - $this->assertSame(array('MyGroup'), $constraint->groups); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\InvalidArgumentException - */ - public function testGetErrorNameForUnknownCode() - { - Constraint::getErrorName(1); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php deleted file mode 100644 index 30d7ff0..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php +++ /dev/null @@ -1,134 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests; - -use Symfony\Component\Validator\ConstraintViolation; -use Symfony\Component\Validator\ConstraintViolationList; - -class ConstraintViolationListTest extends \PHPUnit_Framework_TestCase -{ - protected $list; - - protected function setUp() - { - $this->list = new ConstraintViolationList(); - } - - protected function tearDown() - { - $this->list = null; - } - - public function testInit() - { - $this->assertCount(0, $this->list); - } - - public function testInitWithViolations() - { - $violation = $this->getViolation('Error'); - $this->list = new ConstraintViolationList(array($violation)); - - $this->assertCount(1, $this->list); - $this->assertSame($violation, $this->list[0]); - } - - public function testAdd() - { - $violation = $this->getViolation('Error'); - $this->list->add($violation); - - $this->assertCount(1, $this->list); - $this->assertSame($violation, $this->list[0]); - } - - public function testAddAll() - { - $violations = array( - 10 => $this->getViolation('Error 1'), - 20 => $this->getViolation('Error 2'), - 30 => $this->getViolation('Error 3'), - ); - $otherList = new ConstraintViolationList($violations); - $this->list->addAll($otherList); - - $this->assertCount(3, $this->list); - - $this->assertSame($violations[10], $this->list[0]); - $this->assertSame($violations[20], $this->list[1]); - $this->assertSame($violations[30], $this->list[2]); - } - - public function testIterator() - { - $violations = array( - 10 => $this->getViolation('Error 1'), - 20 => $this->getViolation('Error 2'), - 30 => $this->getViolation('Error 3'), - ); - - $this->list = new ConstraintViolationList($violations); - - // indices are reset upon adding -> array_values() - $this->assertSame(array_values($violations), iterator_to_array($this->list)); - } - - public function testArrayAccess() - { - $violation = $this->getViolation('Error'); - $this->list[] = $violation; - - $this->assertSame($violation, $this->list[0]); - $this->assertTrue(isset($this->list[0])); - - unset($this->list[0]); - - $this->assertFalse(isset($this->list[0])); - - $this->list[10] = $violation; - - $this->assertSame($violation, $this->list[10]); - $this->assertTrue(isset($this->list[10])); - } - - public function testToString() - { - $this->list = new ConstraintViolationList(array( - $this->getViolation('Error 1', 'Root'), - $this->getViolation('Error 2', 'Root', 'foo.bar'), - $this->getViolation('Error 3', 'Root', '[baz]'), - $this->getViolation('Error 4', '', 'foo.bar'), - $this->getViolation('Error 5', '', '[baz]'), - )); - - $expected = <<assertEquals($expected, (string) $this->list); - } - - protected function getViolation($message, $root = null, $propertyPath = null) - { - return new ConstraintViolation($message, $message, array(), $root, $propertyPath, null); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/ConstraintViolationTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/ConstraintViolationTest.php deleted file mode 100644 index 2ceb016..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/ConstraintViolationTest.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests; - -use Symfony\Component\Validator\ConstraintViolation; - -class ConstraintViolationTest extends \PHPUnit_Framework_TestCase -{ - public function testToStringHandlesArrays() - { - $violation = new ConstraintViolation( - 'Array', - '{{ value }}', - array('{{ value }}' => array(1, 2, 3)), - 'Root', - 'property.path', - null - ); - - $expected = <<assertSame($expected, (string) $violation); - } - - public function testToStringHandlesArrayRoots() - { - $violation = new ConstraintViolation( - '42 cannot be used here', - 'this is the message template', - array(), - array('some_value' => 42), - 'some_value', - null - ); - - $expected = <<assertSame($expected, (string) $violation); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php deleted file mode 100644 index 4013fd4..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php +++ /dev/null @@ -1,173 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Intl\Util\IntlTestHelper; -use Symfony\Component\Validator\Constraint; - -class ComparisonTest_Class -{ - protected $value; - - public function __construct($value) - { - $this->value = $value; - } - - public function __toString() - { - return (string) $this->value; - } -} - -/** - * @author Daniel Holmes - */ -abstract class AbstractComparisonValidatorTestCase extends AbstractConstraintValidatorTest -{ - protected static function addPhp5Dot5Comparisons(array $comparisons) - { - if (version_compare(PHP_VERSION, '5.5.0-dev', '<')) { - return $comparisons; - } - - $result = $comparisons; - - // Duplicate all tests involving DateTime objects to be tested with - // DateTimeImmutable objects as well - foreach ($comparisons as $comparison) { - $add = false; - - foreach ($comparison as $i => $value) { - if ($value instanceof \DateTime) { - $comparison[$i] = new \DateTimeImmutable( - $value->format('Y-m-d H:i:s.u e'), - $value->getTimezone() - ); - $add = true; - } elseif ('DateTime' === $value) { - $comparison[$i] = 'DateTimeImmutable'; - $add = true; - } - } - - if ($add) { - $result[] = $comparison; - } - } - - return $result; - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testThrowsConstraintExceptionIfNoValueOrProperty() - { - $comparison = $this->createConstraint(array()); - - $this->validator->validate('some value', $comparison); - } - - /** - * @dataProvider provideAllValidComparisons - * - * @param mixed $dirtyValue - * @param mixed $comparisonValue - */ - public function testValidComparisonToValue($dirtyValue, $comparisonValue) - { - $constraint = $this->createConstraint(array('value' => $comparisonValue)); - - $this->validator->validate($dirtyValue, $constraint); - - $this->assertNoViolation(); - } - - /** - * @return array - */ - public function provideAllValidComparisons() - { - // The provider runs before setUp(), so we need to manually fix - // the default timezone - $this->setDefaultTimezone('UTC'); - - $comparisons = self::addPhp5Dot5Comparisons($this->provideValidComparisons()); - - $this->restoreDefaultTimezone(); - - return $comparisons; - } - - /** - * @return array - */ - abstract public function provideValidComparisons(); - - /** - * @dataProvider provideAllInvalidComparisons - * - * @param mixed $dirtyValue - * @param mixed $dirtyValueAsString - * @param mixed $comparedValue - * @param mixed $comparedValueString - * @param string $comparedValueType - */ - public function testInvalidComparisonToValue($dirtyValue, $dirtyValueAsString, $comparedValue, $comparedValueString, $comparedValueType) - { - // Conversion of dates to string differs between ICU versions - // Make sure we have the correct version loaded - if ($dirtyValue instanceof \DateTime || $dirtyValue instanceof \DateTimeInterface) { - IntlTestHelper::requireIntl($this); - } - - $constraint = $this->createConstraint(array('value' => $comparedValue)); - $constraint->message = 'Constraint Message'; - - $this->validator->validate($dirtyValue, $constraint); - - $this->buildViolation('Constraint Message') - ->setParameter('{{ value }}', $dirtyValueAsString) - ->setParameter('{{ compared_value }}', $comparedValueString) - ->setParameter('{{ compared_value_type }}', $comparedValueType) - ->assertRaised(); - } - - /** - * @return array - */ - public function provideAllInvalidComparisons() - { - // The provider runs before setUp(), so we need to manually fix - // the default timezone - $this->setDefaultTimezone('UTC'); - - $comparisons = self::addPhp5Dot5Comparisons($this->provideInvalidComparisons()); - - $this->restoreDefaultTimezone(); - - return $comparisons; - } - - /** - * @return array - */ - abstract public function provideInvalidComparisons(); - - /** - * @param array $options Options for the constraint - * - * @return Constraint - */ - abstract protected function createConstraint(array $options); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php deleted file mode 100644 index d55e464..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php +++ /dev/null @@ -1,545 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Constraints\NotNull; -use Symfony\Component\Validator\ConstraintValidatorInterface; -use Symfony\Component\Validator\ConstraintViolation; -use Symfony\Component\Validator\Context\ExecutionContext; -use Symfony\Component\Validator\Context\ExecutionContextInterface; -use Symfony\Component\Validator\Context\LegacyExecutionContext; -use Symfony\Component\Validator\ExecutionContextInterface as LegacyExecutionContextInterface; -use Symfony\Component\Validator\Mapping\ClassMetadata; -use Symfony\Component\Validator\Mapping\PropertyMetadata; -use Symfony\Component\Validator\Tests\Fixtures\StubGlobalExecutionContext; -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * - * @author Bernhard Schussek - */ -abstract class AbstractConstraintValidatorTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var ExecutionContextInterface - */ - protected $context; - - /** - * @var ConstraintValidatorInterface - */ - protected $validator; - - protected $group; - - protected $metadata; - - protected $object; - - protected $value; - - protected $root; - - protected $propertyPath; - - protected $constraint; - - protected $defaultTimezone; - - protected function setUp() - { - if (Validation::API_VERSION_2_5 !== $this->getApiVersion()) { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - } - - $this->group = 'MyGroup'; - $this->metadata = null; - $this->object = null; - $this->value = 'InvalidValue'; - $this->root = 'root'; - $this->propertyPath = 'property.path'; - - // Initialize the context with some constraint so that we can - // successfully build a violation. - // The 2.4 API does not keep a reference to the current - // constraint yet. There the violation stores null. - $this->constraint = Validation::API_VERSION_2_4 === $this->getApiVersion() - ? null - : new NotNull(); - - $this->context = $this->createContext(); - $this->validator = $this->createValidator(); - $this->validator->initialize($this->context); - - \Locale::setDefault('en'); - - $this->setDefaultTimezone('UTC'); - } - - protected function tearDown() - { - $this->restoreDefaultTimezone(); - } - - protected function setDefaultTimezone($defaultTimezone) - { - // Make sure this method can not be called twice before calling - // also restoreDefaultTimezone() - if (null === $this->defaultTimezone) { - $this->defaultTimezone = date_default_timezone_get(); - date_default_timezone_set($defaultTimezone); - } - } - - protected function restoreDefaultTimezone() - { - if (null !== $this->defaultTimezone) { - date_default_timezone_set($this->defaultTimezone); - $this->defaultTimezone = null; - } - } - - protected function createContext() - { - $translator = $this->getMock('Symfony\Component\Translation\TranslatorInterface'); - - if (Validation::API_VERSION_2_4 === $this->getApiVersion()) { - return $this->getMockBuilder('Symfony\Component\Validator\ExecutionContext') - ->setConstructorArgs(array( - new StubGlobalExecutionContext($this->root), - $translator, - null, - $this->metadata, - $this->value, - $this->group, - $this->propertyPath, - )) - ->setMethods(array('validate', 'validateValue')) - ->getMock(); - } - - $validator = $this->getMock('Symfony\Component\Validator\Validator\ValidatorInterface'); - $contextualValidator = $this->getMock('Symfony\Component\Validator\Validator\ContextualValidatorInterface'); - - switch ($this->getApiVersion()) { - case Validation::API_VERSION_2_5: - $context = new ExecutionContext( - $validator, - $this->root, - $translator - ); - break; - case Validation::API_VERSION_2_5_BC: - $context = new LegacyExecutionContext( - $validator, - $this->root, - $this->getMock('Symfony\Component\Validator\MetadataFactoryInterface'), - $translator - ); - break; - default: - throw new \RuntimeException('Invalid API version'); - } - - $context->setGroup($this->group); - $context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath); - $context->setConstraint($this->constraint); - - $validator->expects($this->any()) - ->method('inContext') - ->with($context) - ->will($this->returnValue($contextualValidator)); - - return $context; - } - - /** - * @param mixed $message - * @param array $parameters - * @param string $propertyPath - * @param string $invalidValue - * @param null $plural - * @param null $code - * - * @return ConstraintViolation - * - * @deprecated To be removed in Symfony 3.0. Use - * {@link buildViolation()} instead. - */ - protected function createViolation($message, array $parameters = array(), $propertyPath = 'property.path', $invalidValue = 'InvalidValue', $plural = null, $code = null) - { - return new ConstraintViolation( - null, - $message, - $parameters, - $this->root, - $propertyPath, - $invalidValue, - $plural, - $code, - $this->constraint - ); - } - - protected function setGroup($group) - { - $this->group = $group; - - switch ($this->getApiVersion()) { - case Validation::API_VERSION_2_4: - $this->context = $this->createContext(); - $this->validator->initialize($this->context); - break; - case Validation::API_VERSION_2_5: - case Validation::API_VERSION_2_5_BC: - $this->context->setGroup($group); - break; - } - } - - protected function setObject($object) - { - $this->object = $object; - $this->metadata = is_object($object) - ? new ClassMetadata(get_class($object)) - : null; - - switch ($this->getApiVersion()) { - case Validation::API_VERSION_2_4: - $this->context = $this->createContext(); - $this->validator->initialize($this->context); - break; - case Validation::API_VERSION_2_5: - case Validation::API_VERSION_2_5_BC: - $this->context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath); - break; - } - } - - protected function setProperty($object, $property) - { - $this->object = $object; - $this->metadata = is_object($object) - ? new PropertyMetadata(get_class($object), $property) - : null; - - switch ($this->getApiVersion()) { - case Validation::API_VERSION_2_4: - $this->context = $this->createContext(); - $this->validator->initialize($this->context); - break; - case Validation::API_VERSION_2_5: - case Validation::API_VERSION_2_5_BC: - $this->context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath); - break; - } - } - - protected function setValue($value) - { - $this->value = $value; - - switch ($this->getApiVersion()) { - case Validation::API_VERSION_2_4: - $this->context = $this->createContext(); - $this->validator->initialize($this->context); - break; - case Validation::API_VERSION_2_5: - case Validation::API_VERSION_2_5_BC: - $this->context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath); - break; - } - } - - protected function setRoot($root) - { - $this->root = $root; - $this->context = $this->createContext(); - $this->validator->initialize($this->context); - } - - protected function setPropertyPath($propertyPath) - { - $this->propertyPath = $propertyPath; - - switch ($this->getApiVersion()) { - case Validation::API_VERSION_2_4: - $this->context = $this->createContext(); - $this->validator->initialize($this->context); - break; - case Validation::API_VERSION_2_5: - case Validation::API_VERSION_2_5_BC: - $this->context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath); - break; - } - } - - protected function expectNoValidate() - { - switch ($this->getApiVersion()) { - case Validation::API_VERSION_2_4: - $this->context->expects($this->never()) - ->method('validate'); - $this->context->expects($this->never()) - ->method('validateValue'); - break; - case Validation::API_VERSION_2_5: - case Validation::API_VERSION_2_5_BC: - $validator = $this->context->getValidator()->inContext($this->context); - $validator->expects($this->never()) - ->method('atPath'); - $validator->expects($this->never()) - ->method('validate'); - break; - } - } - - protected function expectValidateAt($i, $propertyPath, $value, $group) - { - switch ($this->getApiVersion()) { - case Validation::API_VERSION_2_4: - $this->context->expects($this->at($i)) - ->method('validate') - ->with($value, $propertyPath, $group); - break; - case Validation::API_VERSION_2_5: - case Validation::API_VERSION_2_5_BC: - $validator = $this->context->getValidator()->inContext($this->context); - $validator->expects($this->at(2 * $i)) - ->method('atPath') - ->with($propertyPath) - ->will($this->returnValue($validator)); - $validator->expects($this->at(2 * $i + 1)) - ->method('validate') - ->with($value, $this->logicalOr(null, array()), $group); - break; - } - } - - protected function expectValidateValueAt($i, $propertyPath, $value, $constraints, $group = null) - { - switch ($this->getApiVersion()) { - case Validation::API_VERSION_2_4: - $this->context->expects($this->at($i)) - ->method('validateValue') - ->with($value, $constraints, $propertyPath, $group); - break; - case Validation::API_VERSION_2_5: - case Validation::API_VERSION_2_5_BC: - $contextualValidator = $this->context->getValidator()->inContext($this->context); - $contextualValidator->expects($this->at(2 * $i)) - ->method('atPath') - ->with($propertyPath) - ->will($this->returnValue($contextualValidator)); - $contextualValidator->expects($this->at(2 * $i + 1)) - ->method('validate') - ->with($value, $constraints, $group); - break; - } - } - - protected function assertNoViolation() - { - $this->assertCount(0, $this->context->getViolations()); - } - - /** - * @param mixed $message - * @param array $parameters - * @param string $propertyPath - * @param string $invalidValue - * @param null $plural - * @param null $code - * - * @deprecated To be removed in Symfony 3.0. Use - * {@link buildViolation()} instead. - */ - protected function assertViolation($message, array $parameters = array(), $propertyPath = 'property.path', $invalidValue = 'InvalidValue', $plural = null, $code = null) - { - $this->buildViolation($message) - ->setParameters($parameters) - ->atPath($propertyPath) - ->setInvalidValue($invalidValue) - ->setCode($code) - ->setPlural($plural) - ->assertRaised(); - } - - /** - * @param array $expected - * - * @deprecated To be removed in Symfony 3.0. Use - * {@link buildViolation()} instead. - */ - protected function assertViolations(array $expected) - { - $violations = $this->context->getViolations(); - - $this->assertCount(count($expected), $violations); - - $i = 0; - - foreach ($expected as $violation) { - $this->assertEquals($violation, $violations[$i++]); - } - } - - /** - * @param $message - * - * @return ConstraintViolationAssertion - */ - protected function buildViolation($message) - { - return new ConstraintViolationAssertion($this->context, $message, $this->constraint); - } - - abstract protected function getApiVersion(); - - abstract protected function createValidator(); -} - -/** - * @internal - */ -class ConstraintViolationAssertion -{ - /** - * @var LegacyExecutionContextInterface - */ - private $context; - - /** - * @var ConstraintViolationAssertion[] - */ - private $assertions; - - private $message; - private $parameters = array(); - private $invalidValue = 'InvalidValue'; - private $propertyPath = 'property.path'; - private $translationDomain; - private $plural; - private $code; - private $constraint; - private $cause; - - public function __construct(LegacyExecutionContextInterface $context, $message, Constraint $constraint = null, array $assertions = array()) - { - $this->context = $context; - $this->message = $message; - $this->constraint = $constraint; - $this->assertions = $assertions; - } - - public function atPath($path) - { - $this->propertyPath = $path; - - return $this; - } - - public function setParameter($key, $value) - { - $this->parameters[$key] = $value; - - return $this; - } - - public function setParameters(array $parameters) - { - $this->parameters = $parameters; - - return $this; - } - - public function setTranslationDomain($translationDomain) - { - $this->translationDomain = $translationDomain; - - return $this; - } - - public function setInvalidValue($invalidValue) - { - $this->invalidValue = $invalidValue; - - return $this; - } - - public function setPlural($number) - { - $this->plural = $number; - - return $this; - } - - public function setCode($code) - { - $this->code = $code; - - return $this; - } - - public function setCause($cause) - { - $this->cause = $cause; - - return $this; - } - - public function buildNextViolation($message) - { - $assertions = $this->assertions; - $assertions[] = $this; - - return new self($this->context, $message, $this->constraint, $assertions); - } - - public function assertRaised() - { - $expected = array(); - foreach ($this->assertions as $assertion) { - $expected[] = $assertion->getViolation(); - } - $expected[] = $this->getViolation(); - - $violations = iterator_to_array($this->context->getViolations()); - - \PHPUnit_Framework_Assert::assertCount(count($expected), $violations); - - reset($violations); - - foreach ($expected as $violation) { - \PHPUnit_Framework_Assert::assertEquals($violation, current($violations)); - next($violations); - } - } - - private function getViolation() - { - return new ConstraintViolation( - null, - $this->message, - $this->parameters, - $this->context->getRoot(), - $this->propertyPath, - $this->invalidValue, - $this->plural, - $this->code, - $this->constraint, - $this->cause - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/AllTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/AllTest.php deleted file mode 100644 index 36b5198..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/AllTest.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\All; -use Symfony\Component\Validator\Constraints\Valid; - -/** - * @author Bernhard Schussek - */ -class AllTest extends \PHPUnit_Framework_TestCase -{ - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testRejectNonConstraints() - { - new All(array( - 'foo', - )); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testRejectValidConstraint() - { - new All(array( - new Valid(), - )); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php deleted file mode 100644 index 57dd600..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\All; -use Symfony\Component\Validator\Constraints\AllValidator; -use Symfony\Component\Validator\Constraints\NotNull; -use Symfony\Component\Validator\Constraints\Range; -use Symfony\Component\Validator\Validation; - -class AllValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new AllValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new All(new Range(array('min' => 4)))); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testThrowsExceptionIfNotTraversable() - { - $this->validator->validate('foo.barbar', new All(new Range(array('min' => 4)))); - } - - /** - * @dataProvider getValidArguments - */ - public function testWalkSingleConstraint($array) - { - $constraint = new Range(array('min' => 4)); - - $i = 0; - - foreach ($array as $key => $value) { - $this->expectValidateValueAt($i++, '['.$key.']', $value, array($constraint)); - } - - $this->validator->validate($array, new All($constraint)); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getValidArguments - */ - public function testWalkMultipleConstraints($array) - { - $constraint1 = new Range(array('min' => 4)); - $constraint2 = new NotNull(); - - $constraints = array($constraint1, $constraint2); - - $i = 0; - - foreach ($array as $key => $value) { - $this->expectValidateValueAt($i++, '['.$key.']', $value, array($constraint1, $constraint2)); - } - - $this->validator->validate($array, new All($constraints)); - - $this->assertNoViolation(); - } - - public function getValidArguments() - { - return array( - array(array(5, 6, 7)), - array(new \ArrayObject(array(5, 6, 7))), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/BlankValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/BlankValidatorTest.php deleted file mode 100644 index a7f3d7d..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/BlankValidatorTest.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Blank; -use Symfony\Component\Validator\Constraints\BlankValidator; -use Symfony\Component\Validator\Validation; - -class BlankValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new BlankValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Blank()); - - $this->assertNoViolation(); - } - - public function testBlankIsValid() - { - $this->validator->validate('', new Blank()); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getInvalidValues - */ - public function testInvalidValues($value, $valueAsString) - { - $constraint = new Blank(array( - 'message' => 'myMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', $valueAsString) - ->assertRaised(); - } - - public function getInvalidValues() - { - return array( - array('foobar', '"foobar"'), - array(0, '0'), - array(false, 'false'), - array(1234, '1234'), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php deleted file mode 100644 index 9bb12a2..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php +++ /dev/null @@ -1,336 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Constraints\Callback; -use Symfony\Component\Validator\Constraints\CallbackValidator; -use Symfony\Component\Validator\ExecutionContextInterface; -use Symfony\Component\Validator\Validation; - -class CallbackValidatorTest_Class -{ - public static function validateCallback($object, ExecutionContextInterface $context) - { - $context->addViolation('Callback message', array('{{ value }}' => 'foobar')); - - return false; - } -} - -class CallbackValidatorTest_Object -{ - public function validate(ExecutionContextInterface $context) - { - $context->addViolation('My message', array('{{ value }}' => 'foobar')); - - return false; - } - - public static function validateStatic($object, ExecutionContextInterface $context) - { - $context->addViolation('Static message', array('{{ value }}' => 'baz')); - - return false; - } -} - -class CallbackValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new CallbackValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Callback(array('foo'))); - - $this->assertNoViolation(); - } - - public function testSingleMethod() - { - $object = new CallbackValidatorTest_Object(); - $constraint = new Callback('validate'); - - $this->validator->validate($object, $constraint); - - $this->buildViolation('My message') - ->setParameter('{{ value }}', 'foobar') - ->assertRaised(); - } - - public function testSingleMethodExplicitName() - { - $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array('callback' => 'validate')); - - $this->validator->validate($object, $constraint); - - $this->buildViolation('My message') - ->setParameter('{{ value }}', 'foobar') - ->assertRaised(); - } - - public function testSingleStaticMethod() - { - $object = new CallbackValidatorTest_Object(); - $constraint = new Callback('validateStatic'); - - $this->validator->validate($object, $constraint); - - $this->buildViolation('Static message') - ->setParameter('{{ value }}', 'baz') - ->assertRaised(); - } - - public function testClosure() - { - $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(function ($object, ExecutionContextInterface $context) { - $context->addViolation('My message', array('{{ value }}' => 'foobar')); - - return false; - }); - - $this->validator->validate($object, $constraint); - - $this->buildViolation('My message') - ->setParameter('{{ value }}', 'foobar') - ->assertRaised(); - } - - public function testClosureNullObject() - { - $constraint = new Callback(function ($object, ExecutionContextInterface $context) { - $context->addViolation('My message', array('{{ value }}' => 'foobar')); - - return false; - }); - - $this->validator->validate(null, $constraint); - - $this->buildViolation('My message') - ->setParameter('{{ value }}', 'foobar') - ->assertRaised(); - } - - public function testClosureExplicitName() - { - $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array( - 'callback' => function ($object, ExecutionContextInterface $context) { - $context->addViolation('My message', array('{{ value }}' => 'foobar')); - - return false; - }, - )); - - $this->validator->validate($object, $constraint); - - $this->buildViolation('My message') - ->setParameter('{{ value }}', 'foobar') - ->assertRaised(); - } - - public function testArrayCallable() - { - $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array(__CLASS__.'_Class', 'validateCallback')); - - $this->validator->validate($object, $constraint); - - $this->buildViolation('Callback message') - ->setParameter('{{ value }}', 'foobar') - ->assertRaised(); - } - - public function testArrayCallableNullObject() - { - $constraint = new Callback(array(__CLASS__.'_Class', 'validateCallback')); - - $this->validator->validate(null, $constraint); - - $this->buildViolation('Callback message') - ->setParameter('{{ value }}', 'foobar') - ->assertRaised(); - } - - public function testArrayCallableExplicitName() - { - $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array( - 'callback' => array(__CLASS__.'_Class', 'validateCallback'), - )); - - $this->validator->validate($object, $constraint); - - $this->buildViolation('Callback message') - ->setParameter('{{ value }}', 'foobar') - ->assertRaised(); - } - - // BC with Symfony < 2.4 - public function testSingleMethodBc() - { - $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array('validate')); - - $this->validator->validate($object, $constraint); - - $this->buildViolation('My message') - ->setParameter('{{ value }}', 'foobar') - ->assertRaised(); - } - - // BC with Symfony < 2.4 - public function testSingleMethodBcExplicitName() - { - $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array('methods' => array('validate'))); - - $this->validator->validate($object, $constraint); - - $this->buildViolation('My message') - ->setParameter('{{ value }}', 'foobar') - ->assertRaised(); - } - - // BC with Symfony < 2.4 - public function testMultipleMethodsBc() - { - $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array('validate', 'validateStatic')); - - $this->validator->validate($object, $constraint); - - $this->buildViolation('My message') - ->setParameter('{{ value }}', 'foobar') - ->buildNextViolation('Static message') - ->setParameter('{{ value }}', 'baz') - ->assertRaised(); - } - - // BC with Symfony < 2.4 - public function testMultipleMethodsBcExplicitName() - { - $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array( - 'methods' => array('validate', 'validateStatic'), - )); - - $this->validator->validate($object, $constraint); - - $this->buildViolation('My message') - ->setParameter('{{ value }}', 'foobar') - ->buildNextViolation('Static message') - ->setParameter('{{ value }}', 'baz') - ->assertRaised(); - } - - // BC with Symfony < 2.4 - public function testSingleStaticMethodBc() - { - $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array( - array(__CLASS__.'_Class', 'validateCallback'), - )); - - $this->validator->validate($object, $constraint); - - $this->buildViolation('Callback message') - ->setParameter('{{ value }}', 'foobar') - ->assertRaised(); - } - - // BC with Symfony < 2.4 - public function testSingleStaticMethodBcExplicitName() - { - $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array( - 'methods' => array(array(__CLASS__.'_Class', 'validateCallback')), - )); - - $this->validator->validate($object, $constraint); - - $this->buildViolation('Callback message') - ->setParameter('{{ value }}', 'foobar') - ->assertRaised(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testExpectValidMethods() - { - $object = new CallbackValidatorTest_Object(); - - $this->validator->validate($object, new Callback(array('foobar'))); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testExpectValidCallbacks() - { - $object = new CallbackValidatorTest_Object(); - - $this->validator->validate($object, new Callback(array(array('foo', 'bar')))); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testExpectEitherCallbackOrMethods() - { - $object = new CallbackValidatorTest_Object(); - - $this->validator->validate($object, new Callback(array( - 'callback' => 'validate', - 'methods' => array('validateStatic'), - ))); - } - - public function testConstraintGetTargets() - { - $constraint = new Callback(array('foo')); - $targets = array(Constraint::CLASS_CONSTRAINT, Constraint::PROPERTY_CONSTRAINT); - - $this->assertEquals($targets, $constraint->getTargets()); - } - - // Should succeed. Needed when defining constraints as annotations. - public function testNoConstructorArguments() - { - new Callback(); - } - - public function testAnnotationInvocationSingleValued() - { - $constraint = new Callback(array('value' => 'validateStatic')); - - $this->assertEquals(new Callback('validateStatic'), $constraint); - } - - public function testAnnotationInvocationMultiValued() - { - $constraint = new Callback(array('value' => array(__CLASS__.'_Class', 'validateCallback'))); - - $this->assertEquals(new Callback(array(__CLASS__.'_Class', 'validateCallback')), $constraint); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php deleted file mode 100644 index aab54e5..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php +++ /dev/null @@ -1,133 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\CardScheme; -use Symfony\Component\Validator\Constraints\CardSchemeValidator; -use Symfony\Component\Validator\Validation; - -class CardSchemeValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new CardSchemeValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new CardScheme(array('schemes' => array()))); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $this->validator->validate('', new CardScheme(array('schemes' => array()))); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getValidNumbers - */ - public function testValidNumbers($scheme, $number) - { - $this->validator->validate($number, new CardScheme(array('schemes' => $scheme))); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getInvalidNumbers - */ - public function testInvalidNumbers($scheme, $number, $code) - { - $constraint = new CardScheme(array( - 'schemes' => $scheme, - 'message' => 'myMessage', - )); - - $this->validator->validate($number, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', is_string($number) ? '"'.$number.'"' : $number) - ->setCode($code) - ->assertRaised(); - } - - public function getValidNumbers() - { - return array( - array('AMEX', '378282246310005'), - array('AMEX', '371449635398431'), - array('AMEX', '378734493671000'), - array('AMEX', '347298508610146'), - array('CHINA_UNIONPAY', '6228888888888888'), - array('CHINA_UNIONPAY', '62288888888888888'), - array('CHINA_UNIONPAY', '622888888888888888'), - array('CHINA_UNIONPAY', '6228888888888888888'), - array('DINERS', '30569309025904'), - array('DINERS', '36088894118515'), - array('DINERS', '38520000023237'), - array('DISCOVER', '6011111111111117'), - array('DISCOVER', '6011000990139424'), - array('INSTAPAYMENT', '6372476031350068'), - array('INSTAPAYMENT', '6385537775789749'), - array('INSTAPAYMENT', '6393440808445746'), - array('JCB', '3530111333300000'), - array('JCB', '3566002020360505'), - array('JCB', '213112345678901'), - array('JCB', '180012345678901'), - array('LASER', '6304678107004080'), - array('LASER', '6706440607428128629'), - array('LASER', '6771656738314582216'), - array('MAESTRO', '6759744069209'), - array('MAESTRO', '5020507657408074712'), - array('MAESTRO', '6759744069209'), - array('MAESTRO', '6759744069209'), - array('MASTERCARD', '5555555555554444'), - array('MASTERCARD', '5105105105105100'), - array('VISA', '4111111111111111'), - array('VISA', '4012888888881881'), - array('VISA', '4222222222222'), - array(array('AMEX', 'VISA'), '4111111111111111'), - array(array('AMEX', 'VISA'), '378282246310005'), - array(array('JCB', 'MASTERCARD'), '5105105105105100'), - array(array('VISA', 'MASTERCARD'), '5105105105105100'), - ); - } - - public function getInvalidNumbers() - { - return array( - array('VISA', '42424242424242424242', CardScheme::INVALID_FORMAT_ERROR), - array('AMEX', '357298508610146', CardScheme::INVALID_FORMAT_ERROR), - array('DINERS', '31569309025904', CardScheme::INVALID_FORMAT_ERROR), - array('DINERS', '37088894118515', CardScheme::INVALID_FORMAT_ERROR), - array('INSTAPAYMENT', '6313440808445746', CardScheme::INVALID_FORMAT_ERROR), - array('CHINA_UNIONPAY', '622888888888888', CardScheme::INVALID_FORMAT_ERROR), - array('CHINA_UNIONPAY', '62288888888888888888', CardScheme::INVALID_FORMAT_ERROR), - array('AMEX', '30569309025904', CardScheme::INVALID_FORMAT_ERROR), // DINERS number - array('AMEX', 'invalid', CardScheme::NOT_NUMERIC_ERROR), // A string - array('AMEX', 0, CardScheme::INVALID_FORMAT_ERROR), // a lone number - array('AMEX', '0', CardScheme::INVALID_FORMAT_ERROR), // a lone number - array('AMEX', '000000000000', CardScheme::INVALID_FORMAT_ERROR), // a lone number - array('DINERS', '3056930', CardScheme::INVALID_FORMAT_ERROR), // only first part of the number - array('DISCOVER', '1117', CardScheme::INVALID_FORMAT_ERROR), // only last 4 digits - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php deleted file mode 100644 index 579d6aa..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php +++ /dev/null @@ -1,287 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Choice; -use Symfony\Component\Validator\Constraints\ChoiceValidator; -use Symfony\Component\Validator\Validation; - -function choice_callback() -{ - return array('foo', 'bar'); -} - -class ChoiceValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new ChoiceValidator(); - } - - public static function staticCallback() - { - return array('foo', 'bar'); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectArrayIfMultipleIsTrue() - { - $constraint = new Choice(array( - 'choices' => array('foo', 'bar'), - 'multiple' => true, - )); - - $this->validator->validate('asdf', $constraint); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Choice(array('choices' => array('foo', 'bar')))); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testChoicesOrCallbackExpected() - { - $this->validator->validate('foobar', new Choice()); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testValidCallbackExpected() - { - $this->validator->validate('foobar', new Choice(array('callback' => 'abcd'))); - } - - public function testValidChoiceArray() - { - $constraint = new Choice(array('choices' => array('foo', 'bar'))); - - $this->validator->validate('bar', $constraint); - - $this->assertNoViolation(); - } - - public function testValidChoiceCallbackFunction() - { - $constraint = new Choice(array('callback' => __NAMESPACE__.'\choice_callback')); - - $this->validator->validate('bar', $constraint); - - $this->assertNoViolation(); - } - - public function testValidChoiceCallbackClosure() - { - $constraint = new Choice(array('callback' => function () { - return array('foo', 'bar'); - })); - - $this->validator->validate('bar', $constraint); - - $this->assertNoViolation(); - } - - public function testValidChoiceCallbackStaticMethod() - { - $constraint = new Choice(array('callback' => array(__CLASS__, 'staticCallback'))); - - $this->validator->validate('bar', $constraint); - - $this->assertNoViolation(); - } - - public function testValidChoiceCallbackContextMethod() - { - // search $this for "staticCallback" - $this->setObject($this); - - $constraint = new Choice(array('callback' => 'staticCallback')); - - $this->validator->validate('bar', $constraint); - - $this->assertNoViolation(); - } - - public function testMultipleChoices() - { - $constraint = new Choice(array( - 'choices' => array('foo', 'bar', 'baz'), - 'multiple' => true, - )); - - $this->validator->validate(array('baz', 'bar'), $constraint); - - $this->assertNoViolation(); - } - - public function testInvalidChoice() - { - $constraint = new Choice(array( - 'choices' => array('foo', 'bar'), - 'message' => 'myMessage', - )); - - $this->validator->validate('baz', $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"baz"') - ->setCode(Choice::NO_SUCH_CHOICE_ERROR) - ->assertRaised(); - } - - public function testInvalidChoiceMultiple() - { - $constraint = new Choice(array( - 'choices' => array('foo', 'bar'), - 'multipleMessage' => 'myMessage', - 'multiple' => true, - )); - - $this->validator->validate(array('foo', 'baz'), $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"baz"') - ->setInvalidValue('baz') - ->setCode(Choice::NO_SUCH_CHOICE_ERROR) - ->assertRaised(); - } - - public function testTooFewChoices() - { - $constraint = new Choice(array( - 'choices' => array('foo', 'bar', 'moo', 'maa'), - 'multiple' => true, - 'min' => 2, - 'minMessage' => 'myMessage', - )); - - $value = array('foo'); - - $this->setValue($value); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ limit }}', 2) - ->setInvalidValue($value) - ->setPlural(2) - ->setCode(Choice::TOO_FEW_ERROR) - ->assertRaised(); - } - - public function testTooManyChoices() - { - $constraint = new Choice(array( - 'choices' => array('foo', 'bar', 'moo', 'maa'), - 'multiple' => true, - 'max' => 2, - 'maxMessage' => 'myMessage', - )); - - $value = array('foo', 'bar', 'moo'); - - $this->setValue($value); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ limit }}', 2) - ->setInvalidValue($value) - ->setPlural(2) - ->setCode(Choice::TOO_MANY_ERROR) - ->assertRaised(); - } - - public function testNonStrict() - { - $constraint = new Choice(array( - 'choices' => array(1, 2), - 'strict' => false, - )); - - $this->validator->validate('2', $constraint); - $this->validator->validate(2, $constraint); - - $this->assertNoViolation(); - } - - public function testStrictAllowsExactValue() - { - $constraint = new Choice(array( - 'choices' => array(1, 2), - 'strict' => true, - )); - - $this->validator->validate(2, $constraint); - - $this->assertNoViolation(); - } - - public function testStrictDisallowsDifferentType() - { - $constraint = new Choice(array( - 'choices' => array(1, 2), - 'strict' => true, - 'message' => 'myMessage', - )); - - $this->validator->validate('2', $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"2"') - ->setCode(Choice::NO_SUCH_CHOICE_ERROR) - ->assertRaised(); - } - - public function testNonStrictWithMultipleChoices() - { - $constraint = new Choice(array( - 'choices' => array(1, 2, 3), - 'multiple' => true, - 'strict' => false, - )); - - $this->validator->validate(array('2', 3), $constraint); - - $this->assertNoViolation(); - } - - public function testStrictWithMultipleChoices() - { - $constraint = new Choice(array( - 'choices' => array(1, 2, 3), - 'multiple' => true, - 'strict' => true, - 'multipleMessage' => 'myMessage', - )); - - $this->validator->validate(array(2, '3'), $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"3"') - ->setInvalidValue('3') - ->setCode(Choice::NO_SUCH_CHOICE_ERROR) - ->assertRaised(); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php deleted file mode 100644 index 79f50b0..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php +++ /dev/null @@ -1,112 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Collection; -use Symfony\Component\Validator\Constraints\Email; -use Symfony\Component\Validator\Constraints\Optional; -use Symfony\Component\Validator\Constraints\Required; -use Symfony\Component\Validator\Constraints\Valid; - -/** - * @author Bernhard Schussek - */ -class CollectionTest extends \PHPUnit_Framework_TestCase -{ - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testRejectInvalidFieldsOption() - { - new Collection(array( - 'fields' => 'foo', - )); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testRejectNonConstraints() - { - new Collection(array( - 'foo' => 'bar', - )); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testRejectValidConstraint() - { - new Collection(array( - 'foo' => new Valid(), - )); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testRejectValidConstraintWithinOptional() - { - new Collection(array( - 'foo' => new Optional(new Valid()), - )); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testRejectValidConstraintWithinRequired() - { - new Collection(array( - 'foo' => new Required(new Valid()), - )); - } - - public function testAcceptOptionalConstraintAsOneElementArray() - { - $collection1 = new Collection(array( - 'fields' => array( - 'alternate_email' => array( - new Optional(new Email()), - ), - ), - )); - - $collection2 = new Collection(array( - 'fields' => array( - 'alternate_email' => new Optional(new Email()), - ), - )); - - $this->assertEquals($collection1, $collection2); - } - - public function testAcceptRequiredConstraintAsOneElementArray() - { - $collection1 = new Collection(array( - 'fields' => array( - 'alternate_email' => array( - new Required(new Email()), - ), - ), - )); - - $collection2 = new Collection(array( - 'fields' => array( - 'alternate_email' => new Required(new Email()), - ), - )); - - $this->assertEquals($collection1, $collection2); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorArrayObjectTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorArrayObjectTest.php deleted file mode 100644 index a3c4b33..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorArrayObjectTest.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -class CollectionValidatorArrayObjectTest extends CollectionValidatorTest -{ - public function prepareTestData(array $contents) - { - return new \ArrayObject($contents); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorArrayTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorArrayTest.php deleted file mode 100644 index 7517d0c..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorArrayTest.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -class CollectionValidatorArrayTest extends CollectionValidatorTest -{ - public function prepareTestData(array $contents) - { - return $contents; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorCustomArrayObjectTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorCustomArrayObjectTest.php deleted file mode 100644 index 3d4c296..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorCustomArrayObjectTest.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Tests\Fixtures\CustomArrayObject; - -class CollectionValidatorCustomArrayObjectTest extends CollectionValidatorTest -{ - public function prepareTestData(array $contents) - { - return new CustomArrayObject($contents); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php deleted file mode 100644 index 0376814..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php +++ /dev/null @@ -1,389 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Collection; -use Symfony\Component\Validator\Constraints\CollectionValidator; -use Symfony\Component\Validator\Constraints\NotNull; -use Symfony\Component\Validator\Constraints\Optional; -use Symfony\Component\Validator\Constraints\Range; -use Symfony\Component\Validator\Constraints\Required; -use Symfony\Component\Validator\Validation; - -abstract class CollectionValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new CollectionValidator(); - } - - abstract protected function prepareTestData(array $contents); - - public function testNullIsValid() - { - $this->validator->validate(null, new Collection(array('fields' => array( - 'foo' => new Range(array('min' => 4)), - )))); - - $this->assertNoViolation(); - } - - public function testFieldsAsDefaultOption() - { - $constraint = new Range(array('min' => 4)); - - $data = $this->prepareTestData(array('foo' => 'foobar')); - - $this->expectValidateValueAt(0, '[foo]', $data['foo'], array($constraint)); - - $this->validator->validate($data, new Collection(array( - 'foo' => $constraint, - ))); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testThrowsExceptionIfNotTraversable() - { - $this->validator->validate('foobar', new Collection(array('fields' => array( - 'foo' => new Range(array('min' => 4)), - )))); - } - - public function testWalkSingleConstraint() - { - $constraint = new Range(array('min' => 4)); - - $array = array( - 'foo' => 3, - 'bar' => 5, - ); - - $i = 0; - - foreach ($array as $key => $value) { - $this->expectValidateValueAt($i++, '['.$key.']', $value, array($constraint)); - } - - $data = $this->prepareTestData($array); - - $this->validator->validate($data, new Collection(array( - 'fields' => array( - 'foo' => $constraint, - 'bar' => $constraint, - ), - ))); - - $this->assertNoViolation(); - } - - public function testWalkMultipleConstraints() - { - $constraints = array( - new Range(array('min' => 4)), - new NotNull(), - ); - - $array = array( - 'foo' => 3, - 'bar' => 5, - ); - - $i = 0; - - foreach ($array as $key => $value) { - $this->expectValidateValueAt($i++, '['.$key.']', $value, $constraints); - } - - $data = $this->prepareTestData($array); - - $this->validator->validate($data, new Collection(array( - 'fields' => array( - 'foo' => $constraints, - 'bar' => $constraints, - ), - ))); - - $this->assertNoViolation(); - } - - public function testExtraFieldsDisallowed() - { - $constraint = new Range(array('min' => 4)); - - $data = $this->prepareTestData(array( - 'foo' => 5, - 'baz' => 6, - )); - - $this->expectValidateValueAt(0, '[foo]', $data['foo'], array($constraint)); - - $this->validator->validate($data, new Collection(array( - 'fields' => array( - 'foo' => $constraint, - ), - 'extraFieldsMessage' => 'myMessage', - ))); - - $this->buildViolation('myMessage') - ->setParameter('{{ field }}', '"baz"') - ->atPath('property.path[baz]') - ->setInvalidValue(6) - ->setCode(Collection::NO_SUCH_FIELD_ERROR) - ->assertRaised(); - } - - // bug fix - public function testNullNotConsideredExtraField() - { - $data = $this->prepareTestData(array( - 'foo' => null, - )); - - $constraint = new Range(array('min' => 4)); - - $this->expectValidateValueAt(0, '[foo]', $data['foo'], array($constraint)); - - $this->validator->validate($data, new Collection(array( - 'fields' => array( - 'foo' => $constraint, - ), - ))); - - $this->assertNoViolation(); - } - - public function testExtraFieldsAllowed() - { - $data = $this->prepareTestData(array( - 'foo' => 5, - 'bar' => 6, - )); - - $constraint = new Range(array('min' => 4)); - - $this->expectValidateValueAt(0, '[foo]', $data['foo'], array($constraint)); - - $this->validator->validate($data, new Collection(array( - 'fields' => array( - 'foo' => $constraint, - ), - 'allowExtraFields' => true, - ))); - - $this->assertNoViolation(); - } - - public function testMissingFieldsDisallowed() - { - $data = $this->prepareTestData(array()); - - $constraint = new Range(array('min' => 4)); - - $this->validator->validate($data, new Collection(array( - 'fields' => array( - 'foo' => $constraint, - ), - 'missingFieldsMessage' => 'myMessage', - ))); - - $this->buildViolation('myMessage') - ->setParameter('{{ field }}', '"foo"') - ->atPath('property.path[foo]') - ->setInvalidValue(null) - ->setCode(Collection::MISSING_FIELD_ERROR) - ->assertRaised(); - } - - public function testMissingFieldsAllowed() - { - $data = $this->prepareTestData(array()); - - $constraint = new Range(array('min' => 4)); - - $this->validator->validate($data, new Collection(array( - 'fields' => array( - 'foo' => $constraint, - ), - 'allowMissingFields' => true, - ))); - - $this->assertNoViolation(); - } - - public function testOptionalFieldPresent() - { - $data = $this->prepareTestData(array( - 'foo' => null, - )); - - $this->validator->validate($data, new Collection(array( - 'foo' => new Optional(), - ))); - - $this->assertNoViolation(); - } - - public function testOptionalFieldNotPresent() - { - $data = $this->prepareTestData(array()); - - $this->validator->validate($data, new Collection(array( - 'foo' => new Optional(), - ))); - - $this->assertNoViolation(); - } - - public function testOptionalFieldSingleConstraint() - { - $array = array( - 'foo' => 5, - ); - - $constraint = new Range(array('min' => 4)); - - $this->expectValidateValueAt(0, '[foo]', $array['foo'], array($constraint)); - - $data = $this->prepareTestData($array); - - $this->validator->validate($data, new Collection(array( - 'foo' => new Optional($constraint), - ))); - - $this->assertNoViolation(); - } - - public function testOptionalFieldMultipleConstraints() - { - $array = array( - 'foo' => 5, - ); - - $constraints = array( - new NotNull(), - new Range(array('min' => 4)), - ); - - $this->expectValidateValueAt(0, '[foo]', $array['foo'], $constraints); - - $data = $this->prepareTestData($array); - - $this->validator->validate($data, new Collection(array( - 'foo' => new Optional($constraints), - ))); - - $this->assertNoViolation(); - } - - public function testRequiredFieldPresent() - { - $data = $this->prepareTestData(array( - 'foo' => null, - )); - - $this->validator->validate($data, new Collection(array( - 'foo' => new Required(), - ))); - - $this->assertNoViolation(); - } - - public function testRequiredFieldNotPresent() - { - $data = $this->prepareTestData(array()); - - $this->validator->validate($data, new Collection(array( - 'fields' => array( - 'foo' => new Required(), - ), - 'missingFieldsMessage' => 'myMessage', - ))); - - $this->buildViolation('myMessage') - ->setParameter('{{ field }}', '"foo"') - ->atPath('property.path[foo]') - ->setInvalidValue(null) - ->setCode(Collection::MISSING_FIELD_ERROR) - ->assertRaised(); - } - - public function testRequiredFieldSingleConstraint() - { - $array = array( - 'foo' => 5, - ); - - $constraint = new Range(array('min' => 4)); - - $this->expectValidateValueAt(0, '[foo]', $array['foo'], array($constraint)); - - $data = $this->prepareTestData($array); - - $this->validator->validate($data, new Collection(array( - 'foo' => new Required($constraint), - ))); - - $this->assertNoViolation(); - } - - public function testRequiredFieldMultipleConstraints() - { - $array = array( - 'foo' => 5, - ); - - $constraints = array( - new NotNull(), - new Range(array('min' => 4)), - ); - - $this->expectValidateValueAt(0, '[foo]', $array['foo'], $constraints); - - $data = $this->prepareTestData($array); - - $this->validator->validate($data, new Collection(array( - 'foo' => new Required($constraints), - ))); - - $this->assertNoViolation(); - } - - public function testObjectShouldBeLeftUnchanged() - { - $value = new \ArrayObject(array( - 'foo' => 3, - )); - - $constraint = new Range(array('min' => 2)); - - $this->expectValidateValueAt(0, '[foo]', $value['foo'], array($constraint)); - - $this->validator->validate($value, new Collection(array( - 'fields' => array( - 'foo' => $constraint, - ), - ))); - - $this->assertEquals(array( - 'foo' => 3, - ), (array) $value); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php deleted file mode 100644 index 21cb461..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php +++ /dev/null @@ -1,137 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Composite; -use Symfony\Component\Validator\Constraints\NotBlank; -use Symfony\Component\Validator\Constraints\NotNull; -use Symfony\Component\Validator\Constraints\Valid; - -class ConcreteComposite extends Composite -{ - public $constraints; - - protected function getCompositeOption() - { - return 'constraints'; - } - - public function getDefaultOption() - { - return 'constraints'; - } -} - -/** - * @since 2.6 - * @author Bernhard Schussek - */ -class CompositeTest extends \PHPUnit_Framework_TestCase -{ - public function testMergeNestedGroupsIfNoExplicitParentGroup() - { - $constraint = new ConcreteComposite(array( - new NotNull(array('groups' => 'Default')), - new NotBlank(array('groups' => array('Default', 'Strict'))), - )); - - $this->assertEquals(array('Default', 'Strict'), $constraint->groups); - $this->assertEquals(array('Default'), $constraint->constraints[0]->groups); - $this->assertEquals(array('Default', 'Strict'), $constraint->constraints[1]->groups); - } - - public function testSetImplicitNestedGroupsIfExplicitParentGroup() - { - $constraint = new ConcreteComposite(array( - 'constraints' => array( - new NotNull(), - new NotBlank(), - ), - 'groups' => array('Default', 'Strict'), - )); - - $this->assertEquals(array('Default', 'Strict'), $constraint->groups); - $this->assertEquals(array('Default', 'Strict'), $constraint->constraints[0]->groups); - $this->assertEquals(array('Default', 'Strict'), $constraint->constraints[1]->groups); - } - - public function testExplicitNestedGroupsMustBeSubsetOfExplicitParentGroups() - { - $constraint = new ConcreteComposite(array( - 'constraints' => array( - new NotNull(array('groups' => 'Default')), - new NotBlank(array('groups' => 'Strict')), - ), - 'groups' => array('Default', 'Strict'), - )); - - $this->assertEquals(array('Default', 'Strict'), $constraint->groups); - $this->assertEquals(array('Default'), $constraint->constraints[0]->groups); - $this->assertEquals(array('Strict'), $constraint->constraints[1]->groups); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testFailIfExplicitNestedGroupsNotSubsetOfExplicitParentGroups() - { - new ConcreteComposite(array( - 'constraints' => array( - new NotNull(array('groups' => array('Default', 'Foobar'))), - ), - 'groups' => array('Default', 'Strict'), - )); - } - - public function testImplicitGroupNamesAreForwarded() - { - $constraint = new ConcreteComposite(array( - new NotNull(array('groups' => 'Default')), - new NotBlank(array('groups' => 'Strict')), - )); - - $constraint->addImplicitGroupName('ImplicitGroup'); - - $this->assertEquals(array('Default', 'Strict', 'ImplicitGroup'), $constraint->groups); - $this->assertEquals(array('Default', 'ImplicitGroup'), $constraint->constraints[0]->groups); - $this->assertEquals(array('Strict'), $constraint->constraints[1]->groups); - } - - public function testSingleConstraintsAccepted() - { - $nestedConstraint = new NotNull(); - $constraint = new ConcreteComposite($nestedConstraint); - - $this->assertEquals(array($nestedConstraint), $constraint->constraints); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testFailIfNoConstraint() - { - new ConcreteComposite(array( - new NotNull(array('groups' => 'Default')), - 'NotBlank', - )); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testValidCantBeNested() - { - new ConcreteComposite(array( - new Valid(), - )); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CountValidatorArrayTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CountValidatorArrayTest.php deleted file mode 100644 index 5f562e7..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CountValidatorArrayTest.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -/** - * @author Bernhard Schussek - */ -class CountValidatorArrayTest extends CountValidatorTest -{ - protected function createCollection(array $content) - { - return $content; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CountValidatorCountableTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CountValidatorCountableTest.php deleted file mode 100644 index 7d46967..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CountValidatorCountableTest.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Tests\Fixtures\Countable; - -/** - * @author Bernhard Schussek - */ -class CountValidatorCountableTest extends CountValidatorTest -{ - protected function createCollection(array $content) - { - return new Countable($content); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CountValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CountValidatorTest.php deleted file mode 100644 index 6713166..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CountValidatorTest.php +++ /dev/null @@ -1,203 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Count; -use Symfony\Component\Validator\Constraints\CountValidator; -use Symfony\Component\Validator\Validation; - -/** - * @author Bernhard Schussek - */ -abstract class CountValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new CountValidator(); - } - - abstract protected function createCollection(array $content); - - public function testNullIsValid() - { - $this->validator->validate(null, new Count(6)); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsCountableType() - { - $this->validator->validate(new \stdClass(), new Count(5)); - } - - public function getThreeOrLessElements() - { - return array( - array($this->createCollection(array(1))), - array($this->createCollection(array(1, 2))), - array($this->createCollection(array(1, 2, 3))), - array($this->createCollection(array('a' => 1, 'b' => 2, 'c' => 3))), - ); - } - - public function getFourElements() - { - return array( - array($this->createCollection(array(1, 2, 3, 4))), - array($this->createCollection(array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4))), - ); - } - - public function getFiveOrMoreElements() - { - return array( - array($this->createCollection(array(1, 2, 3, 4, 5))), - array($this->createCollection(array(1, 2, 3, 4, 5, 6))), - array($this->createCollection(array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5))), - ); - } - - /** - * @dataProvider getThreeOrLessElements - */ - public function testValidValuesMax($value) - { - $constraint = new Count(array('max' => 3)); - $this->validator->validate($value, $constraint); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getFiveOrMoreElements - */ - public function testValidValuesMin($value) - { - $constraint = new Count(array('min' => 5)); - $this->validator->validate($value, $constraint); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getFourElements - */ - public function testValidValuesExact($value) - { - $constraint = new Count(4); - $this->validator->validate($value, $constraint); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getFiveOrMoreElements - */ - public function testTooManyValues($value) - { - $constraint = new Count(array( - 'max' => 4, - 'maxMessage' => 'myMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ count }}', count($value)) - ->setParameter('{{ limit }}', 4) - ->setInvalidValue($value) - ->setPlural(4) - ->setCode(Count::TOO_MANY_ERROR) - ->assertRaised(); - } - - /** - * @dataProvider getThreeOrLessElements - */ - public function testTooFewValues($value) - { - $constraint = new Count(array( - 'min' => 4, - 'minMessage' => 'myMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ count }}', count($value)) - ->setParameter('{{ limit }}', 4) - ->setInvalidValue($value) - ->setPlural(4) - ->setCode(Count::TOO_FEW_ERROR) - ->assertRaised(); - } - - /** - * @dataProvider getFiveOrMoreElements - */ - public function testTooManyValuesExact($value) - { - $constraint = new Count(array( - 'min' => 4, - 'max' => 4, - 'exactMessage' => 'myMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ count }}', count($value)) - ->setParameter('{{ limit }}', 4) - ->setInvalidValue($value) - ->setPlural(4) - ->setCode(Count::TOO_MANY_ERROR) - ->assertRaised(); - } - - /** - * @dataProvider getThreeOrLessElements - */ - public function testTooFewValuesExact($value) - { - $constraint = new Count(array( - 'min' => 4, - 'max' => 4, - 'exactMessage' => 'myMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ count }}', count($value)) - ->setParameter('{{ limit }}', 4) - ->setInvalidValue($value) - ->setPlural(4) - ->setCode(Count::TOO_FEW_ERROR) - ->assertRaised(); - } - - public function testDefaultOption() - { - $constraint = new Count(5); - - $this->assertEquals(5, $constraint->min); - $this->assertEquals(5, $constraint->max); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php deleted file mode 100644 index b133511..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php +++ /dev/null @@ -1,116 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Intl\Util\IntlTestHelper; -use Symfony\Component\Validator\Constraints\Country; -use Symfony\Component\Validator\Constraints\CountryValidator; -use Symfony\Component\Validator\Validation; - -class CountryValidatorTest extends AbstractConstraintValidatorTest -{ - protected function setUp() - { - IntlTestHelper::requireFullIntl($this); - - parent::setUp(); - } - - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new CountryValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Country()); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $this->validator->validate('', new Country()); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsStringCompatibleType() - { - $this->validator->validate(new \stdClass(), new Country()); - } - - /** - * @dataProvider getValidCountries - */ - public function testValidCountries($country) - { - $this->validator->validate($country, new Country()); - - $this->assertNoViolation(); - } - - public function getValidCountries() - { - return array( - array('GB'), - array('AT'), - array('MY'), - ); - } - - /** - * @dataProvider getInvalidCountries - */ - public function testInvalidCountries($country) - { - $constraint = new Country(array( - 'message' => 'myMessage', - )); - - $this->validator->validate($country, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$country.'"') - ->assertRaised(); - } - - public function getInvalidCountries() - { - return array( - array('foobar'), - array('EN'), - ); - } - - public function testValidateUsingCountrySpecificLocale() - { - // in order to test with "en_GB" - IntlTestHelper::requireFullIntl($this); - - \Locale::setDefault('en_GB'); - - $existingCountry = 'GB'; - - $this->validator->validate($existingCountry, new Country()); - - $this->assertNoViolation(); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php deleted file mode 100644 index e5bb060..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php +++ /dev/null @@ -1,116 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Intl\Util\IntlTestHelper; -use Symfony\Component\Validator\Constraints\Currency; -use Symfony\Component\Validator\Constraints\CurrencyValidator; -use Symfony\Component\Validator\Validation; - -class CurrencyValidatorTest extends AbstractConstraintValidatorTest -{ - protected function setUp() - { - IntlTestHelper::requireFullIntl($this); - - parent::setUp(); - } - - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new CurrencyValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Currency()); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $this->validator->validate('', new Currency()); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsStringCompatibleType() - { - $this->validator->validate(new \stdClass(), new Currency()); - } - - /** - * @dataProvider getValidCurrencies - */ - public function testValidCurrencies($currency) - { - $this->validator->validate($currency, new Currency()); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getValidCurrencies - **/ - public function testValidCurrenciesWithCountrySpecificLocale($currency) - { - \Locale::setDefault('en_GB'); - - $this->validator->validate($currency, new Currency()); - - $this->assertNoViolation(); - } - - public function getValidCurrencies() - { - return array( - array('EUR'), - array('USD'), - array('SIT'), - array('AUD'), - array('CAD'), - ); - } - - /** - * @dataProvider getInvalidCurrencies - */ - public function testInvalidCurrencies($currency) - { - $constraint = new Currency(array( - 'message' => 'myMessage', - )); - - $this->validator->validate($currency, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$currency.'"') - ->assertRaised(); - } - - public function getInvalidCurrencies() - { - return array( - array('EN'), - array('foobar'), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php deleted file mode 100644 index 25d88aa..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php +++ /dev/null @@ -1,110 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\DateTime; -use Symfony\Component\Validator\Constraints\DateTimeValidator; -use Symfony\Component\Validator\Validation; - -class DateTimeValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new DateTimeValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new DateTime()); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $this->validator->validate('', new DateTime()); - - $this->assertNoViolation(); - } - - public function testDateTimeClassIsValid() - { - $this->validator->validate(new \DateTime(), new DateTime()); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsStringCompatibleType() - { - $this->validator->validate(new \stdClass(), new DateTime()); - } - - /** - * @dataProvider getValidDateTimes - */ - public function testValidDateTimes($dateTime) - { - $this->validator->validate($dateTime, new DateTime()); - - $this->assertNoViolation(); - } - - public function getValidDateTimes() - { - return array( - array('2010-01-01 01:02:03'), - array('1955-12-12 00:00:00'), - array('2030-05-31 23:59:59'), - ); - } - - /** - * @dataProvider getInvalidDateTimes - */ - public function testInvalidDateTimes($dateTime, $code) - { - $constraint = new DateTime(array( - 'message' => 'myMessage', - )); - - $this->validator->validate($dateTime, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$dateTime.'"') - ->setCode($code) - ->assertRaised(); - } - - public function getInvalidDateTimes() - { - return array( - array('foobar', DateTime::INVALID_FORMAT_ERROR), - array('2010-01-01', DateTime::INVALID_FORMAT_ERROR), - array('00:00:00', DateTime::INVALID_FORMAT_ERROR), - array('2010-01-01 00:00', DateTime::INVALID_FORMAT_ERROR), - array('2010-13-01 00:00:00', DateTime::INVALID_DATE_ERROR), - array('2010-04-32 00:00:00', DateTime::INVALID_DATE_ERROR), - array('2010-02-29 00:00:00', DateTime::INVALID_DATE_ERROR), - array('2010-01-01 24:00:00', DateTime::INVALID_TIME_ERROR), - array('2010-01-01 00:60:00', DateTime::INVALID_TIME_ERROR), - array('2010-01-01 00:00:60', DateTime::INVALID_TIME_ERROR), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php deleted file mode 100644 index 21f0a2d..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php +++ /dev/null @@ -1,106 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Date; -use Symfony\Component\Validator\Constraints\DateValidator; -use Symfony\Component\Validator\Validation; - -class DateValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new DateValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Date()); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $this->validator->validate('', new Date()); - - $this->assertNoViolation(); - } - - public function testDateTimeClassIsValid() - { - $this->validator->validate(new \DateTime(), new Date()); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsStringCompatibleType() - { - $this->validator->validate(new \stdClass(), new Date()); - } - - /** - * @dataProvider getValidDates - */ - public function testValidDates($date) - { - $this->validator->validate($date, new Date()); - - $this->assertNoViolation(); - } - - public function getValidDates() - { - return array( - array('2010-01-01'), - array('1955-12-12'), - array('2030-05-31'), - ); - } - - /** - * @dataProvider getInvalidDates - */ - public function testInvalidDates($date, $code) - { - $constraint = new Date(array( - 'message' => 'myMessage', - )); - - $this->validator->validate($date, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$date.'"') - ->setCode($code) - ->assertRaised(); - } - - public function getInvalidDates() - { - return array( - array('foobar', Date::INVALID_FORMAT_ERROR), - array('foobar 2010-13-01', Date::INVALID_FORMAT_ERROR), - array('2010-13-01 foobar', Date::INVALID_FORMAT_ERROR), - array('2010-13-01', Date::INVALID_DATE_ERROR), - array('2010-04-32', Date::INVALID_DATE_ERROR), - array('2010-02-29', Date::INVALID_DATE_ERROR), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php deleted file mode 100644 index 0361333..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Email; -use Symfony\Component\Validator\Constraints\EmailValidator; -use Symfony\Component\Validator\Validation; - -class EmailValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new EmailValidator(false); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Email()); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $this->validator->validate('', new Email()); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsStringCompatibleType() - { - $this->validator->validate(new \stdClass(), new Email()); - } - - /** - * @dataProvider getValidEmails - */ - public function testValidEmails($email) - { - $this->validator->validate($email, new Email()); - - $this->assertNoViolation(); - } - - public function getValidEmails() - { - return array( - array('fabien@symfony.com'), - array('example@example.co.uk'), - array('fabien_potencier@example.fr'), - ); - } - - /** - * @dataProvider getInvalidEmails - */ - public function testInvalidEmails($email) - { - $constraint = new Email(array( - 'message' => 'myMessage', - )); - - $this->validator->validate($email, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$email.'"') - ->setCode(Email::INVALID_FORMAT_ERROR) - ->assertRaised(); - } - - public function getInvalidEmails() - { - return array( - array('example'), - array('example@'), - array('example@localhost'), - ); - } - - public function testStrict() - { - $constraint = new Email(array('strict' => true)); - - $this->validator->validate('example@localhost', $constraint); - - $this->assertNoViolation(); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/EqualToValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/EqualToValidatorTest.php deleted file mode 100644 index c20db15..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/EqualToValidatorTest.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\EqualTo; -use Symfony\Component\Validator\Constraints\EqualToValidator; -use Symfony\Component\Validator\Validation; - -/** - * @author Daniel Holmes - */ -class EqualToValidatorTest extends AbstractComparisonValidatorTestCase -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new EqualToValidator(); - } - - protected function createConstraint(array $options) - { - return new EqualTo($options); - } - - /** - * {@inheritdoc} - */ - public function provideValidComparisons() - { - return array( - array(3, 3), - array(3, '3'), - array('a', 'a'), - array(new \DateTime('2000-01-01'), new \DateTime('2000-01-01')), - array(new \DateTime('2000-01-01'), '2000-01-01'), - array(new \DateTime('2000-01-01 UTC'), '2000-01-01 UTC'), - array(new ComparisonTest_Class(5), new ComparisonTest_Class(5)), - array(null, 1), - ); - } - - /** - * {@inheritdoc} - */ - public function provideInvalidComparisons() - { - return array( - array(1, '1', 2, '2', 'integer'), - array('22', '"22"', '333', '"333"', 'string'), - array(new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2001-01-01 UTC'), 'Jan 1, 2001, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new ComparisonTest_Class(4), '4', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/ExpressionValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/ExpressionValidatorTest.php deleted file mode 100644 index 3d4ef75..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/ExpressionValidatorTest.php +++ /dev/null @@ -1,214 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\PropertyAccess\PropertyAccess; -use Symfony\Component\Validator\Constraints\Expression; -use Symfony\Component\Validator\Constraints\ExpressionValidator; -use Symfony\Component\Validator\Tests\Fixtures\Entity; -use Symfony\Component\Validator\Validation; - -class ExpressionValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new ExpressionValidator(PropertyAccess::createPropertyAccessor()); - } - - public function testExpressionIsEvaluatedWithNullValue() - { - $constraint = new Expression(array( - 'expression' => 'false', - 'message' => 'myMessage', - )); - - $this->validator->validate(null, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', 'null') - ->assertRaised(); - } - - public function testExpressionIsEvaluatedWithEmptyStringValue() - { - $constraint = new Expression(array( - 'expression' => 'false', - 'message' => 'myMessage', - )); - - $this->validator->validate('', $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '""') - ->assertRaised(); - } - - public function testSucceedingExpressionAtObjectLevel() - { - $constraint = new Expression('this.data == 1'); - - $object = new Entity(); - $object->data = '1'; - - $this->setObject($object); - - $this->validator->validate($object, $constraint); - - $this->assertNoViolation(); - } - - public function testFailingExpressionAtObjectLevel() - { - $constraint = new Expression(array( - 'expression' => 'this.data == 1', - 'message' => 'myMessage', - )); - - $object = new Entity(); - $object->data = '2'; - - $this->setObject($object); - - $this->validator->validate($object, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', 'object') - ->assertRaised(); - } - - public function testSucceedingExpressionAtPropertyLevel() - { - $constraint = new Expression('value == this.data'); - - $object = new Entity(); - $object->data = '1'; - - $this->setRoot($object); - $this->setPropertyPath('data'); - $this->setProperty($object, 'data'); - - $this->validator->validate('1', $constraint); - - $this->assertNoViolation(); - } - - public function testFailingExpressionAtPropertyLevel() - { - $constraint = new Expression(array( - 'expression' => 'value == this.data', - 'message' => 'myMessage', - )); - - $object = new Entity(); - $object->data = '1'; - - $this->setRoot($object); - $this->setPropertyPath('data'); - $this->setProperty($object, 'data'); - - $this->validator->validate('2', $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"2"') - ->atPath('data') - ->assertRaised(); - } - - public function testSucceedingExpressionAtNestedPropertyLevel() - { - $constraint = new Expression('value == this.data'); - - $object = new Entity(); - $object->data = '1'; - - $root = new Entity(); - $root->reference = $object; - - $this->setRoot($root); - $this->setPropertyPath('reference.data'); - $this->setProperty($object, 'data'); - - $this->validator->validate('1', $constraint); - - $this->assertNoViolation(); - } - - public function testFailingExpressionAtNestedPropertyLevel() - { - $constraint = new Expression(array( - 'expression' => 'value == this.data', - 'message' => 'myMessage', - )); - - $object = new Entity(); - $object->data = '1'; - - $root = new Entity(); - $root->reference = $object; - - $this->setRoot($root); - $this->setPropertyPath('reference.data'); - $this->setProperty($object, 'data'); - - $this->validator->validate('2', $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"2"') - ->atPath('reference.data') - ->assertRaised(); - } - - /** - * When validatePropertyValue() is called with a class name - * https://github.com/symfony/symfony/pull/11498 - */ - public function testSucceedingExpressionAtPropertyLevelWithoutRoot() - { - $constraint = new Expression('value == "1"'); - - $this->setRoot('1'); - $this->setPropertyPath(''); - $this->setProperty(null, 'property'); - - $this->validator->validate('1', $constraint); - - $this->assertNoViolation(); - } - - /** - * When validatePropertyValue() is called with a class name - * https://github.com/symfony/symfony/pull/11498 - */ - public function testFailingExpressionAtPropertyLevelWithoutRoot() - { - $constraint = new Expression(array( - 'expression' => 'value == "1"', - 'message' => 'myMessage', - )); - - $this->setRoot('2'); - $this->setPropertyPath(''); - $this->setProperty(null, 'property'); - - $this->validator->validate('2', $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"2"') - ->atPath('') - ->assertRaised(); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/FalseValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/FalseValidatorTest.php deleted file mode 100644 index 479888e..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/FalseValidatorTest.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\False; -use Symfony\Component\Validator\Constraints\FalseValidator; -use Symfony\Component\Validator\Validation; - -class FalseValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new FalseValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new False()); - - $this->assertNoViolation(); - } - - public function testFalseIsValid() - { - $this->validator->validate(false, new False()); - - $this->assertNoViolation(); - } - - public function testTrueIsInvalid() - { - $constraint = new False(array( - 'message' => 'myMessage', - )); - - $this->validator->validate(true, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', 'true') - ->assertRaised(); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/FileTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/FileTest.php deleted file mode 100644 index 2ee4681..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/FileTest.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\File; - -class FileTest extends \PHPUnit_Framework_TestCase -{ - /** - * @param mixed $maxSize - * @param int bytes - * @param bool $bytes - * @dataProvider provideValidSizes - */ - public function testMaxSize($maxSize, $bytes, $binaryFormat) - { - $file = new File(array('maxSize' => $maxSize)); - - $this->assertSame($bytes, $file->maxSize); - $this->assertSame($binaryFormat, $file->binaryFormat); - } - - /** - * @param mixed $maxSize - * @param int $bytes - * @dataProvider provideInValidSizes - * @expectedException Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testInvalideMaxSize($maxSize) - { - $file = new File(array('maxSize' => $maxSize)); - } - - /** - * @return array - */ - public function provideValidSizes() - { - return array( - array('500', 500, false), - array(12300, 12300, false), - array('1ki', 1024, true), - array('1KI', 1024, true), - array('2k', 2000, false), - array('2K', 2000, false), - array('1mi', 1048576, true), - array('1MI', 1048576, true), - array('3m', 3000000, false), - array('3M', 3000000, false), - ); - } - - /** - * @return array - */ - public function provideInvalidSizes() - { - return array( - array('+100'), - array('foo'), - array('1Ko'), - array('1kio'), - array('1G'), - array('1Gi'), - ); - } - - /** - * @param mixed $maxSize - * @param bool $guessedFormat - * @param bool $binaryFormat - * @dataProvider provideFormats - */ - public function testBinaryFormat($maxSize, $guessedFormat, $binaryFormat) - { - $file = new File(array('maxSize' => $maxSize, 'binaryFormat' => $guessedFormat)); - - $this->assertSame($binaryFormat, $file->binaryFormat); - } - - /** - * @return array - */ - public function provideFormats() - { - return array( - array(100, null, false), - array(100, true, true), - array(100, false, false), - array('100K', null, false), - array('100K', true, true), - array('100K', false, false), - array('100Ki', null, true), - array('100Ki', true, true), - array('100Ki', false, false), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/FileValidatorObjectTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/FileValidatorObjectTest.php deleted file mode 100644 index f35f93b..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/FileValidatorObjectTest.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\HttpFoundation\File\File; - -class FileValidatorObjectTest extends FileValidatorTest -{ - protected function getFile($filename) - { - return new File($filename); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/FileValidatorPathTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/FileValidatorPathTest.php deleted file mode 100644 index 11b8d4c..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/FileValidatorPathTest.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\File; - -class FileValidatorPathTest extends FileValidatorTest -{ - protected function getFile($filename) - { - return $filename; - } - - public function testFileNotFound() - { - $constraint = new File(array( - 'notFoundMessage' => 'myMessage', - )); - - $this->validator->validate('foobar', $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ file }}', '"foobar"') - ->setCode(File::NOT_FOUND_ERROR) - ->assertRaised(); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php deleted file mode 100644 index 176b49f..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php +++ /dev/null @@ -1,477 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\HttpFoundation\File\UploadedFile; -use Symfony\Component\Validator\Constraints\File; -use Symfony\Component\Validator\Constraints\FileValidator; -use Symfony\Component\Validator\Validation; - -abstract class FileValidatorTest extends AbstractConstraintValidatorTest -{ - protected $path; - - protected $file; - - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new FileValidator(); - } - - protected function setUp() - { - parent::setUp(); - - $this->path = sys_get_temp_dir().DIRECTORY_SEPARATOR.'FileValidatorTest'; - $this->file = fopen($this->path, 'w'); - fwrite($this->file, ' ', 1); - } - - protected function tearDown() - { - parent::tearDown(); - - if (is_resource($this->file)) { - fclose($this->file); - } - - if (file_exists($this->path)) { - unlink($this->path); - } - - $this->path = null; - $this->file = null; - } - - public function testNullIsValid() - { - $this->validator->validate(null, new File()); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $this->validator->validate('', new File()); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsStringCompatibleTypeOrFile() - { - $this->validator->validate(new \stdClass(), new File()); - } - - public function testValidFile() - { - $this->validator->validate($this->path, new File()); - - $this->assertNoViolation(); - } - - public function testValidUploadedfile() - { - $file = new UploadedFile($this->path, 'originalName', null, null, null, true); - $this->validator->validate($file, new File()); - - $this->assertNoViolation(); - } - - public function provideMaxSizeExceededTests() - { - // We have various interesting limit - size combinations to test. - // Assume a limit of 1000 bytes (1 kB). Then the following table - // lists the violation messages for different file sizes: - // -----------+-------------------------------------------------------- - // Size | Violation Message - // -----------+-------------------------------------------------------- - // 1000 bytes | No violation - // 1001 bytes | "Size of 1001 bytes exceeded limit of 1000 bytes" - // 1004 bytes | "Size of 1004 bytes exceeded limit of 1000 bytes" - // | NOT: "Size of 1 kB exceeded limit of 1 kB" - // 1005 bytes | "Size of 1.01 kB exceeded limit of 1 kB" - // -----------+-------------------------------------------------------- - - // As you see, we have two interesting borders: - - // 1000/1001 - The border as of which a violation occurs - // 1004/1005 - The border as of which the message can be rounded to kB - - // Analogous for kB/MB. - - // Prior to Symfony 2.5, violation messages are always displayed in the - // same unit used to specify the limit. - - // As of Symfony 2.5, the above logic is implemented. - return array( - // limit in bytes - array(1001, 1000, '1001', '1000', 'bytes'), - array(1004, 1000, '1004', '1000', 'bytes'), - array(1005, 1000, '1.01', '1', 'kB'), - - array(1000001, 1000000, '1000001', '1000000', 'bytes'), - array(1004999, 1000000, '1005', '1000', 'kB'), - array(1005000, 1000000, '1.01', '1', 'MB'), - - // limit in kB - array(1001, '1k', '1001', '1000', 'bytes'), - array(1004, '1k', '1004', '1000', 'bytes'), - array(1005, '1k', '1.01', '1', 'kB'), - - array(1000001, '1000k', '1000001', '1000000', 'bytes'), - array(1004999, '1000k', '1005', '1000', 'kB'), - array(1005000, '1000k', '1.01', '1', 'MB'), - - // limit in MB - array(1000001, '1M', '1000001', '1000000', 'bytes'), - array(1004999, '1M', '1005', '1000', 'kB'), - array(1005000, '1M', '1.01', '1', 'MB'), - - // limit in KiB - array(1025, '1Ki', '1025', '1024', 'bytes'), - array(1029, '1Ki', '1029', '1024', 'bytes'), - array(1030, '1Ki', '1.01', '1', 'KiB'), - - array(1048577, '1024Ki', '1048577', '1048576', 'bytes'), - array(1053818, '1024Ki', '1029.12', '1024', 'KiB'), - array(1053819, '1024Ki', '1.01', '1', 'MiB'), - - // limit in MiB - array(1048577, '1Mi', '1048577', '1048576', 'bytes'), - array(1053818, '1Mi', '1029.12', '1024', 'KiB'), - array(1053819, '1Mi', '1.01', '1', 'MiB'), - ); - } - - /** - * @dataProvider provideMaxSizeExceededTests - */ - public function testMaxSizeExceeded($bytesWritten, $limit, $sizeAsString, $limitAsString, $suffix) - { - fseek($this->file, $bytesWritten - 1, SEEK_SET); - fwrite($this->file, '0'); - fclose($this->file); - - $constraint = new File(array( - 'maxSize' => $limit, - 'maxSizeMessage' => 'myMessage', - )); - - $this->validator->validate($this->getFile($this->path), $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ limit }}', $limitAsString) - ->setParameter('{{ size }}', $sizeAsString) - ->setParameter('{{ suffix }}', $suffix) - ->setParameter('{{ file }}', '"'.$this->path.'"') - ->setCode(File::TOO_LARGE_ERROR) - ->assertRaised(); - } - - public function provideMaxSizeNotExceededTests() - { - return array( - // limit in bytes - array(1000, 1000), - array(1000000, 1000000), - - // limit in kB - array(1000, '1k'), - array(1000000, '1000k'), - - // limit in MB - array(1000000, '1M'), - - // limit in KiB - array(1024, '1Ki'), - array(1048576, '1024Ki'), - - // limit in MiB - array(1048576, '1Mi'), - ); - } - - /** - * @dataProvider provideMaxSizeNotExceededTests - */ - public function testMaxSizeNotExceeded($bytesWritten, $limit) - { - fseek($this->file, $bytesWritten - 1, SEEK_SET); - fwrite($this->file, '0'); - fclose($this->file); - - $constraint = new File(array( - 'maxSize' => $limit, - 'maxSizeMessage' => 'myMessage', - )); - - $this->validator->validate($this->getFile($this->path), $constraint); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testInvalidMaxSize() - { - $constraint = new File(array( - 'maxSize' => '1abc', - )); - - $this->validator->validate($this->path, $constraint); - } - - public function provideBinaryFormatTests() - { - return array( - array(11, 10, null, '11', '10', 'bytes'), - array(11, 10, true, '11', '10', 'bytes'), - array(11, 10, false, '11', '10', 'bytes'), - - // round(size) == 1.01kB, limit == 1kB - array(ceil(1000*1.01), 1000, null, '1.01', '1', 'kB'), - array(ceil(1000*1.01), '1k', null, '1.01', '1', 'kB'), - array(ceil(1024*1.01), '1Ki', null, '1.01', '1', 'KiB'), - - array(ceil(1024*1.01), 1024, true, '1.01', '1', 'KiB'), - array(ceil(1024*1.01*1000), '1024k', true, '1010', '1000', 'KiB'), - array(ceil(1024*1.01), '1Ki', true, '1.01', '1', 'KiB'), - - array(ceil(1000*1.01), 1000, false, '1.01', '1', 'kB'), - array(ceil(1000*1.01), '1k', false, '1.01', '1', 'kB'), - array(ceil(1024*1.01*10), '10Ki', false, '10.34', '10.24', 'kB'), - ); - } - - /** - * @dataProvider provideBinaryFormatTests - */ - public function testBinaryFormat($bytesWritten, $limit, $binaryFormat, $sizeAsString, $limitAsString, $suffix) - { - fseek($this->file, $bytesWritten-1, SEEK_SET); - fwrite($this->file, '0'); - fclose($this->file); - - $constraint = new File(array( - 'maxSize' => $limit, - 'binaryFormat' => $binaryFormat, - 'maxSizeMessage' => 'myMessage', - )); - - $this->validator->validate($this->getFile($this->path), $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ limit }}', $limitAsString) - ->setParameter('{{ size }}', $sizeAsString) - ->setParameter('{{ suffix }}', $suffix) - ->setParameter('{{ file }}', '"'.$this->path.'"') - ->setCode(File::TOO_LARGE_ERROR) - ->assertRaised(); - } - - public function testValidMimeType() - { - $file = $this - ->getMockBuilder('Symfony\Component\HttpFoundation\File\File') - ->setConstructorArgs(array(__DIR__.'/Fixtures/foo')) - ->getMock(); - $file - ->expects($this->once()) - ->method('getPathname') - ->will($this->returnValue($this->path)); - $file - ->expects($this->once()) - ->method('getMimeType') - ->will($this->returnValue('image/jpg')); - - $constraint = new File(array( - 'mimeTypes' => array('image/png', 'image/jpg'), - )); - - $this->validator->validate($file, $constraint); - - $this->assertNoViolation(); - } - - public function testValidWildcardMimeType() - { - $file = $this - ->getMockBuilder('Symfony\Component\HttpFoundation\File\File') - ->setConstructorArgs(array(__DIR__.'/Fixtures/foo')) - ->getMock(); - $file - ->expects($this->once()) - ->method('getPathname') - ->will($this->returnValue($this->path)); - $file - ->expects($this->once()) - ->method('getMimeType') - ->will($this->returnValue('image/jpg')); - - $constraint = new File(array( - 'mimeTypes' => array('image/*'), - )); - - $this->validator->validate($file, $constraint); - - $this->assertNoViolation(); - } - - public function testInvalidMimeType() - { - $file = $this - ->getMockBuilder('Symfony\Component\HttpFoundation\File\File') - ->setConstructorArgs(array(__DIR__.'/Fixtures/foo')) - ->getMock(); - $file - ->expects($this->once()) - ->method('getPathname') - ->will($this->returnValue($this->path)); - $file - ->expects($this->once()) - ->method('getMimeType') - ->will($this->returnValue('application/pdf')); - - $constraint = new File(array( - 'mimeTypes' => array('image/png', 'image/jpg'), - 'mimeTypesMessage' => 'myMessage', - )); - - $this->validator->validate($file, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ type }}', '"application/pdf"') - ->setParameter('{{ types }}', '"image/png", "image/jpg"') - ->setParameter('{{ file }}', '"'.$this->path.'"') - ->setCode(File::INVALID_MIME_TYPE_ERROR) - ->assertRaised(); - } - - public function testInvalidWildcardMimeType() - { - $file = $this - ->getMockBuilder('Symfony\Component\HttpFoundation\File\File') - ->setConstructorArgs(array(__DIR__.'/Fixtures/foo')) - ->getMock(); - $file - ->expects($this->once()) - ->method('getPathname') - ->will($this->returnValue($this->path)); - $file - ->expects($this->once()) - ->method('getMimeType') - ->will($this->returnValue('application/pdf')); - - $constraint = new File(array( - 'mimeTypes' => array('image/*', 'image/jpg'), - 'mimeTypesMessage' => 'myMessage', - )); - - $this->validator->validate($file, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ type }}', '"application/pdf"') - ->setParameter('{{ types }}', '"image/*", "image/jpg"') - ->setParameter('{{ file }}', '"'.$this->path.'"') - ->setCode(File::INVALID_MIME_TYPE_ERROR) - ->assertRaised(); - } - - public function testDisallowEmpty() - { - ftruncate($this->file, 0); - - $constraint = new File(array( - 'disallowEmptyMessage' => 'myMessage', - )); - - $this->validator->validate($this->getFile($this->path), $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ file }}', '"'.$this->path.'"') - ->setCode(File::EMPTY_ERROR) - ->assertRaised(); - } - - /** - * @dataProvider uploadedFileErrorProvider - */ - public function testUploadedFileError($error, $message, array $params = array(), $maxSize = null) - { - $file = new UploadedFile('/path/to/file', 'originalName', 'mime', 0, $error); - - $constraint = new File(array( - $message => 'myMessage', - 'maxSize' => $maxSize, - )); - - $this->validator->validate($file, $constraint); - - $this->buildViolation('myMessage') - ->setParameters($params) - ->setCode($error) - ->assertRaised(); - } - - public function uploadedFileErrorProvider() - { - $tests = array( - array(UPLOAD_ERR_FORM_SIZE, 'uploadFormSizeErrorMessage'), - array(UPLOAD_ERR_PARTIAL, 'uploadPartialErrorMessage'), - array(UPLOAD_ERR_NO_FILE, 'uploadNoFileErrorMessage'), - array(UPLOAD_ERR_NO_TMP_DIR, 'uploadNoTmpDirErrorMessage'), - array(UPLOAD_ERR_CANT_WRITE, 'uploadCantWriteErrorMessage'), - array(UPLOAD_ERR_EXTENSION, 'uploadExtensionErrorMessage'), - ); - - if (class_exists('Symfony\Component\HttpFoundation\File\UploadedFile')) { - // when no maxSize is specified on constraint, it should use the ini value - $tests[] = array(UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', array( - '{{ limit }}' => UploadedFile::getMaxFilesize() / 1048576, - '{{ suffix }}' => 'MiB', - )); - - // it should use the smaller limitation (maxSize option in this case) - $tests[] = array(UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', array( - '{{ limit }}' => 1, - '{{ suffix }}' => 'bytes', - ), '1'); - - // it correctly parses the maxSize option and not only uses simple string comparison - // 1000M should be bigger than the ini value - $tests[] = array(UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', array( - '{{ limit }}' => UploadedFile::getMaxFilesize() / 1048576, - '{{ suffix }}' => 'MiB', - ), '1000M'); - - // it correctly parses the maxSize option and not only uses simple string comparison - // 1000M should be bigger than the ini value - $tests[] = array(UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', array( - '{{ limit }}' => '0.1', - '{{ suffix }}' => 'MB', - ), '100K'); - } - - return $tests; - } - - abstract protected function getFile($filename); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/Fixtures/foo b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/Fixtures/foo deleted file mode 100644 index e69de29..0000000 diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/Fixtures/test.gif b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/Fixtures/test.gif deleted file mode 100644 index 6b44fc7..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/Fixtures/test.gif +++ /dev/null @@ -1 +0,0 @@ -GIF89a÷ÿÿÿ,; \ No newline at end of file diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/Fixtures/test_4by3.gif b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/Fixtures/test_4by3.gif deleted file mode 100644 index 64dd3ff..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/Fixtures/test_4by3.gif +++ /dev/null @@ -1 +0,0 @@ -GIF89a€ÿÿÿÿÿÿ!þCreated with GIMP,„V; \ No newline at end of file diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/Fixtures/test_landscape.gif b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/Fixtures/test_landscape.gif deleted file mode 100644 index 8701235..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/Fixtures/test_landscape.gif +++ /dev/null @@ -1,3 +0,0 @@ -GIF89a€ÿÿÿÿÿÿ!ù -,L -; \ No newline at end of file diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/Fixtures/test_portrait.gif b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/Fixtures/test_portrait.gif deleted file mode 100644 index cc480ca..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/Fixtures/test_portrait.gif +++ /dev/null @@ -1,3 +0,0 @@ -GIF89a€ÿÿÿÿÿÿ!ù -,L -; \ No newline at end of file diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorTest.php deleted file mode 100644 index 41708f6..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorTest.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\GreaterThanOrEqual; -use Symfony\Component\Validator\Constraints\GreaterThanOrEqualValidator; -use Symfony\Component\Validator\Validation; - -/** - * @author Daniel Holmes - */ -class GreaterThanOrEqualValidatorTest extends AbstractComparisonValidatorTestCase -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new GreaterThanOrEqualValidator(); - } - - protected function createConstraint(array $options) - { - return new GreaterThanOrEqual($options); - } - - /** - * {@inheritdoc} - */ - public function provideValidComparisons() - { - return array( - array(3, 2), - array(1, 1), - array(new \DateTime('2010/01/01'), new \DateTime('2000/01/01')), - array(new \DateTime('2000/01/01'), new \DateTime('2000/01/01')), - array(new \DateTime('2010/01/01'), '2000/01/01'), - array(new \DateTime('2000/01/01'), '2000/01/01'), - array(new \DateTime('2010/01/01 UTC'), '2000/01/01 UTC'), - array(new \DateTime('2000/01/01 UTC'), '2000/01/01 UTC'), - array('a', 'a'), - array('z', 'a'), - array(null, 1), - ); - } - - /** - * {@inheritdoc} - */ - public function provideInvalidComparisons() - { - return array( - array(1, '1', 2, '2', 'integer'), - array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2005/01/01'), 'Jan 1, 2005, 12:00 AM', 'DateTime'), - array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', '2005/01/01', 'Jan 1, 2005, 12:00 AM', 'DateTime'), - array(new \DateTime('2000/01/01 UTC'), 'Jan 1, 2000, 12:00 AM', '2005/01/01 UTC', 'Jan 1, 2005, 12:00 AM', 'DateTime'), - array('b', '"b"', 'c', '"c"', 'string'), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorTest.php deleted file mode 100644 index 85a2b1d..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorTest.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\GreaterThan; -use Symfony\Component\Validator\Constraints\GreaterThanValidator; -use Symfony\Component\Validator\Validation; - -/** - * @author Daniel Holmes - */ -class GreaterThanValidatorTest extends AbstractComparisonValidatorTestCase -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new GreaterThanValidator(); - } - - protected function createConstraint(array $options) - { - return new GreaterThan($options); - } - - /** - * {@inheritdoc} - */ - public function provideValidComparisons() - { - return array( - array(2, 1), - array(new \DateTime('2005/01/01'), new \DateTime('2001/01/01')), - array(new \DateTime('2005/01/01'), '2001/01/01'), - array(new \DateTime('2005/01/01 UTC'), '2001/01/01 UTC'), - array(new ComparisonTest_Class(5), new ComparisonTest_Class(4)), - array('333', '22'), - array(null, 1), - ); - } - - /** - * {@inheritdoc} - */ - public function provideInvalidComparisons() - { - return array( - array(1, '1', 2, '2', 'integer'), - array(2, '2', 2, '2', 'integer'), - array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2005/01/01'), 'Jan 1, 2005, 12:00 AM', 'DateTime'), - array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', '2005/01/01', 'Jan 1, 2005, 12:00 AM', 'DateTime'), - array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', '2000/01/01', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2000/01/01 UTC'), 'Jan 1, 2000, 12:00 AM', '2005/01/01 UTC', 'Jan 1, 2005, 12:00 AM', 'DateTime'), - array(new \DateTime('2000/01/01 UTC'), 'Jan 1, 2000, 12:00 AM', '2000/01/01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new ComparisonTest_Class(4), '4', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), - array(new ComparisonTest_Class(5), '5', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), - array('22', '"22"', '333', '"333"', 'string'), - array('22', '"22"', '22', '"22"', 'string'), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/GroupSequenceTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/GroupSequenceTest.php deleted file mode 100644 index 85b60b5..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/GroupSequenceTest.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\GroupSequence; - -/** - * @author Bernhard Schussek - */ -class GroupSequenceTest extends \PHPUnit_Framework_TestCase -{ - public function testCreate() - { - $sequence = new GroupSequence(array('Group 1', 'Group 2')); - - $this->assertSame(array('Group 1', 'Group 2'), $sequence->groups); - } - - public function testCreateDoctrineStyle() - { - $sequence = new GroupSequence(array('value' => array('Group 1', 'Group 2'))); - - $this->assertSame(array('Group 1', 'Group 2'), $sequence->groups); - } - - public function testIterate() - { - $sequence = new GroupSequence(array('Group 1', 'Group 2')); - - $this->assertSame(array('Group 1', 'Group 2'), iterator_to_array($sequence)); - } - - public function testCount() - { - $sequence = new GroupSequence(array('Group 1', 'Group 2')); - - $this->assertCount(2, $sequence); - } - - public function testArrayAccess() - { - $sequence = new GroupSequence(array('Group 1', 'Group 2')); - - $this->assertSame('Group 1', $sequence[0]); - $this->assertSame('Group 2', $sequence[1]); - $this->assertTrue(isset($sequence[0])); - $this->assertFalse(isset($sequence[2])); - unset($sequence[0]); - $this->assertFalse(isset($sequence[0])); - $sequence[] = 'Group 3'; - $this->assertTrue(isset($sequence[2])); - $this->assertSame('Group 3', $sequence[2]); - $sequence[0] = 'Group 1'; - $this->assertTrue(isset($sequence[0])); - $this->assertSame('Group 1', $sequence[0]); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\OutOfBoundsException - */ - public function testGetExpectsExistingKey() - { - $sequence = new GroupSequence(array('Group 1', 'Group 2')); - - $sequence[2]; - } - - public function testUnsetIgnoresNonExistingKeys() - { - $sequence = new GroupSequence(array('Group 1', 'Group 2')); - - // should not fail - unset($sequence[2]); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/IbanValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/IbanValidatorTest.php deleted file mode 100644 index ab9839a..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/IbanValidatorTest.php +++ /dev/null @@ -1,193 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Iban; -use Symfony\Component\Validator\Constraints\IbanValidator; -use Symfony\Component\Validator\Validation; - -class IbanValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new IbanValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Iban()); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $this->validator->validate('', new Iban()); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getValidIbans - */ - public function testValidIbans($iban) - { - $this->validator->validate($iban, new Iban()); - - $this->assertNoViolation(); - } - - public function getValidIbans() - { - return array( - array('CH9300762011623852957'), // Switzerland without spaces - array('CH93 0076 2011 6238 5295 7'), // Switzerland with multiple spaces - - //Country list - //http://www.rbs.co.uk/corporate/international/g0/guide-to-international-business/regulatory-information/iban/iban-example.ashx - - array('AL47 2121 1009 0000 0002 3569 8741'), //Albania - array('AD12 0001 2030 2003 5910 0100'), //Andorra - array('AT61 1904 3002 3457 3201'), //Austria - array('AZ21 NABZ 0000 0000 1370 1000 1944'), //Azerbaijan - array('BH67 BMAG 0000 1299 1234 56'), //Bahrain - array('BE62 5100 0754 7061'), //Belgium - array('BA39 1290 0794 0102 8494'), //Bosnia and Herzegovina - array('BG80 BNBG 9661 1020 3456 78'), //Bulgaria - array('HR12 1001 0051 8630 0016 0'), //Croatia - array('CY17 0020 0128 0000 0012 0052 7600'), //Cyprus - array('CZ65 0800 0000 1920 0014 5399'), //Czech Republic - array('DK50 0040 0440 1162 43'), //Denmark - array('EE38 2200 2210 2014 5685'), //Estonia - array('FO97 5432 0388 8999 44'), //Faroe Islands - array('FI21 1234 5600 0007 85'), //Finland - array('FR14 2004 1010 0505 0001 3M02 606'), //France - array('GE29 NB00 0000 0101 9049 17'), //Georgia - array('DE89 3704 0044 0532 0130 00'), //Germany - array('GI75 NWBK 0000 0000 7099 453'), //Gibraltar - array('GR16 0110 1250 0000 0001 2300 695'), //Greece - array('GL56 0444 9876 5432 10'), //Greenland - array('HU42 1177 3016 1111 1018 0000 0000'), //Hungary - array('IS14 0159 2600 7654 5510 7303 39'), //Iceland - array('IE29 AIBK 9311 5212 3456 78'), //Ireland - array('IL62 0108 0000 0009 9999 999'), //Israel - array('IT40 S054 2811 1010 0000 0123 456'), //Italy - array('LV80 BANK 0000 4351 9500 1'), //Latvia - array('LB62 0999 0000 0001 0019 0122 9114'), //Lebanon - array('LI21 0881 0000 2324 013A A'), //Liechtenstein - array('LT12 1000 0111 0100 1000'), //Lithuania - array('LU28 0019 4006 4475 0000'), //Luxembourg - array('MK072 5012 0000 0589 84'), //Macedonia - array('MT84 MALT 0110 0001 2345 MTLC AST0 01S'), //Malta - array('MU17 BOMM 0101 1010 3030 0200 000M UR'), //Mauritius - array('MD24 AG00 0225 1000 1310 4168'), //Moldova - array('MC93 2005 2222 1001 1223 3M44 555'), //Monaco - array('ME25 5050 0001 2345 6789 51'), //Montenegro - array('NL39 RABO 0300 0652 64'), //Netherlands - array('NO93 8601 1117 947'), //Norway - array('PK36 SCBL 0000 0011 2345 6702'), //Pakistan - array('PL60 1020 1026 0000 0422 7020 1111'), //Poland - array('PT50 0002 0123 1234 5678 9015 4'), //Portugal - array('RO49 AAAA 1B31 0075 9384 0000'), //Romania - array('SM86 U032 2509 8000 0000 0270 100'), //San Marino - array('SA03 8000 0000 6080 1016 7519'), //Saudi Arabia - array('RS35 2600 0560 1001 6113 79'), //Serbia - array('SK31 1200 0000 1987 4263 7541'), //Slovak Republic - array('SI56 1910 0000 0123 438'), //Slovenia - array('ES80 2310 0001 1800 0001 2345'), //Spain - array('SE35 5000 0000 0549 1000 0003'), //Sweden - array('CH93 0076 2011 6238 5295 7'), //Switzerland - array('TN59 1000 6035 1835 9847 8831'), //Tunisia - array('TR33 0006 1005 1978 6457 8413 26'), //Turkey - array('AE07 0331 2345 6789 0123 456'), //UAE - array('GB 12 CPBK 0892 9965 0449 91'), //United Kingdom - - //Extended country list - //http://www.nordea.com/Our+services/International+products+and+services/Cash+Management/IBAN+countries/908462.html - array('AO06000600000100037131174'), //Angola - array('AZ21NABZ00000000137010001944'), //Azerbaijan - array('BH29BMAG1299123456BH00'), //Bahrain - array('BJ11B00610100400271101192591'), //Benin - array('VG96VPVG0000012345678901'), //British Virgin Islands - array('BF1030134020015400945000643'), //Burkina Faso - array('BI43201011067444'), //Burundi - array('CM2110003001000500000605306'), //Cameroon - array('CV64000300004547069110176'), //Cape Verde - array('FR7630007000110009970004942'), //Central African Republic - array('CG5230011000202151234567890'), //Congo - array('CR0515202001026284066'), //Costa Rica - array('DO28BAGR00000001212453611324'), //Dominican Republic - array('GT82TRAJ01020000001210029690'), //Guatemala - array('IR580540105180021273113007'), //Iran - array('IL620108000000099999999'), //Israel - array('CI05A00060174100178530011852'), //Ivory Coast - array('KZ176010251000042993'), //Kazakhstan - array('KW74NBOK0000000000001000372151'), //Kuwait - array('LB30099900000001001925579115'), //Lebanon - array('MG4600005030010101914016056'), //Madagascar - array('ML03D00890170001002120000447'), //Mali - array('MR1300012000010000002037372'), //Mauritania - array('MU17BOMM0101101030300200000MUR'), //Mauritius - array('MZ59000100000011834194157'), //Mozambique - array('PS92PALS000000000400123456702'), //Palestinian Territory - array('PT50000200000163099310355'), //Sao Tome and Principe - array('SA0380000000608010167519'), //Saudi Arabia - array('SN12K00100152000025690007542'), //Senegal - array('TN5914207207100707129648'), //Tunisia - array('TR330006100519786457841326'), //Turkey - array('AE260211000000230064016'), //United Arab Emirates - ); - } - - /** - * @dataProvider getInvalidIbans - */ - public function testInvalidIbans($iban, $code) - { - $constraint = new Iban(array( - 'message' => 'myMessage', - )); - - $this->validator->validate($iban, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$iban.'"') - ->setCode($code) - ->assertRaised(); - } - - public function getInvalidIbans() - { - return array( - array('CH93 0076 2011 6238 5295', Iban::CHECKSUM_FAILED_ERROR), - array('CH930076201162385295', Iban::CHECKSUM_FAILED_ERROR), - array('GB29 RBOS 6016 1331 9268 19', Iban::CHECKSUM_FAILED_ERROR), - array('CH930072011623852957', Iban::CHECKSUM_FAILED_ERROR), - array('NL39 RASO 0300 0652 64', Iban::CHECKSUM_FAILED_ERROR), - array('NO93 8601117 947', Iban::CHECKSUM_FAILED_ERROR), - array('CY170020 128 0000 0012 0052 7600', Iban::CHECKSUM_FAILED_ERROR), - array('foo', Iban::TOO_SHORT_ERROR), - array('123', Iban::TOO_SHORT_ERROR), - array('0750447346', Iban::INVALID_COUNTRY_CODE_ERROR), - array('CH930076201162385295]', Iban::INVALID_CHARACTERS_ERROR), - - //Ibans with lower case values are invalid - array('Ae260211000000230064016', Iban::INVALID_CASE_ERROR), - array('ae260211000000230064016', Iban::INVALID_CASE_ERROR), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/IdenticalToValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/IdenticalToValidatorTest.php deleted file mode 100644 index 4b71062..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/IdenticalToValidatorTest.php +++ /dev/null @@ -1,89 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\IdenticalTo; -use Symfony\Component\Validator\Constraints\IdenticalToValidator; -use Symfony\Component\Validator\Validation; - -/** - * @author Daniel Holmes - */ -class IdenticalToValidatorTest extends AbstractComparisonValidatorTestCase -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new IdenticalToValidator(); - } - - protected function createConstraint(array $options) - { - return new IdenticalTo($options); - } - - public function provideAllValidComparisons() - { - $this->setDefaultTimezone('UTC'); - - // Don't call addPhp5Dot5Comparisons() automatically, as it does - // not take care of identical objects - $comparisons = $this->provideValidComparisons(); - - $this->restoreDefaultTimezone(); - - return $comparisons; - } - - /** - * {@inheritdoc} - */ - public function provideValidComparisons() - { - $date = new \DateTime('2000-01-01'); - $object = new ComparisonTest_Class(2); - - $comparisons = array( - array(3, 3), - array('a', 'a'), - array($date, $date), - array($object, $object), - array(null, 1), - ); - - if (version_compare(PHP_VERSION, '>=', '5.5')) { - $immutableDate = new \DateTimeImmutable('2000-01-01'); - $comparisons[] = array($immutableDate, $immutableDate); - } - - return $comparisons; - } - - /** - * {@inheritdoc} - */ - public function provideInvalidComparisons() - { - return array( - array(1, '1', 2, '2', 'integer'), - array(2, '2', '2', '"2"', 'string'), - array('22', '"22"', '333', '"333"', 'string'), - array(new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', 'DateTime'), - array(new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', new \DateTime('1999-01-01'), 'Jan 1, 1999, 12:00 AM', 'DateTime'), - array(new ComparisonTest_Class(4), '4', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php deleted file mode 100644 index 18f9c1b..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php +++ /dev/null @@ -1,329 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Image; -use Symfony\Component\Validator\Constraints\ImageValidator; -use Symfony\Component\Validator\Validation; - -class ImageValidatorTest extends AbstractConstraintValidatorTest -{ - protected $context; - - /** - * @var ImageValidator - */ - protected $validator; - - protected $path; - protected $image; - protected $imageLandscape; - protected $imagePortrait; - protected $image4By3; - - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new ImageValidator(); - } - - protected function setUp() - { - parent::setUp(); - - $this->image = __DIR__.'/Fixtures/test.gif'; - $this->imageLandscape = __DIR__.'/Fixtures/test_landscape.gif'; - $this->imagePortrait = __DIR__.'/Fixtures/test_portrait.gif'; - $this->image4By3 = __DIR__.'/Fixtures/test_4by3.gif'; - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Image()); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $this->validator->validate('', new Image()); - - $this->assertNoViolation(); - } - - public function testValidImage() - { - $this->validator->validate($this->image, new Image()); - - $this->assertNoViolation(); - } - - public function testFileNotFound() - { - // Check that the logic from FileValidator still works - $constraint = new Image(array( - 'notFoundMessage' => 'myMessage', - )); - - $this->validator->validate('foobar', $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ file }}', '"foobar"') - ->setCode(Image::NOT_FOUND_ERROR) - ->assertRaised(); - } - - public function testValidSize() - { - $constraint = new Image(array( - 'minWidth' => 1, - 'maxWidth' => 2, - 'minHeight' => 1, - 'maxHeight' => 2, - )); - - $this->validator->validate($this->image, $constraint); - - $this->assertNoViolation(); - } - - public function testWidthTooSmall() - { - $constraint = new Image(array( - 'minWidth' => 3, - 'minWidthMessage' => 'myMessage', - )); - - $this->validator->validate($this->image, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ width }}', '2') - ->setParameter('{{ min_width }}', '3') - ->setCode(Image::TOO_NARROW_ERROR) - ->assertRaised(); - } - - public function testWidthTooBig() - { - $constraint = new Image(array( - 'maxWidth' => 1, - 'maxWidthMessage' => 'myMessage', - )); - - $this->validator->validate($this->image, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ width }}', '2') - ->setParameter('{{ max_width }}', '1') - ->setCode(Image::TOO_WIDE_ERROR) - ->assertRaised(); - } - - public function testHeightTooSmall() - { - $constraint = new Image(array( - 'minHeight' => 3, - 'minHeightMessage' => 'myMessage', - )); - - $this->validator->validate($this->image, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ height }}', '2') - ->setParameter('{{ min_height }}', '3') - ->setCode(Image::TOO_LOW_ERROR) - ->assertRaised(); - } - - public function testHeightTooBig() - { - $constraint = new Image(array( - 'maxHeight' => 1, - 'maxHeightMessage' => 'myMessage', - )); - - $this->validator->validate($this->image, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ height }}', '2') - ->setParameter('{{ max_height }}', '1') - ->setCode(Image::TOO_HIGH_ERROR) - ->assertRaised(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testInvalidMinWidth() - { - $constraint = new Image(array( - 'minWidth' => '1abc', - )); - - $this->validator->validate($this->image, $constraint); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testInvalidMaxWidth() - { - $constraint = new Image(array( - 'maxWidth' => '1abc', - )); - - $this->validator->validate($this->image, $constraint); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testInvalidMinHeight() - { - $constraint = new Image(array( - 'minHeight' => '1abc', - )); - - $this->validator->validate($this->image, $constraint); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testInvalidMaxHeight() - { - $constraint = new Image(array( - 'maxHeight' => '1abc', - )); - - $this->validator->validate($this->image, $constraint); - } - - public function testRatioTooSmall() - { - $constraint = new Image(array( - 'minRatio' => 2, - 'minRatioMessage' => 'myMessage', - )); - - $this->validator->validate($this->image, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ ratio }}', 1) - ->setParameter('{{ min_ratio }}', 2) - ->setCode(Image::RATIO_TOO_SMALL_ERROR) - ->assertRaised(); - } - - public function testRatioTooBig() - { - $constraint = new Image(array( - 'maxRatio' => 0.5, - 'maxRatioMessage' => 'myMessage', - )); - - $this->validator->validate($this->image, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ ratio }}', 1) - ->setParameter('{{ max_ratio }}', 0.5) - ->setCode(Image::RATIO_TOO_BIG_ERROR) - ->assertRaised(); - } - - public function testMaxRatioUsesTwoDecimalsOnly() - { - $constraint = new Image(array( - 'maxRatio' => 1.33, - )); - - $this->validator->validate($this->image4By3, $constraint); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testInvalidMinRatio() - { - $constraint = new Image(array( - 'minRatio' => '1abc', - )); - - $this->validator->validate($this->image, $constraint); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testInvalidMaxRatio() - { - $constraint = new Image(array( - 'maxRatio' => '1abc', - )); - - $this->validator->validate($this->image, $constraint); - } - - public function testSquareNotAllowed() - { - $constraint = new Image(array( - 'allowSquare' => false, - 'allowSquareMessage' => 'myMessage', - )); - - $this->validator->validate($this->image, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ width }}', 2) - ->setParameter('{{ height }}', 2) - ->setCode(Image::SQUARE_NOT_ALLOWED_ERROR) - ->assertRaised(); - } - - public function testLandscapeNotAllowed() - { - $constraint = new Image(array( - 'allowLandscape' => false, - 'allowLandscapeMessage' => 'myMessage', - )); - - $this->validator->validate($this->imageLandscape, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ width }}', 2) - ->setParameter('{{ height }}', 1) - ->setCode(Image::LANDSCAPE_NOT_ALLOWED_ERROR) - ->assertRaised(); - } - - public function testPortraitNotAllowed() - { - $constraint = new Image(array( - 'allowPortrait' => false, - 'allowPortraitMessage' => 'myMessage', - )); - - $this->validator->validate($this->imagePortrait, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ width }}', 1) - ->setParameter('{{ height }}', 2) - ->setCode(Image::PORTRAIT_NOT_ALLOWED_ERROR) - ->assertRaised(); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php deleted file mode 100644 index fc40e61..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php +++ /dev/null @@ -1,444 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Ip; -use Symfony\Component\Validator\Constraints\IpValidator; -use Symfony\Component\Validator\Validation; - -class IpValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new IpValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Ip()); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $this->validator->validate('', new Ip()); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsStringCompatibleType() - { - $this->validator->validate(new \stdClass(), new Ip()); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testInvalidValidatorVersion() - { - new Ip(array( - 'version' => 666, - )); - } - - /** - * @dataProvider getValidIpsV4 - */ - public function testValidIpsV4($ip) - { - $this->validator->validate($ip, new Ip(array( - 'version' => Ip::V4, - ))); - - $this->assertNoViolation(); - } - - public function getValidIpsV4() - { - return array( - array('0.0.0.0'), - array('10.0.0.0'), - array('123.45.67.178'), - array('172.16.0.0'), - array('192.168.1.0'), - array('224.0.0.1'), - array('255.255.255.255'), - array('127.0.0.0'), - ); - } - - /** - * @dataProvider getValidIpsV6 - */ - public function testValidIpsV6($ip) - { - $this->validator->validate($ip, new Ip(array( - 'version' => Ip::V6, - ))); - - $this->assertNoViolation(); - } - - public function getValidIpsV6() - { - return array( - array('2001:0db8:85a3:0000:0000:8a2e:0370:7334'), - array('2001:0DB8:85A3:0000:0000:8A2E:0370:7334'), - array('2001:0Db8:85a3:0000:0000:8A2e:0370:7334'), - array('fdfe:dcba:9876:ffff:fdc6:c46b:bb8f:7d4c'), - array('fdc6:c46b:bb8f:7d4c:fdc6:c46b:bb8f:7d4c'), - array('fdc6:c46b:bb8f:7d4c:0000:8a2e:0370:7334'), - array('fe80:0000:0000:0000:0202:b3ff:fe1e:8329'), - array('fe80:0:0:0:202:b3ff:fe1e:8329'), - array('fe80::202:b3ff:fe1e:8329'), - array('0:0:0:0:0:0:0:0'), - array('::'), - array('0::'), - array('::0'), - array('0::0'), - // IPv4 mapped to IPv6 - array('2001:0db8:85a3:0000:0000:8a2e:0.0.0.0'), - array('::0.0.0.0'), - array('::255.255.255.255'), - array('::123.45.67.178'), - ); - } - - /** - * @dataProvider getValidIpsAll - */ - public function testValidIpsAll($ip) - { - $this->validator->validate($ip, new Ip(array( - 'version' => Ip::ALL, - ))); - - $this->assertNoViolation(); - } - - public function getValidIpsAll() - { - return array_merge($this->getValidIpsV4(), $this->getValidIpsV6()); - } - - /** - * @dataProvider getInvalidIpsV4 - */ - public function testInvalidIpsV4($ip) - { - $constraint = new Ip(array( - 'version' => Ip::V4, - 'message' => 'myMessage', - )); - - $this->validator->validate($ip, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$ip.'"') - ->assertRaised(); - } - - public function getInvalidIpsV4() - { - return array( - array('0'), - array('0.0'), - array('0.0.0'), - array('256.0.0.0'), - array('0.256.0.0'), - array('0.0.256.0'), - array('0.0.0.256'), - array('-1.0.0.0'), - array('foobar'), - ); - } - - /** - * @dataProvider getInvalidPrivateIpsV4 - */ - public function testInvalidPrivateIpsV4($ip) - { - $constraint = new Ip(array( - 'version' => Ip::V4_NO_PRIV, - 'message' => 'myMessage', - )); - - $this->validator->validate($ip, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$ip.'"') - ->assertRaised(); - } - - public function getInvalidPrivateIpsV4() - { - return array( - array('10.0.0.0'), - array('172.16.0.0'), - array('192.168.1.0'), - ); - } - - /** - * @dataProvider getInvalidReservedIpsV4 - */ - public function testInvalidReservedIpsV4($ip) - { - $constraint = new Ip(array( - 'version' => Ip::V4_NO_RES, - 'message' => 'myMessage', - )); - - $this->validator->validate($ip, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$ip.'"') - ->assertRaised(); - } - - public function getInvalidReservedIpsV4() - { - return array( - array('0.0.0.0'), - array('224.0.0.1'), - array('255.255.255.255'), - ); - } - - /** - * @dataProvider getInvalidPublicIpsV4 - */ - public function testInvalidPublicIpsV4($ip) - { - $constraint = new Ip(array( - 'version' => Ip::V4_ONLY_PUBLIC, - 'message' => 'myMessage', - )); - - $this->validator->validate($ip, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$ip.'"') - ->assertRaised(); - } - - public function getInvalidPublicIpsV4() - { - return array_merge($this->getInvalidPrivateIpsV4(), $this->getInvalidReservedIpsV4()); - } - - /** - * @dataProvider getInvalidIpsV6 - */ - public function testInvalidIpsV6($ip) - { - $constraint = new Ip(array( - 'version' => Ip::V6, - 'message' => 'myMessage', - )); - - $this->validator->validate($ip, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$ip.'"') - ->assertRaised(); - } - - public function getInvalidIpsV6() - { - return array( - array('z001:0db8:85a3:0000:0000:8a2e:0370:7334'), - array('fe80'), - array('fe80:8329'), - array('fe80:::202:b3ff:fe1e:8329'), - array('fe80::202:b3ff::fe1e:8329'), - // IPv4 mapped to IPv6 - array('2001:0db8:85a3:0000:0000:8a2e:0370:0.0.0.0'), - array('::0.0'), - array('::0.0.0'), - array('::256.0.0.0'), - array('::0.256.0.0'), - array('::0.0.256.0'), - array('::0.0.0.256'), - ); - } - - /** - * @dataProvider getInvalidPrivateIpsV6 - */ - public function testInvalidPrivateIpsV6($ip) - { - $constraint = new Ip(array( - 'version' => Ip::V6_NO_PRIV, - 'message' => 'myMessage', - )); - - $this->validator->validate($ip, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$ip.'"') - ->assertRaised(); - } - - public function getInvalidPrivateIpsV6() - { - return array( - array('fdfe:dcba:9876:ffff:fdc6:c46b:bb8f:7d4c'), - array('fdc6:c46b:bb8f:7d4c:fdc6:c46b:bb8f:7d4c'), - array('fdc6:c46b:bb8f:7d4c:0000:8a2e:0370:7334'), - ); - } - - /** - * @dataProvider getInvalidReservedIpsV6 - */ - public function testInvalidReservedIpsV6($ip) - { - $constraint = new Ip(array( - 'version' => Ip::V6_NO_RES, - 'message' => 'myMessage', - )); - - $this->validator->validate($ip, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$ip.'"') - ->assertRaised(); - } - - public function getInvalidReservedIpsV6() - { - // Quoting after official filter documentation: - // "FILTER_FLAG_NO_RES_RANGE = This flag does not apply to IPv6 addresses." - // Full description: http://php.net/manual/en/filter.filters.flags.php - return $this->getInvalidIpsV6(); - } - - /** - * @dataProvider getInvalidPublicIpsV6 - */ - public function testInvalidPublicIpsV6($ip) - { - $constraint = new Ip(array( - 'version' => Ip::V6_ONLY_PUBLIC, - 'message' => 'myMessage', - )); - - $this->validator->validate($ip, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$ip.'"') - ->assertRaised(); - } - - public function getInvalidPublicIpsV6() - { - return array_merge($this->getInvalidPrivateIpsV6(), $this->getInvalidReservedIpsV6()); - } - - /** - * @dataProvider getInvalidIpsAll - */ - public function testInvalidIpsAll($ip) - { - $constraint = new Ip(array( - 'version' => Ip::ALL, - 'message' => 'myMessage', - )); - - $this->validator->validate($ip, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$ip.'"') - ->assertRaised(); - } - - public function getInvalidIpsAll() - { - return array_merge($this->getInvalidIpsV4(), $this->getInvalidIpsV6()); - } - - /** - * @dataProvider getInvalidPrivateIpsAll - */ - public function testInvalidPrivateIpsAll($ip) - { - $constraint = new Ip(array( - 'version' => Ip::ALL_NO_PRIV, - 'message' => 'myMessage', - )); - - $this->validator->validate($ip, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$ip.'"') - ->assertRaised(); - } - - public function getInvalidPrivateIpsAll() - { - return array_merge($this->getInvalidPrivateIpsV4(), $this->getInvalidPrivateIpsV6()); - } - - /** - * @dataProvider getInvalidReservedIpsAll - */ - public function testInvalidReservedIpsAll($ip) - { - $constraint = new Ip(array( - 'version' => Ip::ALL_NO_RES, - 'message' => 'myMessage', - )); - - $this->validator->validate($ip, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$ip.'"') - ->assertRaised(); - } - - public function getInvalidReservedIpsAll() - { - return array_merge($this->getInvalidReservedIpsV4(), $this->getInvalidReservedIpsV6()); - } - - /** - * @dataProvider getInvalidPublicIpsAll - */ - public function testInvalidPublicIpsAll($ip) - { - $constraint = new Ip(array( - 'version' => Ip::ALL_ONLY_PUBLIC, - 'message' => 'myMessage', - )); - - $this->validator->validate($ip, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$ip.'"') - ->assertRaised(); - } - - public function getInvalidPublicIpsAll() - { - return array_merge($this->getInvalidPublicIpsV4(), $this->getInvalidPublicIpsV6()); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/IsbnValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/IsbnValidatorTest.php deleted file mode 100644 index e73b89d..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/IsbnValidatorTest.php +++ /dev/null @@ -1,271 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Isbn; -use Symfony\Component\Validator\Constraints\IsbnValidator; -use Symfony\Component\Validator\Validation; - -/** - * @see https://en.wikipedia.org/wiki/Isbn - */ -class IsbnValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new IsbnValidator(); - } - - public function getValidIsbn10() - { - return array( - array('2723442284'), - array('2723442276'), - array('2723455041'), - array('2070546810'), - array('2711858839'), - array('2756406767'), - array('2870971648'), - array('226623854X'), - array('2851806424'), - array('0321812700'), - array('0-45122-5244'), - array('0-4712-92311'), - array('0-9752298-0-X'), - ); - } - - public function getInvalidIsbn10() - { - return array( - array('27234422841', Isbn::TOO_LONG_ERROR), - array('272344228', Isbn::TOO_SHORT_ERROR), - array('0-4712-9231', Isbn::TOO_SHORT_ERROR), - array('1234567890', Isbn::CHECKSUM_FAILED_ERROR), - array('0987656789', Isbn::CHECKSUM_FAILED_ERROR), - array('7-35622-5444', Isbn::CHECKSUM_FAILED_ERROR), - array('0-4X19-92611', Isbn::CHECKSUM_FAILED_ERROR), - array('0_45122_5244', Isbn::INVALID_CHARACTERS_ERROR), - array('2870#971#648', Isbn::INVALID_CHARACTERS_ERROR), - array('0-9752298-0-x', Isbn::INVALID_CHARACTERS_ERROR), - array('1A34567890', Isbn::INVALID_CHARACTERS_ERROR), - // chr(1) evaluates to 0 - // 2070546810 is valid - array('2'.chr(1).'70546810', Isbn::INVALID_CHARACTERS_ERROR), - ); - } - - public function getValidIsbn13() - { - return array( - array('978-2723442282'), - array('978-2723442275'), - array('978-2723455046'), - array('978-2070546817'), - array('978-2711858835'), - array('978-2756406763'), - array('978-2870971642'), - array('978-2266238540'), - array('978-2851806420'), - array('978-0321812704'), - array('978-0451225245'), - array('978-0471292319'), - ); - } - - public function getInvalidIsbn13() - { - return array( - array('978-27234422821', Isbn::TOO_LONG_ERROR), - array('978-272344228', Isbn::TOO_SHORT_ERROR), - array('978-2723442-82', Isbn::TOO_SHORT_ERROR), - array('978-2723442281', Isbn::CHECKSUM_FAILED_ERROR), - array('978-0321513774', Isbn::CHECKSUM_FAILED_ERROR), - array('979-0431225385', Isbn::CHECKSUM_FAILED_ERROR), - array('980-0474292319', Isbn::CHECKSUM_FAILED_ERROR), - array('0-4X19-92619812', Isbn::INVALID_CHARACTERS_ERROR), - array('978_2723442282', Isbn::INVALID_CHARACTERS_ERROR), - array('978#2723442282', Isbn::INVALID_CHARACTERS_ERROR), - array('978-272C442282', Isbn::INVALID_CHARACTERS_ERROR), - // chr(1) evaluates to 0 - // 978-2070546817 is valid - array('978-2'.chr(1).'70546817', Isbn::INVALID_CHARACTERS_ERROR), - ); - } - - public function getValidIsbn() - { - return array_merge( - $this->getValidIsbn10(), - $this->getValidIsbn13() - ); - } - - public function getInvalidIsbn() - { - return array_merge( - $this->getInvalidIsbn10(), - $this->getInvalidIsbn13() - ); - } - - public function testNullIsValid() - { - $constraint = new Isbn(true); - - $this->validator->validate(null, $constraint); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $constraint = new Isbn(true); - - $this->validator->validate('', $constraint); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsStringCompatibleType() - { - $constraint = new Isbn(true); - - $this->validator->validate(new \stdClass(), $constraint); - } - - /** - * @dataProvider getValidIsbn10 - */ - public function testValidIsbn10($isbn) - { - $constraint = new Isbn(array( - 'type' => 'isbn10', - )); - - $this->validator->validate($isbn, $constraint); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getInvalidIsbn10 - */ - public function testInvalidIsbn10($isbn, $code) - { - $constraint = new Isbn(array( - 'type' => 'isbn10', - 'isbn10Message' => 'myMessage', - )); - - $this->validator->validate($isbn, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$isbn.'"') - ->setCode($code) - ->assertRaised(); - } - - /** - * @dataProvider getValidIsbn13 - */ - public function testValidIsbn13($isbn) - { - $constraint = new Isbn(array('type' => 'isbn13')); - - $this->validator->validate($isbn, $constraint); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getInvalidIsbn13 - */ - public function testInvalidIsbn13($isbn, $code) - { - $constraint = new Isbn(array( - 'type' => 'isbn13', - 'isbn13Message' => 'myMessage', - )); - - $this->validator->validate($isbn, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$isbn.'"') - ->setCode($code) - ->assertRaised(); - } - - /** - * @dataProvider getValidIsbn - */ - public function testValidIsbnAny($isbn) - { - $constraint = new Isbn(); - - $this->validator->validate($isbn, $constraint); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getInvalidIsbn10 - */ - public function testInvalidIsbnAnyIsbn10($isbn, $code) - { - $constraint = new Isbn(array( - 'bothIsbnMessage' => 'myMessage', - )); - - $this->validator->validate($isbn, $constraint); - - // Too long for an ISBN-10, but not long enough for an ISBN-13 - if (Isbn::TOO_LONG_ERROR === $code) { - $code = Isbn::TYPE_NOT_RECOGNIZED_ERROR; - } - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$isbn.'"') - ->setCode($code) - ->assertRaised(); - } - - /** - * @dataProvider getInvalidIsbn13 - */ - public function testInvalidIsbnAnyIsbn13($isbn, $code) - { - $constraint = new Isbn(array( - 'bothIsbnMessage' => 'myMessage', - )); - - $this->validator->validate($isbn, $constraint); - - // Too short for an ISBN-13, but not short enough for an ISBN-10 - if (Isbn::TOO_SHORT_ERROR === $code) { - $code = Isbn::TYPE_NOT_RECOGNIZED_ERROR; - } - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$isbn.'"') - ->setCode($code) - ->assertRaised(); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/IssnValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/IssnValidatorTest.php deleted file mode 100644 index a6d3994..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/IssnValidatorTest.php +++ /dev/null @@ -1,187 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Issn; -use Symfony\Component\Validator\Constraints\IssnValidator; -use Symfony\Component\Validator\Validation; - -/** - * @see https://en.wikipedia.org/wiki/Issn - */ -class IssnValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new IssnValidator(); - } - - public function getValidLowerCasedIssn() - { - return array( - array('2162-321x'), - array('2160-200x'), - array('1537-453x'), - array('1937-710x'), - array('0002-922x'), - array('1553-345x'), - array('1553-619x'), - ); - } - - public function getValidNonHyphenatedIssn() - { - return array( - array('2162321X'), - array('01896016'), - array('15744647'), - array('14350645'), - array('07174055'), - array('20905076'), - array('14401592'), - ); - } - - public function getFullValidIssn() - { - return array( - array('1550-7416'), - array('1539-8560'), - array('2156-5376'), - array('1119-023X'), - array('1684-5315'), - array('1996-0786'), - array('1684-5374'), - array('1996-0794'), - ); - } - - public function getValidIssn() - { - return array_merge( - $this->getValidLowerCasedIssn(), - $this->getValidNonHyphenatedIssn(), - $this->getFullValidIssn() - ); - } - - public function getInvalidIssn() - { - return array( - array(0, Issn::TOO_SHORT_ERROR), - array('1539', Issn::TOO_SHORT_ERROR), - array('2156-537A', Issn::INVALID_CHARACTERS_ERROR), - array('1119-0231', Issn::CHECKSUM_FAILED_ERROR), - array('1684-5312', Issn::CHECKSUM_FAILED_ERROR), - array('1996-0783', Issn::CHECKSUM_FAILED_ERROR), - array('1684-537X', Issn::CHECKSUM_FAILED_ERROR), - array('1996-0795', Issn::CHECKSUM_FAILED_ERROR), - ); - } - - public function testNullIsValid() - { - $constraint = new Issn(); - - $this->validator->validate(null, $constraint); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $constraint = new Issn(); - - $this->validator->validate('', $constraint); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsStringCompatibleType() - { - $constraint = new Issn(); - $this->validator->validate(new \stdClass(), $constraint); - } - - /** - * @dataProvider getValidLowerCasedIssn - */ - public function testCaseSensitiveIssns($issn) - { - $constraint = new Issn(array( - 'caseSensitive' => true, - 'message' => 'myMessage', - )); - - $this->validator->validate($issn, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$issn.'"') - ->setCode(Issn::INVALID_CASE_ERROR) - ->assertRaised(); - } - - /** - * @dataProvider getValidNonHyphenatedIssn - */ - public function testRequireHyphenIssns($issn) - { - $constraint = new Issn(array( - 'requireHyphen' => true, - 'message' => 'myMessage', - )); - - $this->validator->validate($issn, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$issn.'"') - ->setCode(Issn::MISSING_HYPHEN_ERROR) - ->assertRaised(); - } - - /** - * @dataProvider getValidIssn - */ - public function testValidIssn($issn) - { - $constraint = new Issn(); - - $this->validator->validate($issn, $constraint); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getInvalidIssn - */ - public function testInvalidIssn($issn, $code) - { - $constraint = new Issn(array( - 'message' => 'myMessage', - )); - - $this->validator->validate($issn, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$issn.'"') - ->setCode($code) - ->assertRaised(); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php deleted file mode 100644 index 6f7c390..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php +++ /dev/null @@ -1,114 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Intl\Util\IntlTestHelper; -use Symfony\Component\Validator\Constraints\Language; -use Symfony\Component\Validator\Constraints\LanguageValidator; -use Symfony\Component\Validator\Validation; - -class LanguageValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new LanguageValidator(); - } - - protected function setUp() - { - IntlTestHelper::requireFullIntl($this); - - parent::setUp(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Language()); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $this->validator->validate('', new Language()); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsStringCompatibleType() - { - $this->validator->validate(new \stdClass(), new Language()); - } - - /** - * @dataProvider getValidLanguages - */ - public function testValidLanguages($language) - { - $this->validator->validate($language, new Language()); - - $this->assertNoViolation(); - } - - public function getValidLanguages() - { - return array( - array('en'), - array('en_US'), - array('my'), - ); - } - - /** - * @dataProvider getInvalidLanguages - */ - public function testInvalidLanguages($language) - { - $constraint = new Language(array( - 'message' => 'myMessage', - )); - - $this->validator->validate($language, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$language.'"') - ->assertRaised(); - } - - public function getInvalidLanguages() - { - return array( - array('EN'), - array('foobar'), - ); - } - - public function testValidateUsingCountrySpecificLocale() - { - \Locale::setDefault('fr_FR'); - $existingLanguage = 'en'; - - $this->validator->validate($existingLanguage, new Language(array( - 'message' => 'aMessage', - ))); - - $this->assertNoViolation(); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyAllValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyAllValidator2Dot4ApiTest.php deleted file mode 100644 index d5a41fb..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyAllValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyAllValidator2Dot4ApiTest extends AllValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyAllValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyAllValidatorLegacyApiTest.php deleted file mode 100644 index 649bfe1..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyAllValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyAllValidatorLegacyApiTest extends AllValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyBlankValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyBlankValidator2Dot4ApiTest.php deleted file mode 100644 index 0cfb1aa..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyBlankValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyBlankValidator2Dot4ApiTest extends BlankValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyBlankValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyBlankValidatorLegacyApiTest.php deleted file mode 100644 index 00b8a7a..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyBlankValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyBlankValidatorLegacyApiTest extends BlankValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCallbackValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCallbackValidator2Dot4ApiTest.php deleted file mode 100644 index efcb5ec..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCallbackValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyCallbackValidator2Dot4ApiTest extends CallbackValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCallbackValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCallbackValidatorLegacyApiTest.php deleted file mode 100644 index 8f3ea2b..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCallbackValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyCallbackValidatorLegacyApiTest extends CallbackValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCardSchemeValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCardSchemeValidator2Dot4ApiTest.php deleted file mode 100644 index 0f467dd..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCardSchemeValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyCardSchemeValidator2Dot4ApiTest extends CardSchemeValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCardSchemeValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCardSchemeValidatorLegacyApiTest.php deleted file mode 100644 index e4b4184..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCardSchemeValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyCardSchemeValidatorLegacyApiTest extends CardSchemeValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyChoiceValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyChoiceValidator2Dot4ApiTest.php deleted file mode 100644 index 71277f7..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyChoiceValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyChoiceValidator2Dot4ApiTest extends ChoiceValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyChoiceValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyChoiceValidatorLegacyApiTest.php deleted file mode 100644 index 9237df5..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyChoiceValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyChoiceValidatorLegacyApiTest extends ChoiceValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorArray2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorArray2Dot4ApiTest.php deleted file mode 100644 index 3826914..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorArray2Dot4ApiTest.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @group legacy - */ -class LegacyCollectionValidatorArray2Dot4ApiTest extends CollectionValidatorArrayTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorArrayLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorArrayLegacyApiTest.php deleted file mode 100644 index 45ca1df..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorArrayLegacyApiTest.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @group legacy - */ -class LegacyCollectionValidatorArrayLegacyApiTest extends CollectionValidatorArrayTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorArrayObject2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorArrayObject2Dot4ApiTest.php deleted file mode 100644 index 22dbe46..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorArrayObject2Dot4ApiTest.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @group legacy - */ -class LegacyCollectionValidatorArrayObject2Dot4ApiTest extends CollectionValidatorArrayObjectTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorArrayObjectLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorArrayObjectLegacyApiTest.php deleted file mode 100644 index f28aed3..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorArrayObjectLegacyApiTest.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @group legacy - */ -class LegacyCollectionValidatorArrayObjectLegacyApiTest extends CollectionValidatorArrayObjectTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorCustomArrayObject2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorCustomArrayObject2Dot4ApiTest.php deleted file mode 100644 index 29ce241..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorCustomArrayObject2Dot4ApiTest.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @group legacy - */ -class LegacyCollectionValidatorCustomArrayObject2Dot4ApiTest extends CollectionValidatorCustomArrayObjectTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorCustomArrayObjectLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorCustomArrayObjectLegacyApiTest.php deleted file mode 100644 index b04053f..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCollectionValidatorCustomArrayObjectLegacyApiTest.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @group legacy - */ -class LegacyCollectionValidatorCustomArrayObjectLegacyApiTest extends CollectionValidatorCustomArrayObjectTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCountValidatorArray2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCountValidatorArray2Dot4ApiTest.php deleted file mode 100644 index 2ab8b19..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCountValidatorArray2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyCountValidatorArray2Dot4ApiTest extends CountValidatorArrayTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCountValidatorArrayLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCountValidatorArrayLegacyApiTest.php deleted file mode 100644 index d362988..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCountValidatorArrayLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyCountValidatorArrayLegacyApiTest extends CountValidatorArrayTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCountValidatorCountable2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCountValidatorCountable2Dot4ApiTest.php deleted file mode 100644 index d0239bb..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCountValidatorCountable2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyCountValidatorCountable2Dot4ApiTest extends CountValidatorCountableTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCountValidatorCountableLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCountValidatorCountableLegacyApiTest.php deleted file mode 100644 index 33b8795..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCountValidatorCountableLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyCountValidatorCountableLegacyApiTest extends CountValidatorCountableTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCurrencyValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCurrencyValidator2Dot4ApiTest.php deleted file mode 100644 index 30685d4..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCurrencyValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyCurrencyValidator2Dot4ApiTest extends CurrencyValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCurrencyValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCurrencyValidatorLegacyApiTest.php deleted file mode 100644 index 85cd5d0..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyCurrencyValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyCurrencyValidatorLegacyApiTest extends CurrencyValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyDateTimeValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyDateTimeValidator2Dot4ApiTest.php deleted file mode 100644 index 6c2f6a5..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyDateTimeValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyDateTimeValidator2Dot4ApiTest extends DateTimeValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyDateTimeValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyDateTimeValidatorLegacyApiTest.php deleted file mode 100644 index be19302..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyDateTimeValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyDateTimeValidatorLegacyApiTest extends DateTimeValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyDateValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyDateValidator2Dot4ApiTest.php deleted file mode 100644 index aab7d43..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyDateValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyDateValidator2Dot4ApiTest extends DateValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyDateValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyDateValidatorLegacyApiTest.php deleted file mode 100644 index 3235f42..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyDateValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyDateValidatorLegacyApiTest extends DateValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyEmailValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyEmailValidator2Dot4ApiTest.php deleted file mode 100644 index 12ccb5e..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyEmailValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyEmailValidator2Dot4ApiTest extends EmailValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyEmailValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyEmailValidatorLegacyApiTest.php deleted file mode 100644 index e5f1019..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyEmailValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyEmailValidatorLegacyApiTest extends EmailValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyEqualToValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyEqualToValidator2Dot4ApiTest.php deleted file mode 100644 index 1c7008a..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyEqualToValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyEqualToValidator2Dot4ApiTest extends EqualToValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyEqualToValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyEqualToValidatorLegacyApiTest.php deleted file mode 100644 index 3a72cfb..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyEqualToValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyEqualToValidatorLegacyApiTest extends EqualToValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyExpressionValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyExpressionValidator2Dot4ApiTest.php deleted file mode 100644 index 914e580..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyExpressionValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyExpressionValidator2Dot4ApiTest extends ExpressionValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyExpressionValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyExpressionValidatorLegacyApiTest.php deleted file mode 100644 index 374bba0..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyExpressionValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyExpressionValidatorLegacyApiTest extends ExpressionValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyFalseValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyFalseValidator2Dot4ApiTest.php deleted file mode 100644 index 3d65f4e..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyFalseValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyFalseValidator2Dot4ApiTest extends FalseValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyFalseValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyFalseValidatorLegacyApiTest.php deleted file mode 100644 index 5f7cb12..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyFalseValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyFalseValidatorLegacyApiTest extends FalseValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyFileValidatorObject2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyFileValidatorObject2Dot4ApiTest.php deleted file mode 100644 index 3035e41..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyFileValidatorObject2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyFileValidatorObject2Dot4ApiTest extends FileValidatorObjectTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyFileValidatorObjectLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyFileValidatorObjectLegacyApiTest.php deleted file mode 100644 index 97d5f59..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyFileValidatorObjectLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyFileValidatorObjectLegacyApiTest extends FileValidatorObjectTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyFileValidatorPath2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyFileValidatorPath2Dot4ApiTest.php deleted file mode 100644 index a154144..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyFileValidatorPath2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyFileValidatorPath2Dot4ApiTest extends FileValidatorPathTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyFileValidatorPathLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyFileValidatorPathLegacyApiTest.php deleted file mode 100644 index 2c298df..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyFileValidatorPathLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyFileValidatorPathLegacyApiTest extends FileValidatorPathTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyGreaterThanOrEqualValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyGreaterThanOrEqualValidator2Dot4ApiTest.php deleted file mode 100644 index 5f4a17e..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyGreaterThanOrEqualValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyGreaterThanOrEqualValidator2Dot4ApiTest extends GreaterThanOrEqualValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyGreaterThanOrEqualValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyGreaterThanOrEqualValidatorLegacyApiTest.php deleted file mode 100644 index 08822a5..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyGreaterThanOrEqualValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyGreaterThanOrEqualValidatorLegacyApiTest extends GreaterThanOrEqualValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyGreaterThanValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyGreaterThanValidator2Dot4ApiTest.php deleted file mode 100644 index 799e5d8..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyGreaterThanValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyGreaterThanValidator2Dot4ApiTest extends GreaterThanValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyGreaterThanValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyGreaterThanValidatorLegacyApiTest.php deleted file mode 100644 index 0808e9b..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyGreaterThanValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyGreaterThanValidatorLegacyApiTest extends GreaterThanValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIbanValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIbanValidator2Dot4ApiTest.php deleted file mode 100644 index 6dac309..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIbanValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyIbanValidator2Dot4ApiTest extends IbanValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIbanValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIbanValidatorLegacyApiTest.php deleted file mode 100644 index 0ffc4b1..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIbanValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyIbanValidatorLegacyApiTest extends IbanValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIdenticalToValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIdenticalToValidator2Dot4ApiTest.php deleted file mode 100644 index 99cd986..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIdenticalToValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyIdenticalToValidator2Dot4ApiTest extends IdenticalToValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIdenticalToValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIdenticalToValidatorLegacyApiTest.php deleted file mode 100644 index aade84f..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIdenticalToValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyIdenticalToValidatorLegacyApiTest extends IdenticalToValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyImageValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyImageValidator2Dot4ApiTest.php deleted file mode 100644 index 1fee081..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyImageValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyImageValidator2Dot4ApiTest extends ImageValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyImageValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyImageValidatorLegacyApiTest.php deleted file mode 100644 index d36c175..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyImageValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyImageValidatorLegacyApiTest extends ImageValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIpValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIpValidator2Dot4ApiTest.php deleted file mode 100644 index 99933cf..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIpValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyIpValidator2Dot4ApiTest extends IpValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIpValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIpValidatorLegacyApiTest.php deleted file mode 100644 index 315f2f9..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIpValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyIpValidatorLegacyApiTest extends IpValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIsbnValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIsbnValidator2Dot4ApiTest.php deleted file mode 100644 index 29455bd..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIsbnValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyIsbnValidator2Dot4ApiTest extends IsbnValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIsbnValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIsbnValidatorLegacyApiTest.php deleted file mode 100644 index 1568270..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIsbnValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyIsbnValidatorLegacyApiTest extends IsbnValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIssnValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIssnValidator2Dot4ApiTest.php deleted file mode 100644 index 3713fb0..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIssnValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyIssnValidator2Dot4ApiTest extends IssnValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIssnValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIssnValidatorLegacyApiTest.php deleted file mode 100644 index 2ff3104..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyIssnValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyIssnValidatorLegacyApiTest extends IssnValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLanguageValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLanguageValidator2Dot4ApiTest.php deleted file mode 100644 index f712075..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLanguageValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyLanguageValidator2Dot4ApiTest extends LanguageValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLanguageValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLanguageValidatorLegacyApiTest.php deleted file mode 100644 index a6471b3..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLanguageValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyLanguageValidatorLegacyApiTest extends LanguageValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLengthValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLengthValidator2Dot4ApiTest.php deleted file mode 100644 index 686d376..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLengthValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyLengthValidator2Dot4ApiTest extends LengthValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLengthValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLengthValidatorLegacyApiTest.php deleted file mode 100644 index 655f3d6..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLengthValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyLengthValidatorLegacyApiTest extends LengthValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLessThanOrEqualValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLessThanOrEqualValidator2Dot4ApiTest.php deleted file mode 100644 index f345ec3..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLessThanOrEqualValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyLessThanOrEqualValidator2Dot4ApiTest extends LessThanOrEqualValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLessThanOrEqualValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLessThanOrEqualValidatorLegacyApiTest.php deleted file mode 100644 index 2e07ab0..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLessThanOrEqualValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyLessThanOrEqualValidatorLegacyApiTest extends LessThanOrEqualValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLessThanValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLessThanValidator2Dot4ApiTest.php deleted file mode 100644 index 074450d..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLessThanValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyLessThanValidator2Dot4ApiTest extends LessThanValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLessThanValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLessThanValidatorLegacyApiTest.php deleted file mode 100644 index 27592b0..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLessThanValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyLessThanValidatorLegacyApiTest extends LessThanValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLocaleValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLocaleValidator2Dot4ApiTest.php deleted file mode 100644 index 4d119bb..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLocaleValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyLocaleValidator2Dot4ApiTest extends LocaleValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLocaleValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLocaleValidatorLegacyApiTest.php deleted file mode 100644 index f55d422..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLocaleValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyLocaleValidatorLegacyApiTest extends LocaleValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLuhnValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLuhnValidator2Dot4ApiTest.php deleted file mode 100644 index 8207ca0..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLuhnValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyLuhnValidator2Dot4ApiTest extends LuhnValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLuhnValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLuhnValidatorLegacyApiTest.php deleted file mode 100644 index 5855526..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyLuhnValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyLuhnValidatorLegacyApiTest extends LuhnValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotBlankValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotBlankValidator2Dot4ApiTest.php deleted file mode 100644 index a6d0faa..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotBlankValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyNotBlankValidator2Dot4ApiTest extends NotBlankValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotBlankValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotBlankValidatorLegacyApiTest.php deleted file mode 100644 index 0aaaa77..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotBlankValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyNotBlankValidatorLegacyApiTest extends NotBlankValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotEqualToValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotEqualToValidator2Dot4ApiTest.php deleted file mode 100644 index e48450e..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotEqualToValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyNotEqualToValidator2Dot4ApiTest extends NotEqualToValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotEqualToValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotEqualToValidatorLegacyApiTest.php deleted file mode 100644 index df88f96..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotEqualToValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyNotEqualToValidatorLegacyApiTest extends NotEqualToValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotIdenticalToValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotIdenticalToValidator2Dot4ApiTest.php deleted file mode 100644 index 2c00cf5..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotIdenticalToValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyNotIdenticalToValidator2Dot4ApiTest extends NotIdenticalToValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotIdenticalToValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotIdenticalToValidatorLegacyApiTest.php deleted file mode 100644 index 25819a6..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotIdenticalToValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyNotIdenticalToValidatorLegacyApiTest extends NotIdenticalToValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotNullValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotNullValidator2Dot4ApiTest.php deleted file mode 100644 index 39b0038..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotNullValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyNotNullValidator2Dot4ApiTest extends NotNullValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotNullValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotNullValidatorLegacyApiTest.php deleted file mode 100644 index 41a9e54..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNotNullValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyNotNullValidatorLegacyApiTest extends NotNullValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNullValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNullValidator2Dot4ApiTest.php deleted file mode 100644 index 958e446..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNullValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyNullValidator2Dot4ApiTest extends NullValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNullValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNullValidatorLegacyApiTest.php deleted file mode 100644 index 79536ce..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyNullValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyNullValidatorLegacyApiTest extends NullValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyRangeValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyRangeValidator2Dot4ApiTest.php deleted file mode 100644 index fe23ce8..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyRangeValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyRangeValidator2Dot4ApiTest extends RangeValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyRangeValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyRangeValidatorLegacyApiTest.php deleted file mode 100644 index 866a59a..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyRangeValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyRangeValidatorLegacyApiTest extends RangeValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyRegexValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyRegexValidator2Dot4ApiTest.php deleted file mode 100644 index dbae24e..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyRegexValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyRegexValidator2Dot4ApiTest extends RegexValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyRegexValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyRegexValidatorLegacyApiTest.php deleted file mode 100644 index ed1a464..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyRegexValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyRegexValidatorLegacyApiTest extends RegexValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyTimeValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyTimeValidator2Dot4ApiTest.php deleted file mode 100644 index d4a0678..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyTimeValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyTimeValidator2Dot4ApiTest extends TimeValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyTimeValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyTimeValidatorLegacyApiTest.php deleted file mode 100644 index 2458d87..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyTimeValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyTimeValidatorLegacyApiTest extends TimeValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyTrueValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyTrueValidator2Dot4ApiTest.php deleted file mode 100644 index 3d00252..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyTrueValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyTrueValidator2Dot4ApiTest extends TrueValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyTrueValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyTrueValidatorLegacyApiTest.php deleted file mode 100644 index 706c083..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyTrueValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyTrueValidatorLegacyApiTest extends TrueValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyTypeValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyTypeValidator2Dot4ApiTest.php deleted file mode 100644 index aed1d0a..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyTypeValidator2Dot4ApiTest.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyTypeValidator2Dot4ApiTest extends TypeValidatorTest -{ - /** - * PhpUnit calls data providers of test suites before launching the test - * suite. If this property is not replicated in every test class, only one - * file will ever be created and stored in TypeValidatorTest::$file. After - * the execution of the first TypeValidator test case, tearDownAfterClass() - * is called and closes the file. Hence the resource is not available - * anymore in the other TypeValidator test cases. - */ - protected static $file; - - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyTypeValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyTypeValidatorLegacyApiTest.php deleted file mode 100644 index 26eb39f..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyTypeValidatorLegacyApiTest.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyTypeValidatorLegacyApiTest extends TypeValidatorTest -{ - protected static $file; - - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyUrlValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyUrlValidator2Dot4ApiTest.php deleted file mode 100644 index 287d719..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyUrlValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyUrlValidator2Dot4ApiTest extends UrlValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyUrlValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyUrlValidatorLegacyApiTest.php deleted file mode 100644 index 0830ddb..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyUrlValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyUrlValidatorLegacyApiTest extends UrlValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyUuidValidator2Dot4ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyUuidValidator2Dot4ApiTest.php deleted file mode 100644 index b5efc76..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyUuidValidator2Dot4ApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyUuidValidator2Dot4ApiTest extends UrlValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_4; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyUuidValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyUuidValidatorLegacyApiTest.php deleted file mode 100644 index 4a4e362..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LegacyUuidValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Validation; - -/** - * @since 2.5.3 - * @author Bernhard Schussek - * @group legacy - */ -class LegacyUuidValidatorLegacyApiTest extends UuidValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php deleted file mode 100644 index 24b6306..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php +++ /dev/null @@ -1,255 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Length; -use Symfony\Component\Validator\Constraints\LengthValidator; -use Symfony\Component\Validator\Validation; - -class LengthValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new LengthValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Length(6)); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $this->validator->validate('', new Length(6)); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsStringCompatibleType() - { - $this->validator->validate(new \stdClass(), new Length(5)); - } - - public function getThreeOrLessCharacters() - { - return array( - array(12), - array('12'), - array('üü'), - array('éé'), - array(123), - array('123'), - array('üüü'), - array('ééé'), - ); - } - - public function getFourCharacters() - { - return array( - array(1234), - array('1234'), - array('üüüü'), - array('éééé'), - ); - } - - public function getFiveOrMoreCharacters() - { - return array( - array(12345), - array('12345'), - array('üüüüü'), - array('ééééé'), - array(123456), - array('123456'), - array('üüüüüü'), - array('éééééé'), - ); - } - - public function getOneCharset() - { - if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) { - $this->markTestSkipped('Mbstring or iconv is required for this test.'); - } - - return array( - array('é', 'utf8', true), - array("\xE9", 'CP1252', true), - array("\xE9", 'XXX', false), - array("\xE9", 'utf8', false), - ); - } - - /** - * @dataProvider getFiveOrMoreCharacters - */ - public function testValidValuesMin($value) - { - $constraint = new Length(array('min' => 5)); - $this->validator->validate($value, $constraint); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getThreeOrLessCharacters - */ - public function testValidValuesMax($value) - { - $constraint = new Length(array('max' => 3)); - $this->validator->validate($value, $constraint); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getFourCharacters - */ - public function testValidValuesExact($value) - { - $constraint = new Length(4); - $this->validator->validate($value, $constraint); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getThreeOrLessCharacters - */ - public function testInvalidValuesMin($value) - { - $constraint = new Length(array( - 'min' => 4, - 'minMessage' => 'myMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$value.'"') - ->setParameter('{{ limit }}', 4) - ->setInvalidValue($value) - ->setPlural(4) - ->setCode(Length::TOO_SHORT_ERROR) - ->assertRaised(); - } - - /** - * @dataProvider getFiveOrMoreCharacters - */ - public function testInvalidValuesMax($value) - { - $constraint = new Length(array( - 'max' => 4, - 'maxMessage' => 'myMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$value.'"') - ->setParameter('{{ limit }}', 4) - ->setInvalidValue($value) - ->setPlural(4) - ->setCode(Length::TOO_LONG_ERROR) - ->assertRaised(); - } - - /** - * @dataProvider getThreeOrLessCharacters - */ - public function testInvalidValuesExactLessThanFour($value) - { - $constraint = new Length(array( - 'min' => 4, - 'max' => 4, - 'exactMessage' => 'myMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$value.'"') - ->setParameter('{{ limit }}', 4) - ->setInvalidValue($value) - ->setPlural(4) - ->setCode(Length::TOO_SHORT_ERROR) - ->assertRaised(); - } - - /** - * @dataProvider getFiveOrMoreCharacters - */ - public function testInvalidValuesExactMoreThanFour($value) - { - $constraint = new Length(array( - 'min' => 4, - 'max' => 4, - 'exactMessage' => 'myMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$value.'"') - ->setParameter('{{ limit }}', 4) - ->setInvalidValue($value) - ->setPlural(4) - ->setCode(Length::TOO_LONG_ERROR) - ->assertRaised(); - } - - /** - * @dataProvider getOneCharset - */ - public function testOneCharset($value, $charset, $isValid) - { - $constraint = new Length(array( - 'min' => 1, - 'max' => 1, - 'charset' => $charset, - 'charsetMessage' => 'myMessage', - )); - - $this->validator->validate($value, $constraint); - - if ($isValid) { - $this->assertNoViolation(); - } else { - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$value.'"') - ->setParameter('{{ charset }}', $charset) - ->setInvalidValue($value) - ->assertRaised(); - } - } - - public function testConstraintGetDefaultOption() - { - $constraint = new Length(5); - - $this->assertEquals(5, $constraint->min); - $this->assertEquals(5, $constraint->max); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorTest.php deleted file mode 100644 index 7518135..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorTest.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\LessThanOrEqual; -use Symfony\Component\Validator\Constraints\LessThanOrEqualValidator; -use Symfony\Component\Validator\Validation; - -/** - * @author Daniel Holmes - */ -class LessThanOrEqualValidatorTest extends AbstractComparisonValidatorTestCase -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new LessThanOrEqualValidator(); - } - - protected function createConstraint(array $options) - { - return new LessThanOrEqual($options); - } - - /** - * {@inheritdoc} - */ - public function provideValidComparisons() - { - return array( - array(1, 2), - array(1, 1), - array(new \DateTime('2000-01-01'), new \DateTime('2000-01-01')), - array(new \DateTime('2000-01-01'), new \DateTime('2020-01-01')), - array(new \DateTime('2000-01-01'), '2000-01-01'), - array(new \DateTime('2000-01-01'), '2020-01-01'), - array(new \DateTime('2000-01-01 UTC'), '2000-01-01 UTC'), - array(new \DateTime('2000-01-01 UTC'), '2020-01-01 UTC'), - array(new ComparisonTest_Class(4), new ComparisonTest_Class(5)), - array(new ComparisonTest_Class(5), new ComparisonTest_Class(5)), - array('a', 'a'), - array('a', 'z'), - array(null, 1), - ); - } - - /** - * {@inheritdoc} - */ - public function provideInvalidComparisons() - { - return array( - array(2, '2', 1, '1', 'integer'), - array(new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2010-01-01 UTC'), 'Jan 1, 2010, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new ComparisonTest_Class(5), '5', new ComparisonTest_Class(4), '4', __NAMESPACE__.'\ComparisonTest_Class'), - array('c', '"c"', 'b', '"b"', 'string'), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorTest.php deleted file mode 100644 index d555870..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorTest.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\LessThan; -use Symfony\Component\Validator\Constraints\LessThanValidator; -use Symfony\Component\Validator\Validation; - -/** - * @author Daniel Holmes - */ -class LessThanValidatorTest extends AbstractComparisonValidatorTestCase -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new LessThanValidator(); - } - - protected function createConstraint(array $options) - { - return new LessThan($options); - } - - /** - * {@inheritdoc} - */ - public function provideValidComparisons() - { - return array( - array(1, 2), - array(new \DateTime('2000-01-01'), new \DateTime('2010-01-01')), - array(new \DateTime('2000-01-01'), '2010-01-01'), - array(new \DateTime('2000-01-01 UTC'), '2010-01-01 UTC'), - array(new ComparisonTest_Class(4), new ComparisonTest_Class(5)), - array('22', '333'), - array(null, 1), - ); - } - - /** - * {@inheritdoc} - */ - public function provideInvalidComparisons() - { - return array( - array(3, '3', 2, '2', 'integer'), - array(2, '2', 2, '2', 'integer'), - array(new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2010-01-01 UTC'), 'Jan 1, 2010, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2000-01-01 UTC'), 'Jan 1, 2000, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new ComparisonTest_Class(5), '5', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), - array(new ComparisonTest_Class(6), '6', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), - array('333', '"333"', '22', '"22"', 'string'), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LocaleValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LocaleValidatorTest.php deleted file mode 100644 index e5e2f30..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LocaleValidatorTest.php +++ /dev/null @@ -1,104 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Intl\Util\IntlTestHelper; -use Symfony\Component\Validator\Constraints\Locale; -use Symfony\Component\Validator\Constraints\LocaleValidator; -use Symfony\Component\Validator\Validation; - -class LocaleValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new LocaleValidator(); - } - - protected function setUp() - { - IntlTestHelper::requireIntl($this); - - parent::setUp(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Locale()); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $this->validator->validate('', new Locale()); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsStringCompatibleType() - { - $this->validator->validate(new \stdClass(), new Locale()); - } - - /** - * @dataProvider getValidLocales - */ - public function testValidLocales($locale) - { - $this->validator->validate($locale, new Locale()); - - $this->assertNoViolation(); - } - - public function getValidLocales() - { - return array( - array('en'), - array('en_US'), - array('pt'), - array('pt_PT'), - array('zh_Hans'), - ); - } - - /** - * @dataProvider getInvalidLocales - */ - public function testInvalidLocales($locale) - { - $constraint = new Locale(array( - 'message' => 'myMessage', - )); - - $this->validator->validate($locale, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$locale.'"') - ->assertRaised(); - } - - public function getInvalidLocales() - { - return array( - array('EN'), - array('foobar'), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LuhnValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LuhnValidatorTest.php deleted file mode 100644 index b0e88c3..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LuhnValidatorTest.php +++ /dev/null @@ -1,127 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Luhn; -use Symfony\Component\Validator\Constraints\LuhnValidator; -use Symfony\Component\Validator\Validation; - -class LuhnValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new LuhnValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Luhn()); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $this->validator->validate('', new Luhn()); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getValidNumbers - */ - public function testValidNumbers($number) - { - $this->validator->validate($number, new Luhn()); - - $this->assertNoViolation(); - } - - public function getValidNumbers() - { - return array( - array('42424242424242424242'), - array('378282246310005'), - array('371449635398431'), - array('378734493671000'), - array('5610591081018250'), - array('30569309025904'), - array('38520000023237'), - array('6011111111111117'), - array('6011000990139424'), - array('3530111333300000'), - array('3566002020360505'), - array('5555555555554444'), - array('5105105105105100'), - array('4111111111111111'), - array('4012888888881881'), - array('4222222222222'), - array('5019717010103742'), - array('6331101999990016'), - ); - } - - /** - * @dataProvider getInvalidNumbers - */ - public function testInvalidNumbers($number, $code) - { - $constraint = new Luhn(array( - 'message' => 'myMessage', - )); - - $this->validator->validate($number, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$number.'"') - ->setCode($code) - ->assertRaised(); - } - - public function getInvalidNumbers() - { - return array( - array('1234567812345678', Luhn::CHECKSUM_FAILED_ERROR), - array('4222222222222222', Luhn::CHECKSUM_FAILED_ERROR), - array('0000000000000000', Luhn::CHECKSUM_FAILED_ERROR), - array('000000!000000000', Luhn::INVALID_CHARACTERS_ERROR), - array('42-22222222222222', Luhn::INVALID_CHARACTERS_ERROR), - ); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - * @dataProvider getInvalidTypes - */ - public function testInvalidTypes($number) - { - $constraint = new Luhn(); - - $this->validator->validate($number, $constraint); - } - - public function getInvalidTypes() - { - return array( - array(0), - array(123), - array(42424242424242424242), - array(378282246310005), - array(371449635398431), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/NotBlankValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/NotBlankValidatorTest.php deleted file mode 100644 index c248246..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/NotBlankValidatorTest.php +++ /dev/null @@ -1,102 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\NotBlank; -use Symfony\Component\Validator\Constraints\NotBlankValidator; -use Symfony\Component\Validator\Validation; - -class NotBlankValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new NotBlankValidator(); - } - - /** - * @dataProvider getValidValues - */ - public function testValidValues($value) - { - $this->validator->validate($value, new NotBlank()); - - $this->assertNoViolation(); - } - - public function getValidValues() - { - return array( - array('foobar'), - array(0), - array(0.0), - array('0'), - array(1234), - ); - } - - public function testNullIsInvalid() - { - $constraint = new NotBlank(array( - 'message' => 'myMessage', - )); - - $this->validator->validate(null, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', 'null') - ->assertRaised(); - } - - public function testBlankIsInvalid() - { - $constraint = new NotBlank(array( - 'message' => 'myMessage', - )); - - $this->validator->validate('', $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '""') - ->assertRaised(); - } - - public function testFalseIsInvalid() - { - $constraint = new NotBlank(array( - 'message' => 'myMessage', - )); - - $this->validator->validate(false, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', 'false') - ->assertRaised(); - } - - public function testEmptyArrayIsInvalid() - { - $constraint = new NotBlank(array( - 'message' => 'myMessage', - )); - - $this->validator->validate(array(), $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', 'array') - ->assertRaised(); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/NotEqualToValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/NotEqualToValidatorTest.php deleted file mode 100644 index bc2c348..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/NotEqualToValidatorTest.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\NotEqualTo; -use Symfony\Component\Validator\Constraints\NotEqualToValidator; -use Symfony\Component\Validator\Validation; - -/** - * @author Daniel Holmes - */ -class NotEqualToValidatorTest extends AbstractComparisonValidatorTestCase -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new NotEqualToValidator(); - } - - protected function createConstraint(array $options) - { - return new NotEqualTo($options); - } - - /** - * {@inheritdoc} - */ - public function provideValidComparisons() - { - return array( - array(1, 2), - array('22', '333'), - array(new \DateTime('2001-01-01'), new \DateTime('2000-01-01')), - array(new \DateTime('2001-01-01'), '2000-01-01'), - array(new \DateTime('2001-01-01 UTC'), '2000-01-01 UTC'), - array(new ComparisonTest_Class(6), new ComparisonTest_Class(5)), - array(null, 1), - ); - } - - /** - * {@inheritdoc} - */ - public function provideInvalidComparisons() - { - return array( - array(3, '3', 3, '3', 'integer'), - array('2', '"2"', 2, '2', 'integer'), - array('a', '"a"', 'a', '"a"', 'string'), - array(new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new \DateTime('2000-01-01 UTC'), 'Jan 1, 2000, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array(new ComparisonTest_Class(5), '5', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/NotIdenticalToValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/NotIdenticalToValidatorTest.php deleted file mode 100644 index 1fbd806..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/NotIdenticalToValidatorTest.php +++ /dev/null @@ -1,92 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\NotIdenticalTo; -use Symfony\Component\Validator\Constraints\NotIdenticalToValidator; -use Symfony\Component\Validator\Validation; - -/** - * @author Daniel Holmes - */ -class NotIdenticalToValidatorTest extends AbstractComparisonValidatorTestCase -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new NotIdenticalToValidator(); - } - - protected function createConstraint(array $options) - { - return new NotIdenticalTo($options); - } - - /** - * {@inheritdoc} - */ - public function provideValidComparisons() - { - return array( - array(1, 2), - array('2', 2), - array('22', '333'), - array(new \DateTime('2001-01-01'), new \DateTime('2000-01-01')), - array(new \DateTime('2000-01-01'), new \DateTime('2000-01-01')), - array(new \DateTime('2001-01-01'), '2000-01-01'), - array(new \DateTime('2000-01-01'), '2000-01-01'), - array(new \DateTime('2001-01-01'), '2000-01-01'), - array(new \DateTime('2000-01-01 UTC'), '2000-01-01 UTC'), - array(null, 1), - ); - } - - public function provideAllInvalidComparisons() - { - $this->setDefaultTimezone('UTC'); - - // Don't call addPhp5Dot5Comparisons() automatically, as it does - // not take care of identical objects - $comparisons = $this->provideInvalidComparisons(); - - $this->restoreDefaultTimezone(); - - return $comparisons; - } - - /** - * {@inheritdoc} - */ - public function provideInvalidComparisons() - { - $date = new \DateTime('2000-01-01'); - $object = new ComparisonTest_Class(2); - - $comparisons = array( - array(3, '3', 3, '3', 'integer'), - array('a', '"a"', 'a', '"a"', 'string'), - array($date, 'Jan 1, 2000, 12:00 AM', $date, 'Jan 1, 2000, 12:00 AM', 'DateTime'), - array($object, '2', $object, '2', __NAMESPACE__.'\ComparisonTest_Class'), - ); - - if (version_compare(PHP_VERSION, '>=', '5.5')) { - $immutableDate = new \DateTimeImmutable('2000-01-01'); - $comparisons[] = array($immutableDate, 'Jan 1, 2000, 12:00 AM', $immutableDate, 'Jan 1, 2000, 12:00 AM', 'DateTime'); - } - - return $comparisons; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/NotNullValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/NotNullValidatorTest.php deleted file mode 100644 index d338f31..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/NotNullValidatorTest.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\NotNull; -use Symfony\Component\Validator\Constraints\NotNullValidator; -use Symfony\Component\Validator\Validation; - -class NotNullValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new NotNullValidator(); - } - - /** - * @dataProvider getValidValues - */ - public function testValidValues($value) - { - $this->validator->validate($value, new NotNull()); - - $this->assertNoViolation(); - } - - public function getValidValues() - { - return array( - array(0), - array(false), - array(true), - array(''), - ); - } - - public function testNullIsInvalid() - { - $constraint = new NotNull(array( - 'message' => 'myMessage', - )); - - $this->validator->validate(null, $constraint); - - $this->buildViolation('myMessage')->assertRaised(); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/NullValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/NullValidatorTest.php deleted file mode 100644 index 85df90a..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/NullValidatorTest.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Null; -use Symfony\Component\Validator\Constraints\NullValidator; -use Symfony\Component\Validator\Validation; - -class NullValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new NullValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Null()); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getInvalidValues - */ - public function testInvalidValues($value, $valueAsString) - { - $constraint = new Null(array( - 'message' => 'myMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', $valueAsString) - ->assertRaised(); - } - - public function getInvalidValues() - { - return array( - array(0, '0'), - array(false, 'false'), - array(true, 'true'), - array('', '""'), - array('foo bar', '"foo bar"'), - array(new \DateTime(), 'object'), - array(new \stdClass(), 'object'), - array(array(), 'array'), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php deleted file mode 100644 index 9b7056b..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php +++ /dev/null @@ -1,403 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Intl\Util\IntlTestHelper; -use Symfony\Component\Validator\Constraints\Range; -use Symfony\Component\Validator\Constraints\RangeValidator; -use Symfony\Component\Validator\Validation; - -class RangeValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new RangeValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Range(array('min' => 10, 'max' => 20))); - - $this->assertNoViolation(); - } - - public function getTenToTwenty() - { - return array( - array(10.00001), - array(19.99999), - array('10.00001'), - array('19.99999'), - array(10), - array(20), - array(10.0), - array(20.0), - ); - } - - public function getLessThanTen() - { - return array( - array(9.99999, '9.99999'), - array('9.99999', '"9.99999"'), - array(5, '5'), - array(1.0, '1.0'), - ); - } - - public function getMoreThanTwenty() - { - return array( - array(20.000001, '20.000001'), - array('20.000001', '"20.000001"'), - array(21, '21'), - array(30.0, '30.0'), - ); - } - - /** - * @dataProvider getTenToTwenty - */ - public function testValidValuesMin($value) - { - $constraint = new Range(array('min' => 10)); - $this->validator->validate($value, $constraint); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getTenToTwenty - */ - public function testValidValuesMax($value) - { - $constraint = new Range(array('max' => 20)); - $this->validator->validate($value, $constraint); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getTenToTwenty - */ - public function testValidValuesMinMax($value) - { - $constraint = new Range(array('min' => 10, 'max' => 20)); - $this->validator->validate($value, $constraint); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getLessThanTen - */ - public function testInvalidValuesMin($value, $formattedValue) - { - $constraint = new Range(array( - 'min' => 10, - 'minMessage' => 'myMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', $formattedValue) - ->setParameter('{{ limit }}', 10) - ->setCode(Range::BELOW_RANGE_ERROR) - ->assertRaised(); - } - - /** - * @dataProvider getMoreThanTwenty - */ - public function testInvalidValuesMax($value, $formattedValue) - { - $constraint = new Range(array( - 'max' => 20, - 'maxMessage' => 'myMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', $formattedValue) - ->setParameter('{{ limit }}', 20) - ->setCode(Range::BEYOND_RANGE_ERROR) - ->assertRaised(); - } - - /** - * @dataProvider getMoreThanTwenty - */ - public function testInvalidValuesCombinedMax($value, $formattedValue) - { - $constraint = new Range(array( - 'min' => 10, - 'max' => 20, - 'minMessage' => 'myMinMessage', - 'maxMessage' => 'myMaxMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMaxMessage') - ->setParameter('{{ value }}', $formattedValue) - ->setParameter('{{ limit }}', 20) - ->setCode(Range::BEYOND_RANGE_ERROR) - ->assertRaised(); - } - - /** - * @dataProvider getLessThanTen - */ - public function testInvalidValuesCombinedMin($value, $formattedValue) - { - $constraint = new Range(array( - 'min' => 10, - 'max' => 20, - 'minMessage' => 'myMinMessage', - 'maxMessage' => 'myMaxMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMinMessage') - ->setParameter('{{ value }}', $formattedValue) - ->setParameter('{{ limit }}', 10) - ->setCode(Range::BELOW_RANGE_ERROR) - ->assertRaised(); - } - - public function getTenthToTwentiethMarch2014() - { - // The provider runs before setUp(), so we need to manually fix - // the default timezone - $this->setDefaultTimezone('UTC'); - - $tests = array( - array(new \DateTime('March 10, 2014')), - array(new \DateTime('March 15, 2014')), - array(new \DateTime('March 20, 2014')), - ); - - if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $tests[] = array(new \DateTimeImmutable('March 10, 2014')); - $tests[] = array(new \DateTimeImmutable('March 15, 2014')); - $tests[] = array(new \DateTimeImmutable('March 20, 2014')); - } - - $this->restoreDefaultTimezone(); - - return $tests; - } - - public function getSoonerThanTenthMarch2014() - { - // The provider runs before setUp(), so we need to manually fix - // the default timezone - $this->setDefaultTimezone('UTC'); - - $tests = array( - array(new \DateTime('March 20, 2013'), 'Mar 20, 2013, 12:00 AM'), - array(new \DateTime('March 9, 2014'), 'Mar 9, 2014, 12:00 AM'), - ); - - if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $tests[] = array(new \DateTimeImmutable('March 20, 2013'), 'Mar 20, 2013, 12:00 AM'); - $tests[] = array(new \DateTimeImmutable('March 9, 2014'), 'Mar 9, 2014, 12:00 AM'); - } - - $this->restoreDefaultTimezone(); - - return $tests; - } - - public function getLaterThanTwentiethMarch2014() - { - // The provider runs before setUp(), so we need to manually fix - // the default timezone - $this->setDefaultTimezone('UTC'); - - $tests = array( - array(new \DateTime('March 21, 2014'), 'Mar 21, 2014, 12:00 AM'), - array(new \DateTime('March 9, 2015'), 'Mar 9, 2015, 12:00 AM'), - ); - - if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $tests[] = array(new \DateTimeImmutable('March 21, 2014'), 'Mar 21, 2014, 12:00 AM'); - $tests[] = array(new \DateTimeImmutable('March 9, 2015'), 'Mar 9, 2015, 12:00 AM'); - } - - $this->restoreDefaultTimezone(); - - return $tests; - } - - /** - * @dataProvider getTenthToTwentiethMarch2014 - */ - public function testValidDatesMin($value) - { - $constraint = new Range(array('min' => 'March 10, 2014')); - $this->validator->validate($value, $constraint); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getTenthToTwentiethMarch2014 - */ - public function testValidDatesMax($value) - { - $constraint = new Range(array('max' => 'March 20, 2014')); - $this->validator->validate($value, $constraint); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getTenthToTwentiethMarch2014 - */ - public function testValidDatesMinMax($value) - { - $constraint = new Range(array('min' => 'March 10, 2014', 'max' => 'March 20, 2014')); - $this->validator->validate($value, $constraint); - - $this->assertNoViolation(); - } - - /** - * @dataProvider getSoonerThanTenthMarch2014 - */ - public function testInvalidDatesMin($value, $dateTimeAsString) - { - // Conversion of dates to string differs between ICU versions - // Make sure we have the correct version loaded - IntlTestHelper::requireIntl($this); - - $constraint = new Range(array( - 'min' => 'March 10, 2014', - 'minMessage' => 'myMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', $dateTimeAsString) - ->setParameter('{{ limit }}', 'Mar 10, 2014, 12:00 AM') - ->setCode(Range::BELOW_RANGE_ERROR) - ->assertRaised(); - } - - /** - * @dataProvider getLaterThanTwentiethMarch2014 - */ - public function testInvalidDatesMax($value, $dateTimeAsString) - { - // Conversion of dates to string differs between ICU versions - // Make sure we have the correct version loaded - IntlTestHelper::requireIntl($this); - - $constraint = new Range(array( - 'max' => 'March 20, 2014', - 'maxMessage' => 'myMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', $dateTimeAsString) - ->setParameter('{{ limit }}', 'Mar 20, 2014, 12:00 AM') - ->setCode(Range::BEYOND_RANGE_ERROR) - ->assertRaised(); - } - - /** - * @dataProvider getLaterThanTwentiethMarch2014 - */ - public function testInvalidDatesCombinedMax($value, $dateTimeAsString) - { - // Conversion of dates to string differs between ICU versions - // Make sure we have the correct version loaded - IntlTestHelper::requireIntl($this); - - $constraint = new Range(array( - 'min' => 'March 10, 2014', - 'max' => 'March 20, 2014', - 'minMessage' => 'myMinMessage', - 'maxMessage' => 'myMaxMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMaxMessage') - ->setParameter('{{ value }}', $dateTimeAsString) - ->setParameter('{{ limit }}', 'Mar 20, 2014, 12:00 AM') - ->setCode(Range::BEYOND_RANGE_ERROR) - ->assertRaised(); - } - - /** - * @dataProvider getSoonerThanTenthMarch2014 - */ - public function testInvalidDatesCombinedMin($value, $dateTimeAsString) - { - // Conversion of dates to string differs between ICU versions - // Make sure we have the correct version loaded - IntlTestHelper::requireIntl($this); - - $constraint = new Range(array( - 'min' => 'March 10, 2014', - 'max' => 'March 20, 2014', - 'minMessage' => 'myMinMessage', - 'maxMessage' => 'myMaxMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMinMessage') - ->setParameter('{{ value }}', $dateTimeAsString) - ->setParameter('{{ limit }}', 'Mar 10, 2014, 12:00 AM') - ->setCode(Range::BELOW_RANGE_ERROR) - ->assertRaised(); - } - - public function getInvalidValues() - { - return array( - array(9.999999), - array(20.000001), - array('9.999999'), - array('20.000001'), - array(new \stdClass()), - ); - } - - public function testNonNumeric() - { - $this->validator->validate('abcd', new Range(array( - 'min' => 10, - 'max' => 20, - 'invalidMessage' => 'myMessage', - ))); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"abcd"') - ->setCode(Range::INVALID_VALUE_ERROR) - ->assertRaised(); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/RegexTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/RegexTest.php deleted file mode 100644 index ea37bb4..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/RegexTest.php +++ /dev/null @@ -1,87 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Constraints; - -use Symfony\Component\Validator\Constraints\Regex; - -/** - * @author Bernhard Schussek - */ -class RegexTest extends \PHPUnit_Framework_TestCase -{ - public function testConstraintGetDefaultOption() - { - $constraint = new Regex('/^[0-9]+$/'); - - $this->assertSame('/^[0-9]+$/', $constraint->pattern); - } - - public function provideHtmlPatterns() - { - return array( - // HTML5 wraps the pattern in ^(?:pattern)$ - array('/^[0-9]+$/', '[0-9]+'), - array('/[0-9]+$/', '.*[0-9]+'), - array('/^[0-9]+/', '[0-9]+.*'), - array('/[0-9]+/', '.*[0-9]+.*'), - // We need a smart way to allow matching of patterns that contain - // ^ and $ at various sub-clauses of an or-clause - // .*(pattern).* seems to work correctly - array('/[0-9]$|[a-z]+/', '.*([0-9]$|[a-z]+).*'), - array('/[0-9]$|^[a-z]+/', '.*([0-9]$|^[a-z]+).*'), - array('/^[0-9]|[a-z]+$/', '.*(^[0-9]|[a-z]+$).*'), - // Unescape escaped delimiters - array('/^[0-9]+\/$/', '[0-9]+/'), - array('#^[0-9]+\#$#', '[0-9]+#'), - // Cannot be converted - array('/^[0-9]+$/i', null), - - // Inverse matches are simple, just wrap in - // ((?!pattern).)* - array('/^[0-9]+$/', '((?!^[0-9]+$).)*', false), - array('/[0-9]+$/', '((?![0-9]+$).)*', false), - array('/^[0-9]+/', '((?!^[0-9]+).)*', false), - array('/[0-9]+/', '((?![0-9]+).)*', false), - array('/[0-9]$|[a-z]+/', '((?![0-9]$|[a-z]+).)*', false), - array('/[0-9]$|^[a-z]+/', '((?![0-9]$|^[a-z]+).)*', false), - array('/^[0-9]|[a-z]+$/', '((?!^[0-9]|[a-z]+$).)*', false), - array('/^[0-9]+\/$/', '((?!^[0-9]+/$).)*', false), - array('#^[0-9]+\#$#', '((?!^[0-9]+#$).)*', false), - array('/^[0-9]+$/i', null, false), - ); - } - - /** - * @dataProvider provideHtmlPatterns - */ - public function testGetHtmlPattern($pattern, $htmlPattern, $match = true) - { - $constraint = new Regex(array( - 'pattern' => $pattern, - 'match' => $match, - )); - - $this->assertSame($pattern, $constraint->pattern); - $this->assertSame($htmlPattern, $constraint->getHtmlPattern()); - } - - public function testGetCustomHtmlPattern() - { - $constraint = new Regex(array( - 'pattern' => '((?![0-9]$|[a-z]+).)*', - 'htmlPattern' => 'foobar', - )); - - $this->assertSame('((?![0-9]$|[a-z]+).)*', $constraint->pattern); - $this->assertSame('foobar', $constraint->getHtmlPattern()); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php deleted file mode 100644 index 61917e3..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php +++ /dev/null @@ -1,97 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Regex; -use Symfony\Component\Validator\Constraints\RegexValidator; -use Symfony\Component\Validator\Validation; - -class RegexValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new RegexValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Regex(array('pattern' => '/^[0-9]+$/'))); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $this->validator->validate('', new Regex(array('pattern' => '/^[0-9]+$/'))); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsStringCompatibleType() - { - $this->validator->validate(new \stdClass(), new Regex(array('pattern' => '/^[0-9]+$/'))); - } - - /** - * @dataProvider getValidValues - */ - public function testValidValues($value) - { - $constraint = new Regex(array('pattern' => '/^[0-9]+$/')); - $this->validator->validate($value, $constraint); - - $this->assertNoViolation(); - } - - public function getValidValues() - { - return array( - array(0), - array('0'), - array('090909'), - array(90909), - ); - } - - /** - * @dataProvider getInvalidValues - */ - public function testInvalidValues($value) - { - $constraint = new Regex(array( - 'pattern' => '/^[0-9]+$/', - 'message' => 'myMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$value.'"') - ->assertRaised(); - } - - public function getInvalidValues() - { - return array( - array('abcd'), - array('090foo'), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php deleted file mode 100644 index a6ca143..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Time; -use Symfony\Component\Validator\Constraints\TimeValidator; -use Symfony\Component\Validator\Validation; - -class TimeValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new TimeValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Time()); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $this->validator->validate('', new Time()); - - $this->assertNoViolation(); - } - - public function testDateTimeClassIsValid() - { - $this->validator->validate(new \DateTime(), new Time()); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsStringCompatibleType() - { - $this->validator->validate(new \stdClass(), new Time()); - } - - /** - * @dataProvider getValidTimes - */ - public function testValidTimes($time) - { - $this->validator->validate($time, new Time()); - - $this->assertNoViolation(); - } - - public function getValidTimes() - { - return array( - array('01:02:03'), - array('00:00:00'), - array('23:59:59'), - ); - } - - /** - * @dataProvider getInvalidTimes - */ - public function testInvalidTimes($time, $code) - { - $constraint = new Time(array( - 'message' => 'myMessage', - )); - - $this->validator->validate($time, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$time.'"') - ->setCode($code) - ->assertRaised(); - } - - public function getInvalidTimes() - { - return array( - array('foobar', Time::INVALID_FORMAT_ERROR), - array('foobar 12:34:56', Time::INVALID_FORMAT_ERROR), - array('12:34:56 foobar', Time::INVALID_FORMAT_ERROR), - array('00:00', Time::INVALID_FORMAT_ERROR), - array('24:00:00', Time::INVALID_TIME_ERROR), - array('00:60:00', Time::INVALID_TIME_ERROR), - array('00:00:60', Time::INVALID_TIME_ERROR), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/TrueValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/TrueValidatorTest.php deleted file mode 100644 index 2cdc703..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/TrueValidatorTest.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\True; -use Symfony\Component\Validator\Constraints\TrueValidator; -use Symfony\Component\Validator\Validation; - -class TrueValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new TrueValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new True()); - - $this->assertNoViolation(); - } - - public function testTrueIsValid() - { - $this->validator->validate(true, new True()); - - $this->assertNoViolation(); - } - - public function testFalseIsInvalid() - { - $constraint = new True(array( - 'message' => 'myMessage', - )); - - $this->validator->validate(false, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', 'false') - ->assertRaised(); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/TypeValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/TypeValidatorTest.php deleted file mode 100644 index 4836928..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/TypeValidatorTest.php +++ /dev/null @@ -1,185 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Type; -use Symfony\Component\Validator\Constraints\TypeValidator; -use Symfony\Component\Validator\Validation; - -class TypeValidatorTest extends AbstractConstraintValidatorTest -{ - protected static $file; - - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new TypeValidator(); - } - - public function testNullIsValid() - { - $constraint = new Type(array('type' => 'integer')); - - $this->validator->validate(null, $constraint); - - $this->assertNoViolation(); - } - - public function testEmptyIsValidIfString() - { - $constraint = new Type(array('type' => 'string')); - - $this->validator->validate('', $constraint); - - $this->assertNoViolation(); - } - - public function testEmptyIsInvalidIfNoString() - { - $constraint = new Type(array( - 'type' => 'integer', - 'message' => 'myMessage', - )); - - $this->validator->validate('', $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '""') - ->setParameter('{{ type }}', 'integer') - ->assertRaised(); - } - - /** - * @dataProvider getValidValues - */ - public function testValidValues($value, $type) - { - $constraint = new Type(array('type' => $type)); - - $this->validator->validate($value, $constraint); - - $this->assertNoViolation(); - } - - public function getValidValues() - { - $object = new \stdClass(); - $file = $this->createFile(); - - return array( - array(true, 'Boolean'), - array(false, 'Boolean'), - array(true, 'boolean'), - array(false, 'boolean'), - array(true, 'bool'), - array(false, 'bool'), - array(0, 'numeric'), - array('0', 'numeric'), - array(1.5, 'numeric'), - array('1.5', 'numeric'), - array(0, 'integer'), - array(1.5, 'float'), - array('12345', 'string'), - array(array(), 'array'), - array($object, 'object'), - array($object, 'stdClass'), - array($file, 'resource'), - array('12345', 'digit'), - array('12a34', 'alnum'), - array('abcde', 'alpha'), - array("\n\r\t", 'cntrl'), - array('arf12', 'graph'), - array('abcde', 'lower'), - array('ABCDE', 'upper'), - array('arf12', 'print'), - array('*&$()', 'punct'), - array("\n\r\t", 'space'), - array('AB10BC99', 'xdigit'), - ); - } - - /** - * @dataProvider getInvalidValues - */ - public function testInvalidValues($value, $type, $valueAsString) - { - $constraint = new Type(array( - 'type' => $type, - 'message' => 'myMessage', - )); - - $this->validator->validate($value, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', $valueAsString) - ->setParameter('{{ type }}', $type) - ->assertRaised(); - } - - public function getInvalidValues() - { - $object = new \stdClass(); - $file = $this->createFile(); - - return array( - array('foobar', 'numeric', '"foobar"'), - array('foobar', 'boolean', '"foobar"'), - array('0', 'integer', '"0"'), - array('1.5', 'float', '"1.5"'), - array(12345, 'string', '12345'), - array($object, 'boolean', 'object'), - array($object, 'numeric', 'object'), - array($object, 'integer', 'object'), - array($object, 'float', 'object'), - array($object, 'string', 'object'), - array($object, 'resource', 'object'), - array($file, 'boolean', 'resource'), - array($file, 'numeric', 'resource'), - array($file, 'integer', 'resource'), - array($file, 'float', 'resource'), - array($file, 'string', 'resource'), - array($file, 'object', 'resource'), - array('12a34', 'digit', '"12a34"'), - array('1a#23', 'alnum', '"1a#23"'), - array('abcd1', 'alpha', '"abcd1"'), - array("\nabc", 'cntrl', "\"\nabc\""), - array("abc\n", 'graph', "\"abc\n\""), - array('abCDE', 'lower', '"abCDE"'), - array('ABcde', 'upper', '"ABcde"'), - array("\nabc", 'print', "\"\nabc\""), - array('abc&$!', 'punct', '"abc&$!"'), - array("\nabc", 'space', "\"\nabc\""), - array('AR1012', 'xdigit', '"AR1012"'), - ); - } - - protected function createFile() - { - if (!static::$file) { - static::$file = fopen(__FILE__, 'r'); - } - - return static::$file; - } - - public static function tearDownAfterClass() - { - if (static::$file) { - fclose(static::$file); - static::$file = null; - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php deleted file mode 100644 index 3358c79..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php +++ /dev/null @@ -1,179 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Url; -use Symfony\Component\Validator\Constraints\UrlValidator; -use Symfony\Component\Validator\Validation; - -class UrlValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new UrlValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Url()); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $this->validator->validate('', new Url()); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsStringCompatibleType() - { - $this->validator->validate(new \stdClass(), new Url()); - } - - /** - * @dataProvider getValidUrls - */ - public function testValidUrls($url) - { - $this->validator->validate($url, new Url()); - - $this->assertNoViolation(); - } - - public function getValidUrls() - { - return array( - array('http://a.pl'), - array('http://www.google.com'), - array('http://www.google.com.'), - array('http://www.google.museum'), - array('https://google.com/'), - array('https://google.com:80/'), - array('http://www.example.coop/'), - array('http://www.test-example.com/'), - array('http://www.symfony.com/'), - array('http://symfony.fake/blog/'), - array('http://symfony.com/?'), - array('http://symfony.com/search?type=&q=url+validator'), - array('http://symfony.com/#'), - array('http://symfony.com/#?'), - array('http://www.symfony.com/doc/current/book/validation.html#supported-constraints'), - array('http://very.long.domain.name.com/'), - array('http://localhost/'), - array('http://127.0.0.1/'), - array('http://127.0.0.1:80/'), - array('http://[::1]/'), - array('http://[::1]:80/'), - array('http://[1:2:3::4:5:6:7]/'), - array('http://sãopaulo.com/'), - array('http://xn--sopaulo-xwa.com/'), - array('http://sãopaulo.com.br/'), - array('http://xn--sopaulo-xwa.com.br/'), - array('http://пример.иÑпытание/'), - array('http://xn--e1afmkfd.xn--80akhbyknj4f/'), - array('http://مثال.إختبار/'), - array('http://xn--mgbh0fb.xn--kgbechtv/'), - array('http://例å­.测试/'), - array('http://xn--fsqu00a.xn--0zwm56d/'), - array('http://例å­.測試/'), - array('http://xn--fsqu00a.xn--g6w251d/'), - array('http://例ãˆ.テスト/'), - array('http://xn--r8jz45g.xn--zckzah/'), - array('http://مثال.آزمایشی/'), - array('http://xn--mgbh0fb.xn--hgbk6aj7f53bba/'), - array('http://실례.테스트/'), - array('http://xn--9n2bp8q.xn--9t4b11yi5a/'), - array('http://العربية.idn.icann.org/'), - array('http://xn--ogb.idn.icann.org/'), - array('http://xn--e1afmkfd.xn--80akhbyknj4f.xn--e1afmkfd/'), - array('http://xn--espaa-rta.xn--ca-ol-fsay5a/'), - array('http://xn--d1abbgf6aiiy.xn--p1ai/'), - array('http://☎.com/'), - array('http://username:password@symfony.com'), - array('http://user-name@symfony.com'), - ); - } - - /** - * @dataProvider getInvalidUrls - */ - public function testInvalidUrls($url) - { - $constraint = new Url(array( - 'message' => 'myMessage', - )); - - $this->validator->validate($url, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$url.'"') - ->assertRaised(); - } - - public function getInvalidUrls() - { - return array( - array('google.com'), - array('://google.com'), - array('http ://google.com'), - array('http:/google.com'), - array('http://goog_le.com'), - array('http://google.com::aa'), - array('http://google.com:aa'), - array('http://symfony.com?'), - array('http://symfony.com#'), - array('ftp://google.fr'), - array('faked://google.fr'), - array('http://127.0.0.1:aa/'), - array('ftp://[::1]/'), - array('http://[::1'), - array('http://hello.☎/'), - array('http://:password@symfony.com'), - array('http://:password@@symfony.com'), - array('http://username:passwordsymfony.com'), - array('http://usern@me:password@symfony.com'), - ); - } - - /** - * @dataProvider getValidCustomUrls - */ - public function testCustomProtocolIsValid($url) - { - $constraint = new Url(array( - 'protocols' => array('ftp', 'file', 'git'), - )); - - $this->validator->validate($url, $constraint); - - $this->assertNoViolation(); - } - - public function getValidCustomUrls() - { - return array( - array('ftp://google.com'), - array('file://127.0.0.1'), - array('git://[::1]/'), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php deleted file mode 100644 index 0abda39..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php +++ /dev/null @@ -1,211 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Uuid; -use Symfony\Component\Validator\Constraints\UuidValidator; -use Symfony\Component\Validator\Validation; - -/** - * @author Colin O'Dell - */ -class UuidValidatorTest extends AbstractConstraintValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5; - } - - protected function createValidator() - { - return new UuidValidator(); - } - - public function testNullIsValid() - { - $this->validator->validate(null, new Uuid()); - - $this->assertNoViolation(); - } - - public function testEmptyStringIsValid() - { - $this->validator->validate('', new Uuid()); - - $this->assertNoViolation(); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsStringCompatibleType() - { - $this->validator->validate(new \stdClass(), new Uuid()); - } - - /** - * @dataProvider getValidStrictUuids - */ - public function testValidStrictUuids($uuid, $versions = null) - { - $constraint = new Uuid(); - - if (null !== $versions) { - $constraint->versions = $versions; - } - - $this->validator->validate($uuid, $constraint); - - $this->assertNoViolation(); - } - - public function getValidStrictUuids() - { - return array( - array('216fff40-98d9-11e3-a5e2-0800200c9a66'), // Version 1 UUID in lowercase - array('216fff40-98d9-11e3-a5e2-0800200c9a66', array(Uuid::V1_MAC)), - array('216FFF40-98D9-11E3-A5E2-0800200C9A66'), // Version 1 UUID in UPPERCASE - array('456daefb-5aa6-41b5-8dbc-068b05a8b201'), // Version 4 UUID in lowercase - array('456daEFb-5AA6-41B5-8DBC-068B05A8B201'), // Version 4 UUID in mixed case - array('456daEFb-5AA6-41B5-8DBC-068B05A8B201', array(Uuid::V4_RANDOM)), - ); - } - - /** - * @dataProvider getInvalidStrictUuids - */ - public function testInvalidStrictUuids($uuid, $code, $versions = null) - { - $constraint = new Uuid(array( - 'message' => 'testMessage', - )); - - if (null !== $versions) { - $constraint->versions = $versions; - } - - $this->validator->validate($uuid, $constraint); - - $this->buildViolation('testMessage') - ->setParameter('{{ value }}', '"'.$uuid.'"') - ->setCode($code) - ->assertRaised(); - } - - public function getInvalidStrictUuids() - { - return array( - array('216fff40-98d9-11e3-a5e2_0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR), - array('216gff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR), - array('216Gff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR), - array('216fff40-98d9-11e3-a5e-20800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), - array('216f-ff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), - array('216fff40-98d9-11e3-a5e2-0800-200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), - array('216fff40-98d9-11e3-a5e2-0800200c-9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), - array('216fff40-98d9-11e3-a5e20800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), - array('216fff4098d911e3a5e20800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), - array('216fff40-98d9-11e3-a5e2-0800200c9a6', Uuid::TOO_SHORT_ERROR), - array('216fff40-98d9-11e3-a5e2-0800200c9a666', Uuid::TOO_LONG_ERROR), - array('216fff40-98d9-01e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-61e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-71e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-81e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-91e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-a1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-b1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-c1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-d1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-e1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-f1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), - array('216fff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR, array(Uuid::V2_DCE, Uuid::V3_MD5, Uuid::V4_RANDOM, Uuid::V5_SHA1)), - array('216fff40-98d9-21e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR, array(Uuid::V1_MAC, Uuid::V3_MD5, Uuid::V4_RANDOM, Uuid::V5_SHA1)), - array('216fff40-98d9-11e3-05e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-15e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-25e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-35e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-45e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-55e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-65e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-75e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-c5e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-d5e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-e5e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - array('216fff40-98d9-11e3-f5e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), - - // Non-standard UUID allowed by some other systems - array('{216fff40-98d9-11e3-a5e2-0800200c9a66}', Uuid::INVALID_CHARACTERS_ERROR), - array('[216fff40-98d9-11e3-a5e2-0800200c9a66]', Uuid::INVALID_CHARACTERS_ERROR), - ); - } - - /** - * @dataProvider getValidNonStrictUuids - */ - public function testValidNonStrictUuids($uuid) - { - $constraint = new Uuid(array( - 'strict' => false, - )); - - $this->validator->validate($uuid, $constraint); - - $this->assertNoViolation(); - } - - public function getValidNonStrictUuids() - { - return array( - array('216fff40-98d9-11e3-a5e2-0800200c9a66'), // Version 1 UUID in lowercase - array('216FFF40-98D9-11E3-A5E2-0800200C9A66'), // Version 1 UUID in UPPERCASE - array('456daefb-5aa6-41b5-8dbc-068b05a8b201'), // Version 4 UUID in lowercase - array('456DAEFb-5AA6-41B5-8DBC-068b05a8B201'), // Version 4 UUID in mixed case - - // Non-standard UUIDs allowed by some other systems - array('216f-ff40-98d9-11e3-a5e2-0800-200c-9a66'), // Non-standard dash positions (every 4 chars) - array('216fff40-98d911e3-a5e20800-200c9a66'), // Non-standard dash positions (every 8 chars) - array('216fff4098d911e3a5e20800200c9a66'), // No dashes at all - array('{216fff40-98d9-11e3-a5e2-0800200c9a66}'), // Wrapped with curly braces - array('[216fff40-98d9-11e3-a5e2-0800200c9a66]'), // Wrapped with squared braces - ); - } - - /** - * @dataProvider getInvalidNonStrictUuids - */ - public function testInvalidNonStrictUuids($uuid, $code) - { - $constraint = new Uuid(array( - 'strict' => false, - 'message' => 'myMessage', - )); - - $this->validator->validate($uuid, $constraint); - - $this->buildViolation('myMessage') - ->setParameter('{{ value }}', '"'.$uuid.'"') - ->setCode($code) - ->assertRaised(); - } - - public function getInvalidNonStrictUuids() - { - return array( - array('216fff40-98d9-11e3-a5e2_0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR), - array('216gff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR), - array('216Gff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR), - array('216fff40-98d9-11e3-a5e2_0800200c9a6', Uuid::INVALID_CHARACTERS_ERROR), - array('216fff40-98d9-11e3-a5e-20800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), - array('216fff40-98d9-11e3-a5e2-0800200c9a6', Uuid::TOO_SHORT_ERROR), - array('216fff40-98d9-11e3-a5e2-0800200c9a666', Uuid::TOO_LONG_ERROR), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/ValidTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/ValidTest.php deleted file mode 100644 index 3de6ab3..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/ValidTest.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Valid; - -/** - * @author Bernhard Schussek - */ -class ValidTest extends \PHPUnit_Framework_TestCase -{ - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testRejectGroupsOption() - { - new Valid(array('groups' => 'foo')); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/CallbackClass.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/CallbackClass.php deleted file mode 100644 index 0f6a2f4..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/CallbackClass.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\ExecutionContextInterface; - -/** - * @author Bernhard Schussek - */ -class CallbackClass -{ - public static function callback($object, ExecutionContextInterface $context) - { - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ClassConstraint.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ClassConstraint.php deleted file mode 100644 index a4dc777..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ClassConstraint.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Constraint; - -class ClassConstraint extends Constraint -{ - public function getTargets() - { - return self::CLASS_CONSTRAINT; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ConstraintA.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ConstraintA.php deleted file mode 100644 index 8a196dc..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ConstraintA.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Constraint; - -/** @Annotation */ -class ConstraintA extends Constraint -{ - public $property1; - public $property2; - - public function getDefaultOption() - { - return 'property2'; - } - - public function getTargets() - { - return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ConstraintAValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ConstraintAValidator.php deleted file mode 100644 index b3b85c8..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ConstraintAValidator.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\ExecutionContextInterface; - -class ConstraintAValidator extends ConstraintValidator -{ - public static $passedContext; - - public function initialize(ExecutionContextInterface $context) - { - parent::initialize($context); - - self::$passedContext = $context; - } - - public function validate($value, Constraint $constraint) - { - if ('VALID' != $value) { - $this->context->addViolation('message', array('param' => 'value')); - - return; - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ConstraintB.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ConstraintB.php deleted file mode 100644 index 6258923..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ConstraintB.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Constraint; - -/** @Annotation */ -class ConstraintB extends Constraint -{ - public function getTargets() - { - return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ConstraintC.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ConstraintC.php deleted file mode 100644 index b0418b8..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ConstraintC.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Constraint; - -/** @Annotation */ -class ConstraintC extends Constraint -{ - public $option1; - - public function getRequiredOptions() - { - return array('option1'); - } - - public function getTargets() - { - return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ConstraintWithValue.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ConstraintWithValue.php deleted file mode 100644 index 4ebd981..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ConstraintWithValue.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Constraint; - -/** @Annotation */ -class ConstraintWithValue extends Constraint -{ - public $property; - public $value; - - public function getDefaultOption() - { - return 'property'; - } - - public function getTargets() - { - return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ConstraintWithValueAsDefault.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ConstraintWithValueAsDefault.php deleted file mode 100644 index a975e07..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/ConstraintWithValueAsDefault.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Constraint; - -/** @Annotation */ -class ConstraintWithValueAsDefault extends Constraint -{ - public $property; - public $value; - - public function getDefaultOption() - { - return 'value'; - } - - public function getTargets() - { - return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/Countable.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/Countable.php deleted file mode 100644 index 282d78d..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/Countable.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -class Countable implements \Countable -{ - private $content; - - public function __construct(array $content) - { - $this->content = $content; - } - - public function count() - { - return count($this->content); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/CustomArrayObject.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/CustomArrayObject.php deleted file mode 100644 index 41eac96..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/CustomArrayObject.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -/** - * This class is a hand written simplified version of PHP native `ArrayObject` - * class, to show that it behaves differently than the PHP native implementation. - */ -class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, \Serializable -{ - private $array; - - public function __construct(array $array = null) - { - $this->array = $array ?: array(); - } - - public function offsetExists($offset) - { - return array_key_exists($offset, $this->array); - } - - public function offsetGet($offset) - { - return $this->array[$offset]; - } - - public function offsetSet($offset, $value) - { - if (null === $offset) { - $this->array[] = $value; - } else { - $this->array[$offset] = $value; - } - } - - public function offsetUnset($offset) - { - unset($this->array[$offset]); - } - - public function getIterator() - { - return new \ArrayIterator($this->array); - } - - public function count() - { - return count($this->array); - } - - public function serialize() - { - return serialize($this->array); - } - - public function unserialize($serialized) - { - $this->array = (array) unserialize((string) $serialized); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/Entity.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/Entity.php deleted file mode 100644 index 2230d30..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/Entity.php +++ /dev/null @@ -1,100 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Constraints as Assert; -use Symfony\Component\Validator\ExecutionContextInterface; - -/** - * @Symfony\Component\Validator\Tests\Fixtures\ConstraintA - * @Assert\GroupSequence({"Foo", "Entity"}) - * @Assert\Callback({"Symfony\Component\Validator\Tests\Fixtures\CallbackClass", "callback"}) - */ -class Entity extends EntityParent implements EntityInterface -{ - /** - * @Assert\NotNull - * @Assert\Range(min=3) - * @Assert\All({@Assert\NotNull, @Assert\Range(min=3)}), - * @Assert\All(constraints={@Assert\NotNull, @Assert\Range(min=3)}) - * @Assert\Collection(fields={ - * "foo" = {@Assert\NotNull, @Assert\Range(min=3)}, - * "bar" = @Assert\Range(min=5) - * }) - * @Assert\Choice(choices={"A", "B"}, message="Must be one of %choices%") - */ - public $firstName; - protected $lastName; - public $reference; - public $reference2; - private $internal; - public $data = 'Overridden data'; - public $initialized = false; - - public function __construct($internal = null) - { - $this->internal = $internal; - } - - public function getInternal() - { - return $this->internal.' from getter'; - } - - public function setLastName($lastName) - { - $this->lastName = $lastName; - } - - /** - * @Assert\NotNull - */ - public function getLastName() - { - return $this->lastName; - } - - /** - * @Assert\True - */ - public function isValid() - { - return 'valid'; - } - - /** - * @Assert\True - */ - public function hasPermissions() - { - return 'permissions'; - } - - public function getData() - { - return 'Overridden data'; - } - - /** - * @Assert\Callback - */ - public function validateMe(ExecutionContextInterface $context) - { - } - - /** - * @Assert\Callback - */ - public static function validateMeStatic($object, ExecutionContextInterface $context) - { - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/EntityInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/EntityInterface.php deleted file mode 100644 index 2901f26..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/EntityInterface.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -interface EntityInterface -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/EntityParent.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/EntityParent.php deleted file mode 100644 index 422bb28..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/EntityParent.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Constraints\NotNull; - -class EntityParent -{ - protected $firstName; - private $internal; - private $data = 'Data'; - - /** - * @NotNull - */ - protected $other; - - public function getData() - { - return 'Data'; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/FailingConstraint.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/FailingConstraint.php deleted file mode 100644 index 03019fc..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/FailingConstraint.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Constraint; - -class FailingConstraint extends Constraint -{ - public $message = 'Failed'; - - public function getTargets() - { - return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/FailingConstraintValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/FailingConstraintValidator.php deleted file mode 100644 index a019dd6..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/FailingConstraintValidator.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; - -class FailingConstraintValidator extends ConstraintValidator -{ - public function validate($value, Constraint $constraint) - { - $this->context->addViolation($constraint->message, array()); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/FakeClassMetadata.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/FakeClassMetadata.php deleted file mode 100644 index 8c76a21..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/FakeClassMetadata.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Mapping\ClassMetadata; - -class FakeClassMetadata extends ClassMetadata -{ - public function addCustomPropertyMetadata($propertyName, $metadata) - { - if (!isset($this->members[$propertyName])) { - $this->members[$propertyName] = array(); - } - - $this->members[$propertyName][] = $metadata; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/FakeMetadataFactory.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/FakeMetadataFactory.php deleted file mode 100644 index e3f0d9a..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/FakeMetadataFactory.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Exception\NoSuchMetadataException; -use Symfony\Component\Validator\MetadataFactoryInterface; -use Symfony\Component\Validator\MetadataInterface; - -class FakeMetadataFactory implements MetadataFactoryInterface -{ - protected $metadatas = array(); - - public function getMetadataFor($class) - { - $hash = null; - - if (is_object($class)) { - $hash = spl_object_hash($class); - $class = get_class($class); - } - - if (!is_string($class)) { - throw new NoSuchMetadataException(sprintf('No metadata for type %s', gettype($class))); - } - - if (!isset($this->metadatas[$class])) { - if (isset($this->metadatas[$hash])) { - return $this->metadatas[$hash]; - } - - throw new NoSuchMetadataException(sprintf('No metadata for "%s"', $class)); - } - - return $this->metadatas[$class]; - } - - public function hasMetadataFor($class) - { - $hash = null; - - if (is_object($class)) { - $hash = spl_object_hash($class); - $class = get_class($class); - } - - if (!is_string($class)) { - return false; - } - - return isset($this->metadatas[$class]) || isset($this->metadatas[$hash]); - } - - public function addMetadata($metadata) - { - $this->metadatas[$metadata->getClassName()] = $metadata; - } - - public function addMetadataForValue($value, MetadataInterface $metadata) - { - $key = is_object($value) ? spl_object_hash($value) : $value; - $this->metadatas[$key] = $metadata; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/FilesLoader.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/FilesLoader.php deleted file mode 100644 index 59d8ee8..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/FilesLoader.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Mapping\Loader\FilesLoader as BaseFilesLoader; -use Symfony\Component\Validator\Mapping\Loader\LoaderInterface; - -abstract class FilesLoader extends BaseFilesLoader -{ - protected $timesCalled = 0; - protected $loader; - - public function __construct(array $paths, LoaderInterface $loader) - { - $this->loader = $loader; - parent::__construct($paths); - } - - protected function getFileLoaderInstance($file) - { - $this->timesCalled++; - - return $this->loader; - } - - public function getTimesCalled() - { - return $this->timesCalled; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/GroupSequenceProviderEntity.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/GroupSequenceProviderEntity.php deleted file mode 100644 index 2b0beaf..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/GroupSequenceProviderEntity.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Constraints as Assert; -use Symfony\Component\Validator\GroupSequenceProviderInterface; - -/** - * @Assert\GroupSequenceProvider - */ -class GroupSequenceProviderEntity implements GroupSequenceProviderInterface -{ - public $firstName; - public $lastName; - - protected $sequence = array(); - - public function __construct($sequence) - { - $this->sequence = $sequence; - } - - public function getGroupSequence() - { - return $this->sequence; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/InvalidConstraint.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/InvalidConstraint.php deleted file mode 100644 index 6a9eaa7..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/InvalidConstraint.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Constraint; - -class InvalidConstraint extends Constraint -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/InvalidConstraintValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/InvalidConstraintValidator.php deleted file mode 100644 index bd9a5cf..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/InvalidConstraintValidator.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -class InvalidConstraintValidator -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/LegacyClassMetadata.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/LegacyClassMetadata.php deleted file mode 100644 index 6a832a1..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/LegacyClassMetadata.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\ClassBasedInterface; -use Symfony\Component\Validator\MetadataInterface; -use Symfony\Component\Validator\PropertyMetadataContainerInterface; - -interface LegacyClassMetadata extends MetadataInterface, PropertyMetadataContainerInterface, ClassBasedInterface -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/PropertyConstraint.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/PropertyConstraint.php deleted file mode 100644 index fadb535..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/PropertyConstraint.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\Constraint; - -class PropertyConstraint extends Constraint -{ - public function getTargets() - { - return self::PROPERTY_CONSTRAINT; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/Reference.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/Reference.php deleted file mode 100644 index af29735..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/Reference.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -class Reference -{ - public $value; - - private $privateValue; - - public function setPrivateValue($privateValue) - { - $this->privateValue = $privateValue; - } - - public function getPrivateValue() - { - return $this->privateValue; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/StubGlobalExecutionContext.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/StubGlobalExecutionContext.php deleted file mode 100644 index 6ae3663..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/StubGlobalExecutionContext.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Fixtures; - -use Symfony\Component\Validator\ConstraintViolationList; -use Symfony\Component\Validator\GlobalExecutionContextInterface; -use Symfony\Component\Validator\ValidationVisitorInterface; - -/** - * @since 2.5.3 - * - * @author Bernhard Schussek - * - * @deprecated - */ -class StubGlobalExecutionContext implements GlobalExecutionContextInterface -{ - private $violations; - - private $root; - - private $visitor; - - public function __construct($root = null, ValidationVisitorInterface $visitor = null) - { - $this->violations = new ConstraintViolationList(); - $this->root = $root; - $this->visitor = $visitor; - } - - public function getViolations() - { - return $this->violations; - } - - public function setRoot($root) - { - $this->root = $root; - } - - public function getRoot() - { - return $this->root; - } - - public function setVisitor(ValidationVisitorInterface $visitor) - { - $this->visitor = $visitor; - } - - public function getVisitor() - { - return $this->visitor; - } - - public function getValidatorFactory() - { - } - - public function getMetadataFactory() - { - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/LegacyExecutionContextTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/LegacyExecutionContextTest.php deleted file mode 100644 index 4fec2aa..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/LegacyExecutionContextTest.php +++ /dev/null @@ -1,336 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests; - -use Symfony\Component\Validator\Constraints\Collection; -use Symfony\Component\Validator\Constraints\All; -use Symfony\Component\Validator\ConstraintValidatorFactory; -use Symfony\Component\Validator\ConstraintViolation; -use Symfony\Component\Validator\ConstraintViolationList; -use Symfony\Component\Validator\ExecutionContext; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; -use Symfony\Component\Validator\ValidationVisitor; - -/** - * @group legacy - */ -class LegacyExecutionContextTest extends \PHPUnit_Framework_TestCase -{ - const TRANS_DOMAIN = 'trans_domain'; - - private $visitor; - private $violations; - private $metadata; - private $metadataFactory; - private $globalContext; - private $translator; - - /** - * @var ExecutionContext - */ - private $context; - - protected function setUp() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $this->visitor = $this->getMockBuilder('Symfony\Component\Validator\ValidationVisitor') - ->disableOriginalConstructor() - ->getMock(); - $this->violations = new ConstraintViolationList(); - $this->metadata = $this->getMock('Symfony\Component\Validator\MetadataInterface'); - $this->metadataFactory = $this->getMock('Symfony\Component\Validator\MetadataFactoryInterface'); - $this->globalContext = $this->getMock('Symfony\Component\Validator\GlobalExecutionContextInterface'); - $this->globalContext->expects($this->any()) - ->method('getRoot') - ->will($this->returnValue('Root')); - $this->globalContext->expects($this->any()) - ->method('getViolations') - ->will($this->returnValue($this->violations)); - $this->globalContext->expects($this->any()) - ->method('getVisitor') - ->will($this->returnValue($this->visitor)); - $this->globalContext->expects($this->any()) - ->method('getMetadataFactory') - ->will($this->returnValue($this->metadataFactory)); - $this->translator = $this->getMock('Symfony\Component\Translation\TranslatorInterface'); - $this->context = new ExecutionContext($this->globalContext, $this->translator, self::TRANS_DOMAIN, $this->metadata, 'currentValue', 'Group', 'foo.bar'); - } - - protected function tearDown() - { - $this->globalContext = null; - $this->context = null; - } - - public function testInit() - { - $this->assertCount(0, $this->context->getViolations()); - $this->assertSame('Root', $this->context->getRoot()); - $this->assertSame('foo.bar', $this->context->getPropertyPath()); - $this->assertSame('Group', $this->context->getGroup()); - } - - public function testClone() - { - $clone = clone $this->context; - - // Cloning the context keeps the reference to the original violation - // list. This way we can efficiently duplicate context instances during - // the validation run and only modify the properties that need to be - // changed. - $this->assertSame($this->context->getViolations(), $clone->getViolations()); - } - - public function testAddViolation() - { - $this->translator->expects($this->once()) - ->method('trans') - ->with('Error', array('foo' => 'bar')) - ->will($this->returnValue('Translated error')); - - $this->context->addViolation('Error', array('foo' => 'bar'), 'invalid'); - - $this->assertEquals(new ConstraintViolationList(array( - new ConstraintViolation( - 'Translated error', - 'Error', - array('foo' => 'bar'), - 'Root', - 'foo.bar', - 'invalid' - ), - )), $this->context->getViolations()); - } - - public function testAddViolationUsesPreconfiguredValueIfNotPassed() - { - $this->translator->expects($this->once()) - ->method('trans') - ->with('Error', array()) - ->will($this->returnValue('Translated error')); - - $this->context->addViolation('Error'); - - $this->assertEquals(new ConstraintViolationList(array( - new ConstraintViolation( - 'Translated error', - 'Error', - array(), - 'Root', - 'foo.bar', - 'currentValue' - ), - )), $this->context->getViolations()); - } - - public function testAddViolationUsesPassedNullValue() - { - $this->translator->expects($this->once()) - ->method('trans') - ->with('Error', array('foo1' => 'bar1')) - ->will($this->returnValue('Translated error')); - $this->translator->expects($this->once()) - ->method('transChoice') - ->with('Choice error', 1, array('foo2' => 'bar2')) - ->will($this->returnValue('Translated choice error')); - - // passed null value should override preconfigured value "invalid" - $this->context->addViolation('Error', array('foo1' => 'bar1'), null); - $this->context->addViolation('Choice error', array('foo2' => 'bar2'), null, 1); - - $this->assertEquals(new ConstraintViolationList(array( - new ConstraintViolation( - 'Translated error', - 'Error', - array('foo1' => 'bar1'), - 'Root', - 'foo.bar', - null - ), - new ConstraintViolation( - 'Translated choice error', - 'Choice error', - array('foo2' => 'bar2'), - 'Root', - 'foo.bar', - null, - 1 - ), - )), $this->context->getViolations()); - } - - public function testAddViolationAt() - { - $this->translator->expects($this->once()) - ->method('trans') - ->with('Error', array('foo' => 'bar')) - ->will($this->returnValue('Translated error')); - - // override preconfigured property path - $this->context->addViolationAt('bam.baz', 'Error', array('foo' => 'bar'), 'invalid'); - - $this->assertEquals(new ConstraintViolationList(array( - new ConstraintViolation( - 'Translated error', - 'Error', - array('foo' => 'bar'), - 'Root', - 'foo.bar.bam.baz', - 'invalid' - ), - )), $this->context->getViolations()); - } - - public function testAddViolationAtUsesPreconfiguredValueIfNotPassed() - { - $this->translator->expects($this->once()) - ->method('trans') - ->with('Error', array()) - ->will($this->returnValue('Translated error')); - - $this->context->addViolationAt('bam.baz', 'Error'); - - $this->assertEquals(new ConstraintViolationList(array( - new ConstraintViolation( - 'Translated error', - 'Error', - array(), - 'Root', - 'foo.bar.bam.baz', - 'currentValue' - ), - )), $this->context->getViolations()); - } - - public function testAddViolationAtUsesPassedNullValue() - { - $this->translator->expects($this->once()) - ->method('trans') - ->with('Error', array('foo' => 'bar')) - ->will($this->returnValue('Translated error')); - $this->translator->expects($this->once()) - ->method('transChoice') - ->with('Choice error', 2, array('foo' => 'bar')) - ->will($this->returnValue('Translated choice error')); - - // passed null value should override preconfigured value "invalid" - $this->context->addViolationAt('bam.baz', 'Error', array('foo' => 'bar'), null); - $this->context->addViolationAt('bam.baz', 'Choice error', array('foo' => 'bar'), null, 2); - - $this->assertEquals(new ConstraintViolationList(array( - new ConstraintViolation( - 'Translated error', - 'Error', - array('foo' => 'bar'), - 'Root', - 'foo.bar.bam.baz', - null - ), - new ConstraintViolation( - 'Translated choice error', - 'Choice error', - array('foo' => 'bar'), - 'Root', - 'foo.bar.bam.baz', - null, - 2 - ), - )), $this->context->getViolations()); - } - - public function testAddViolationPluralTranslationError() - { - $this->translator->expects($this->once()) - ->method('transChoice') - ->with('foo') - ->will($this->throwException(new \InvalidArgumentException())); - $this->translator->expects($this->once()) - ->method('trans') - ->with('foo'); - - $this->context->addViolation('foo', array(), null, 2); - } - - public function testGetPropertyPath() - { - $this->assertEquals('foo.bar', $this->context->getPropertyPath()); - } - - public function testGetPropertyPathWithIndexPath() - { - $this->assertEquals('foo.bar[bam]', $this->context->getPropertyPath('[bam]')); - } - - public function testGetPropertyPathWithEmptyPath() - { - $this->assertEquals('foo.bar', $this->context->getPropertyPath('')); - } - - public function testGetPropertyPathWithEmptyCurrentPropertyPath() - { - $this->context = new ExecutionContext($this->globalContext, $this->translator, self::TRANS_DOMAIN, $this->metadata, 'currentValue', 'Group', ''); - - $this->assertEquals('bam.baz', $this->context->getPropertyPath('bam.baz')); - } - - public function testGetPropertyPathWithNestedCollectionsAndAllMixed() - { - $constraints = new Collection(array( - 'shelves' => new All(array('constraints' => array( - new Collection(array( - 'name' => new ConstraintA(), - 'books' => new All(array('constraints' => array( - new ConstraintA(), - ))), - )), - ))), - 'name' => new ConstraintA(), - )); - $data = array( - 'shelves' => array( - array( - 'name' => 'Research', - 'books' => array('foo', 'bar'), - ), - array( - 'name' => 'VALID', - 'books' => array('foozy', 'VALID', 'bazzy'), - ), - ), - 'name' => 'Library', - ); - $expectedViolationPaths = array( - '[shelves][0][name]', - '[shelves][0][books][0]', - '[shelves][0][books][1]', - '[shelves][1][books][0]', - '[shelves][1][books][2]', - '[name]', - ); - - $visitor = new ValidationVisitor('Root', $this->metadataFactory, new ConstraintValidatorFactory(), $this->translator); - $context = new ExecutionContext($visitor, $this->translator, self::TRANS_DOMAIN); - $context->validateValue($data, $constraints); - - foreach ($context->getViolations() as $violation) { - $violationPaths[] = $violation->getPropertyPath(); - } - - $this->assertEquals($expectedViolationPaths, $violationPaths); - } -} - -class ExecutionContextTest_TestClass -{ - public $myProperty; -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Cache/DoctrineCacheTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Cache/DoctrineCacheTest.php deleted file mode 100644 index a2de306..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Cache/DoctrineCacheTest.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Mapping\Cache; - -use Doctrine\Common\Cache\ArrayCache; -use Symfony\Component\Validator\Mapping\Cache\DoctrineCache; - -class DoctrineCacheTest extends \PHPUnit_Framework_TestCase -{ - private $cache; - - public function testWrite() - { - $meta = $this->getMockBuilder('Symfony\\Component\\Validator\\Mapping\\ClassMetadata') - ->disableOriginalConstructor() - ->setMethods(array('getClassName')) - ->getMock(); - - $meta->expects($this->once()) - ->method('getClassName') - ->will($this->returnValue('bar')); - - $this->cache->write($meta); - - $this->assertInstanceOf( - 'Symfony\\Component\\Validator\\Mapping\\ClassMetadata', - $this->cache->read('bar'), - 'write() stores metadata' - ); - } - - public function testHas() - { - $meta = $this->getMockBuilder('Symfony\\Component\\Validator\\Mapping\\ClassMetadata') - ->disableOriginalConstructor() - ->setMethods(array('getClassName')) - ->getMock(); - - $meta->expects($this->once()) - ->method('getClassName') - ->will($this->returnValue('bar')); - - $this->assertFalse($this->cache->has('bar'), 'has() returns false when there is no entry'); - - $this->cache->write($meta); - $this->assertTrue($this->cache->has('bar'), 'has() returns true when the is an entry'); - } - - public function testRead() - { - $meta = $this->getMockBuilder('Symfony\\Component\\Validator\\Mapping\\ClassMetadata') - ->disableOriginalConstructor() - ->setMethods(array('getClassName')) - ->getMock(); - - $meta->expects($this->once()) - ->method('getClassName') - ->will($this->returnValue('bar')); - - $this->assertFalse($this->cache->read('bar'), 'read() returns false when there is no entry'); - - $this->cache->write($meta); - - $this->assertInstanceOf( - 'Symfony\\Component\\Validator\\Mapping\\ClassMetadata', - $this->cache->read('bar'), - 'read() returns metadata' - ); - } - - protected function setUp() - { - $this->cache = new DoctrineCache(new ArrayCache()); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Cache/LegacyApcCacheTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Cache/LegacyApcCacheTest.php deleted file mode 100644 index bb69cf5..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Cache/LegacyApcCacheTest.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Mapping\Cache; - -use Symfony\Component\Validator\Mapping\Cache\ApcCache; - -/** - * @group legacy - */ -class LegacyApcCacheTest extends \PHPUnit_Framework_TestCase -{ - protected function setUp() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - if (!extension_loaded('apc') || !ini_get('apc.enable_cli')) { - $this->markTestSkipped('APC is not loaded.'); - } - } - - public function testWrite() - { - $meta = $this->getMockBuilder('Symfony\\Component\\Validator\\Mapping\\ClassMetadata') - ->disableOriginalConstructor() - ->setMethods(array('getClassName')) - ->getMock(); - - $meta->expects($this->once()) - ->method('getClassName') - ->will($this->returnValue('bar')); - - $cache = new ApcCache('foo'); - $cache->write($meta); - - $this->assertInstanceOf('Symfony\\Component\\Validator\\Mapping\\ClassMetadata', apc_fetch('foobar'), '->write() stores metadata in APC'); - } - - public function testHas() - { - $meta = $this->getMockBuilder('Symfony\\Component\\Validator\\Mapping\\ClassMetadata') - ->disableOriginalConstructor() - ->setMethods(array('getClassName')) - ->getMock(); - - $meta->expects($this->once()) - ->method('getClassName') - ->will($this->returnValue('bar')); - - apc_delete('foobar'); - - $cache = new ApcCache('foo'); - $this->assertFalse($cache->has('bar'), '->has() returns false when there is no entry'); - - $cache->write($meta); - $this->assertTrue($cache->has('bar'), '->has() returns true when the is an entry'); - } - - public function testRead() - { - $meta = $this->getMockBuilder('Symfony\\Component\\Validator\\Mapping\\ClassMetadata') - ->disableOriginalConstructor() - ->setMethods(array('getClassName')) - ->getMock(); - - $meta->expects($this->once()) - ->method('getClassName') - ->will($this->returnValue('bar')); - - $cache = new ApcCache('foo'); - $cache->write($meta); - - $this->assertInstanceOf('Symfony\\Component\\Validator\\Mapping\\ClassMetadata', $cache->read('bar'), '->read() returns metadata'); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php deleted file mode 100644 index 8634ac5..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php +++ /dev/null @@ -1,280 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Mapping; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Constraints\Valid; -use Symfony\Component\Validator\Mapping\ClassMetadata; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintB; -use Symfony\Component\Validator\Tests\Fixtures\PropertyConstraint; - -class ClassMetadataTest extends \PHPUnit_Framework_TestCase -{ - const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity'; - const PARENTCLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent'; - const PROVIDERCLASS = 'Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity'; - - protected $metadata; - - protected function setUp() - { - $this->metadata = new ClassMetadata(self::CLASSNAME); - } - - protected function tearDown() - { - $this->metadata = null; - } - - public function testAddConstraintDoesNotAcceptValid() - { - $this->setExpectedException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); - - $this->metadata->addConstraint(new Valid()); - } - - public function testAddConstraintRequiresClassConstraints() - { - $this->setExpectedException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); - - $this->metadata->addConstraint(new PropertyConstraint()); - } - - public function testAddPropertyConstraints() - { - $this->metadata->addPropertyConstraint('firstName', new ConstraintA()); - $this->metadata->addPropertyConstraint('lastName', new ConstraintB()); - - $this->assertEquals(array('firstName', 'lastName'), $this->metadata->getConstrainedProperties()); - } - - public function testAddMultiplePropertyConstraints() - { - $this->metadata->addPropertyConstraints('lastName', array(new ConstraintA(), new ConstraintB())); - - $constraints = array( - new ConstraintA(array('groups' => array('Default', 'Entity'))), - new ConstraintB(array('groups' => array('Default', 'Entity'))), - ); - - $properties = $this->metadata->getPropertyMetadata('lastName'); - - $this->assertCount(1, $properties); - $this->assertEquals('lastName', $properties[0]->getName()); - $this->assertEquals($constraints, $properties[0]->getConstraints()); - } - - public function testAddGetterConstraints() - { - $this->metadata->addGetterConstraint('lastName', new ConstraintA()); - $this->metadata->addGetterConstraint('lastName', new ConstraintB()); - - $constraints = array( - new ConstraintA(array('groups' => array('Default', 'Entity'))), - new ConstraintB(array('groups' => array('Default', 'Entity'))), - ); - - $properties = $this->metadata->getPropertyMetadata('lastName'); - - $this->assertCount(1, $properties); - $this->assertEquals('getLastName', $properties[0]->getName()); - $this->assertEquals($constraints, $properties[0]->getConstraints()); - } - - public function testAddMultipleGetterConstraints() - { - $this->metadata->addGetterConstraints('lastName', array(new ConstraintA(), new ConstraintB())); - - $constraints = array( - new ConstraintA(array('groups' => array('Default', 'Entity'))), - new ConstraintB(array('groups' => array('Default', 'Entity'))), - ); - - $properties = $this->metadata->getPropertyMetadata('lastName'); - - $this->assertCount(1, $properties); - $this->assertEquals('getLastName', $properties[0]->getName()); - $this->assertEquals($constraints, $properties[0]->getConstraints()); - } - - public function testMergeConstraintsMergesClassConstraints() - { - $parent = new ClassMetadata(self::PARENTCLASS); - $parent->addConstraint(new ConstraintA()); - - $this->metadata->mergeConstraints($parent); - $this->metadata->addConstraint(new ConstraintA()); - - $constraints = array( - new ConstraintA(array('groups' => array( - 'Default', - 'EntityParent', - 'Entity', - ))), - new ConstraintA(array('groups' => array( - 'Default', - 'Entity', - ))), - ); - - $this->assertEquals($constraints, $this->metadata->getConstraints()); - } - - public function testMergeConstraintsMergesMemberConstraints() - { - $parent = new ClassMetadata(self::PARENTCLASS); - $parent->addPropertyConstraint('firstName', new ConstraintA()); - - $this->metadata->mergeConstraints($parent); - $this->metadata->addPropertyConstraint('firstName', new ConstraintA()); - - $constraints = array( - new ConstraintA(array('groups' => array( - 'Default', - 'EntityParent', - 'Entity', - ))), - new ConstraintA(array('groups' => array( - 'Default', - 'Entity', - ))), - ); - - $members = $this->metadata->getPropertyMetadata('firstName'); - - $this->assertCount(1, $members); - $this->assertEquals(self::PARENTCLASS, $members[0]->getClassName()); - $this->assertEquals($constraints, $members[0]->getConstraints()); - } - - public function testMemberMetadatas() - { - $this->metadata->addPropertyConstraint('firstName', new ConstraintA()); - - $this->assertTrue($this->metadata->hasPropertyMetadata('firstName')); - $this->assertFalse($this->metadata->hasPropertyMetadata('non_existant_field')); - } - - public function testMergeConstraintsKeepsPrivateMembersSeparate() - { - $parent = new ClassMetadata(self::PARENTCLASS); - $parent->addPropertyConstraint('internal', new ConstraintA()); - - $this->metadata->mergeConstraints($parent); - $this->metadata->addPropertyConstraint('internal', new ConstraintA()); - - $parentConstraints = array( - new ConstraintA(array('groups' => array( - 'Default', - 'EntityParent', - 'Entity', - ))), - ); - $constraints = array( - new ConstraintA(array('groups' => array( - 'Default', - 'Entity', - ))), - ); - - $members = $this->metadata->getPropertyMetadata('internal'); - - $this->assertCount(2, $members); - $this->assertEquals(self::PARENTCLASS, $members[0]->getClassName()); - $this->assertEquals($parentConstraints, $members[0]->getConstraints()); - $this->assertEquals(self::CLASSNAME, $members[1]->getClassName()); - $this->assertEquals($constraints, $members[1]->getConstraints()); - } - - public function testGetReflectionClass() - { - $reflClass = new \ReflectionClass(self::CLASSNAME); - - $this->assertEquals($reflClass, $this->metadata->getReflectionClass()); - } - - public function testSerialize() - { - $this->metadata->addConstraint(new ConstraintA(array('property1' => 'A'))); - $this->metadata->addConstraint(new ConstraintB(array('groups' => 'TestGroup'))); - $this->metadata->addPropertyConstraint('firstName', new ConstraintA()); - $this->metadata->addGetterConstraint('lastName', new ConstraintB()); - - $metadata = unserialize(serialize($this->metadata)); - - $this->assertEquals($this->metadata, $metadata); - } - - public function testGroupSequencesWorkIfContainingDefaultGroup() - { - $this->metadata->setGroupSequence(array('Foo', $this->metadata->getDefaultGroup())); - } - - public function testGroupSequencesFailIfNotContainingDefaultGroup() - { - $this->setExpectedException('Symfony\Component\Validator\Exception\GroupDefinitionException'); - - $this->metadata->setGroupSequence(array('Foo', 'Bar')); - } - - public function testGroupSequencesFailIfContainingDefault() - { - $this->setExpectedException('Symfony\Component\Validator\Exception\GroupDefinitionException'); - - $this->metadata->setGroupSequence(array('Foo', $this->metadata->getDefaultGroup(), Constraint::DEFAULT_GROUP)); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\GroupDefinitionException - */ - public function testGroupSequenceFailsIfGroupSequenceProviderIsSet() - { - $metadata = new ClassMetadata(self::PROVIDERCLASS); - $metadata->setGroupSequenceProvider(true); - $metadata->setGroupSequence(array('GroupSequenceProviderEntity', 'Foo')); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\GroupDefinitionException - */ - public function testGroupSequenceProviderFailsIfGroupSequenceIsSet() - { - $metadata = new ClassMetadata(self::PROVIDERCLASS); - $metadata->setGroupSequence(array('GroupSequenceProviderEntity', 'Foo')); - $metadata->setGroupSequenceProvider(true); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\GroupDefinitionException - */ - public function testGroupSequenceProviderFailsIfDomainClassIsInvalid() - { - $metadata = new ClassMetadata('stdClass'); - $metadata->setGroupSequenceProvider(true); - } - - public function testGroupSequenceProvider() - { - $metadata = new ClassMetadata(self::PROVIDERCLASS); - $metadata->setGroupSequenceProvider(true); - $this->assertTrue($metadata->isGroupSequenceProvider()); - } - - /** - * https://github.com/symfony/symfony/issues/11604. - */ - public function testGetPropertyMetadataReturnsEmptyArrayWithoutConfiguredMetadata() - { - $this->assertCount(0, $this->metadata->getPropertyMetadata('foo'), '->getPropertyMetadata() returns an empty collection if no metadata is configured for the given property'); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Factory/BlackHoleMetadataFactoryTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Factory/BlackHoleMetadataFactoryTest.php deleted file mode 100644 index 641bf91..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Factory/BlackHoleMetadataFactoryTest.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Mapping\Factory; - -use Symfony\Component\Validator\Mapping\Factory\BlackHoleMetadataFactory; - -class BlackHoleMetadataFactoryTest extends \PHPUnit_Framework_TestCase -{ - /** - * @expectedException \LogicException - */ - public function testGetMetadataForThrowsALogicException() - { - $metadataFactory = new BlackHoleMetadataFactory(); - $metadataFactory->getMetadataFor('foo'); - } - - public function testHasMetadataForReturnsFalse() - { - $metadataFactory = new BlackHoleMetadataFactory(); - - $this->assertFalse($metadataFactory->hasMetadataFor('foo')); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php deleted file mode 100644 index 74ee912..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php +++ /dev/null @@ -1,118 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Mapping\Factory; - -use Symfony\Component\Validator\Mapping\ClassMetadata; -use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory; -use Symfony\Component\Validator\Mapping\Loader\LoaderInterface; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; - -class LazyLoadingMetadataFactoryTest extends \PHPUnit_Framework_TestCase -{ - const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity'; - const PARENTCLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent'; - - public function testLoadClassMetadata() - { - $factory = new LazyLoadingMetadataFactory(new TestLoader()); - $metadata = $factory->getMetadataFor(self::PARENTCLASS); - - $constraints = array( - new ConstraintA(array('groups' => array('Default', 'EntityParent'))), - ); - - $this->assertEquals($constraints, $metadata->getConstraints()); - } - - public function testMergeParentConstraints() - { - $factory = new LazyLoadingMetadataFactory(new TestLoader()); - $metadata = $factory->getMetadataFor(self::CLASSNAME); - - $constraints = array( - new ConstraintA(array('groups' => array( - 'Default', - 'EntityParent', - 'Entity', - ))), - new ConstraintA(array('groups' => array( - 'Default', - 'EntityInterface', - 'Entity', - ))), - new ConstraintA(array('groups' => array( - 'Default', - 'Entity', - ))), - ); - - $this->assertEquals($constraints, $metadata->getConstraints()); - } - - public function testWriteMetadataToCache() - { - $cache = $this->getMock('Symfony\Component\Validator\Mapping\Cache\CacheInterface'); - $factory = new LazyLoadingMetadataFactory(new TestLoader(), $cache); - - $tester = $this; - $constraints = array( - new ConstraintA(array('groups' => array('Default', 'EntityParent'))), - ); - - $cache->expects($this->never()) - ->method('has'); - $cache->expects($this->once()) - ->method('read') - ->with($this->equalTo(self::PARENTCLASS)) - ->will($this->returnValue(false)); - $cache->expects($this->once()) - ->method('write') - ->will($this->returnCallback(function ($metadata) use ($tester, $constraints) { - $tester->assertEquals($constraints, $metadata->getConstraints()); - })); - - $metadata = $factory->getMetadataFor(self::PARENTCLASS); - - $this->assertEquals(self::PARENTCLASS, $metadata->getClassName()); - $this->assertEquals($constraints, $metadata->getConstraints()); - } - - public function testReadMetadataFromCache() - { - $loader = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); - $cache = $this->getMock('Symfony\Component\Validator\Mapping\Cache\CacheInterface'); - $factory = new LazyLoadingMetadataFactory($loader, $cache); - - $tester = $this; - $metadata = new ClassMetadata(self::PARENTCLASS); - $metadata->addConstraint(new ConstraintA()); - - $loader->expects($this->never()) - ->method('loadClassMetadata'); - - $cache->expects($this->never()) - ->method('has'); - $cache->expects($this->once()) - ->method('read') - ->will($this->returnValue($metadata)); - - $this->assertEquals($metadata, $factory->getMetadataFor(self::PARENTCLASS)); - } -} - -class TestLoader implements LoaderInterface -{ - public function loadClassMetadata(ClassMetadata $metadata) - { - $metadata->addConstraint(new ConstraintA()); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php deleted file mode 100644 index 0781599..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Mapping; - -use Symfony\Component\Validator\Mapping\GetterMetadata; -use Symfony\Component\Validator\Tests\Fixtures\Entity; - -class GetterMetadataTest extends \PHPUnit_Framework_TestCase -{ - const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity'; - - public function testInvalidPropertyName() - { - $this->setExpectedException('Symfony\Component\Validator\Exception\ValidatorException'); - - new GetterMetadata(self::CLASSNAME, 'foobar'); - } - - public function testGetPropertyValueFromPublicGetter() - { - // private getters don't work yet because ReflectionMethod::setAccessible() - // does not exist yet in a stable PHP release - - $entity = new Entity('foobar'); - $metadata = new GetterMetadata(self::CLASSNAME, 'internal'); - - $this->assertEquals('foobar from getter', $metadata->getPropertyValue($entity)); - } - - public function testGetPropertyValueFromOverriddenPublicGetter() - { - $entity = new Entity(); - $metadata = new GetterMetadata(self::CLASSNAME, 'data'); - - $this->assertEquals('Overridden data', $metadata->getPropertyValue($entity)); - } - - public function testGetPropertyValueFromIsser() - { - $entity = new Entity(); - $metadata = new GetterMetadata(self::CLASSNAME, 'valid'); - - $this->assertEquals('valid', $metadata->getPropertyValue($entity)); - } - - public function testGetPropertyValueFromHasser() - { - $entity = new Entity(); - $metadata = new GetterMetadata(self::CLASSNAME, 'permissions'); - - $this->assertEquals('permissions', $metadata->getPropertyValue($entity)); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/LegacyElementMetadataTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/LegacyElementMetadataTest.php deleted file mode 100644 index c77e6fe..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/LegacyElementMetadataTest.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Mapping; - -use Symfony\Component\Validator\Mapping\ElementMetadata; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintB; - -/** - * @group legacy - */ -class LegacyElementMetadataTest extends \PHPUnit_Framework_TestCase -{ - protected $metadata; - - protected function setUp() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $this->metadata = new TestElementMetadata(); - } - - protected function tearDown() - { - $this->metadata = null; - } - - public function testAddConstraints() - { - $this->metadata->addConstraint($constraint1 = new ConstraintA()); - $this->metadata->addConstraint($constraint2 = new ConstraintA()); - - $this->assertEquals(array($constraint1, $constraint2), $this->metadata->getConstraints()); - } - - public function testMultipleConstraintsOfTheSameType() - { - $constraint1 = new ConstraintA(array('property1' => 'A')); - $constraint2 = new ConstraintA(array('property1' => 'B')); - - $this->metadata->addConstraint($constraint1); - $this->metadata->addConstraint($constraint2); - - $this->assertEquals(array($constraint1, $constraint2), $this->metadata->getConstraints()); - } - - public function testFindConstraintsByGroup() - { - $constraint1 = new ConstraintA(array('groups' => 'TestGroup')); - $constraint2 = new ConstraintB(); - - $this->metadata->addConstraint($constraint1); - $this->metadata->addConstraint($constraint2); - - $this->assertEquals(array($constraint1), $this->metadata->findConstraints('TestGroup')); - } - - public function testSerialize() - { - $this->metadata->addConstraint(new ConstraintA(array('property1' => 'A'))); - $this->metadata->addConstraint(new ConstraintB(array('groups' => 'TestGroup'))); - - $metadata = unserialize(serialize($this->metadata)); - - $this->assertEquals($this->metadata, $metadata); - } -} - -class TestElementMetadata extends ElementMetadata -{ -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/AbstractStaticMethodLoader.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/AbstractStaticMethodLoader.php deleted file mode 100644 index 08f219d..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/AbstractStaticMethodLoader.php +++ /dev/null @@ -1,10 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Mapping\Loader; - -use Doctrine\Common\Annotations\AnnotationReader; -use Symfony\Component\Validator\Constraints\All; -use Symfony\Component\Validator\Constraints\Callback; -use Symfony\Component\Validator\Constraints\Choice; -use Symfony\Component\Validator\Constraints\Collection; -use Symfony\Component\Validator\Constraints\NotNull; -use Symfony\Component\Validator\Constraints\Range; -use Symfony\Component\Validator\Constraints\True; -use Symfony\Component\Validator\Mapping\ClassMetadata; -use Symfony\Component\Validator\Mapping\Loader\AnnotationLoader; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; - -require_once __DIR__.'/../../../Constraints/All.php'; -require_once __DIR__.'/../../../Constraints/Callback.php'; -require_once __DIR__.'/../../../Constraints/Choice.php'; -require_once __DIR__.'/../../../Constraints/Collection.php'; -require_once __DIR__.'/../../../Constraints/GroupSequence.php'; -require_once __DIR__.'/../../../Constraints/GroupSequenceProvider.php'; -require_once __DIR__.'/../../../Constraints/NotNull.php'; -require_once __DIR__.'/../../../Constraints/Range.php'; -require_once __DIR__.'/../../Fixtures/ConstraintA.php'; - -class AnnotationLoaderTest extends \PHPUnit_Framework_TestCase -{ - public function testLoadClassMetadataReturnsTrueIfSuccessful() - { - $reader = new AnnotationReader(); - $loader = new AnnotationLoader($reader); - $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - - $this->assertTrue($loader->loadClassMetadata($metadata)); - } - - public function testLoadClassMetadataReturnsFalseIfNotSuccessful() - { - $loader = new AnnotationLoader(new AnnotationReader()); - $metadata = new ClassMetadata('\stdClass'); - - $this->assertFalse($loader->loadClassMetadata($metadata)); - } - - public function testLoadClassMetadata() - { - $loader = new AnnotationLoader(new AnnotationReader()); - $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - - $loader->loadClassMetadata($metadata); - - $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - $expected->setGroupSequence(array('Foo', 'Entity')); - $expected->addConstraint(new ConstraintA()); - $expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback'))); - $expected->addConstraint(new Callback('validateMe')); - $expected->addConstraint(new Callback('validateMeStatic')); - $expected->addPropertyConstraint('firstName', new NotNull()); - $expected->addPropertyConstraint('firstName', new Range(array('min' => 3))); - $expected->addPropertyConstraint('firstName', new All(array(new NotNull(), new Range(array('min' => 3))))); - $expected->addPropertyConstraint('firstName', new All(array('constraints' => array(new NotNull(), new Range(array('min' => 3)))))); - $expected->addPropertyConstraint('firstName', new Collection(array('fields' => array( - 'foo' => array(new NotNull(), new Range(array('min' => 3))), - 'bar' => new Range(array('min' => 5)), - )))); - $expected->addPropertyConstraint('firstName', new Choice(array( - 'message' => 'Must be one of %choices%', - 'choices' => array('A', 'B'), - ))); - $expected->addGetterConstraint('lastName', new NotNull()); - $expected->addGetterConstraint('valid', new True()); - $expected->addGetterConstraint('permissions', new True()); - - // load reflection class so that the comparison passes - $expected->getReflectionClass(); - - $this->assertEquals($expected, $metadata); - } - - /** - * Test MetaData merge with parent annotation. - */ - public function testLoadParentClassMetadata() - { - $loader = new AnnotationLoader(new AnnotationReader()); - - // Load Parent MetaData - $parent_metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\EntityParent'); - $loader->loadClassMetadata($parent_metadata); - - $expected_parent = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\EntityParent'); - $expected_parent->addPropertyConstraint('other', new NotNull()); - $expected_parent->getReflectionClass(); - - $this->assertEquals($expected_parent, $parent_metadata); - } - /** - * Test MetaData merge with parent annotation. - */ - public function testLoadClassMetadataAndMerge() - { - $loader = new AnnotationLoader(new AnnotationReader()); - - // Load Parent MetaData - $parent_metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\EntityParent'); - $loader->loadClassMetadata($parent_metadata); - - $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - - // Merge parent metaData. - $metadata->mergeConstraints($parent_metadata); - - $loader->loadClassMetadata($metadata); - - $expected_parent = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\EntityParent'); - $expected_parent->addPropertyConstraint('other', new NotNull()); - $expected_parent->getReflectionClass(); - - $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - $expected->mergeConstraints($expected_parent); - - $expected->setGroupSequence(array('Foo', 'Entity')); - $expected->addConstraint(new ConstraintA()); - $expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback'))); - $expected->addConstraint(new Callback('validateMe')); - $expected->addConstraint(new Callback('validateMeStatic')); - $expected->addPropertyConstraint('firstName', new NotNull()); - $expected->addPropertyConstraint('firstName', new Range(array('min' => 3))); - $expected->addPropertyConstraint('firstName', new All(array(new NotNull(), new Range(array('min' => 3))))); - $expected->addPropertyConstraint('firstName', new All(array('constraints' => array(new NotNull(), new Range(array('min' => 3)))))); - $expected->addPropertyConstraint('firstName', new Collection(array('fields' => array( - 'foo' => array(new NotNull(), new Range(array('min' => 3))), - 'bar' => new Range(array('min' => 5)), - )))); - $expected->addPropertyConstraint('firstName', new Choice(array( - 'message' => 'Must be one of %choices%', - 'choices' => array('A', 'B'), - ))); - $expected->addGetterConstraint('lastName', new NotNull()); - $expected->addGetterConstraint('valid', new True()); - $expected->addGetterConstraint('permissions', new True()); - - // load reflection class so that the comparison passes - $expected->getReflectionClass(); - - $this->assertEquals($expected, $metadata); - } - - public function testLoadGroupSequenceProviderAnnotation() - { - $loader = new AnnotationLoader(new AnnotationReader()); - - $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity'); - $loader->loadClassMetadata($metadata); - - $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity'); - $expected->setGroupSequenceProvider(true); - $expected->getReflectionClass(); - - $this->assertEquals($expected, $metadata); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/FilesLoaderTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/FilesLoaderTest.php deleted file mode 100644 index 09e6e44..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/FilesLoaderTest.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Mapping\Loader; - -use Symfony\Component\Validator\Mapping\ClassMetadata; -use Symfony\Component\Validator\Mapping\Loader\LoaderInterface; - -class FilesLoaderTest extends \PHPUnit_Framework_TestCase -{ - public function testCallsGetFileLoaderInstanceForeachPath() - { - $loader = $this->getFilesLoader($this->getFileLoader()); - $this->assertEquals(4, $loader->getTimesCalled()); - } - - public function testCallsActualFileLoaderForMetadata() - { - $fileLoader = $this->getFileLoader(); - $fileLoader->expects($this->exactly(4)) - ->method('loadClassMetadata'); - $loader = $this->getFilesLoader($fileLoader); - $loader->loadClassMetadata(new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity')); - } - - public function getFilesLoader(LoaderInterface $loader) - { - return $this->getMockForAbstractClass('Symfony\Component\Validator\Tests\Fixtures\FilesLoader', array(array( - __DIR__.'/constraint-mapping.xml', - __DIR__.'/constraint-mapping.yaml', - __DIR__.'/constraint-mapping.test', - __DIR__.'/constraint-mapping.txt', - ), $loader)); - } - - public function getFileLoader() - { - return $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/LoaderChainTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/LoaderChainTest.php deleted file mode 100644 index 647a568..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/LoaderChainTest.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Mapping\Loader; - -use Symfony\Component\Validator\Mapping\ClassMetadata; -use Symfony\Component\Validator\Mapping\Loader\LoaderChain; - -class LoaderChainTest extends \PHPUnit_Framework_TestCase -{ - public function testAllLoadersAreCalled() - { - $metadata = new ClassMetadata('\stdClass'); - - $loader1 = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); - $loader1->expects($this->once()) - ->method('loadClassMetadata') - ->with($this->equalTo($metadata)); - - $loader2 = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); - $loader2->expects($this->once()) - ->method('loadClassMetadata') - ->with($this->equalTo($metadata)); - - $chain = new LoaderChain(array( - $loader1, - $loader2, - )); - - $chain->loadClassMetadata($metadata); - } - - public function testReturnsTrueIfAnyLoaderReturnedTrue() - { - $metadata = new ClassMetadata('\stdClass'); - - $loader1 = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); - $loader1->expects($this->any()) - ->method('loadClassMetadata') - ->will($this->returnValue(true)); - - $loader2 = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); - $loader2->expects($this->any()) - ->method('loadClassMetadata') - ->will($this->returnValue(false)); - - $chain = new LoaderChain(array( - $loader1, - $loader2, - )); - - $this->assertTrue($chain->loadClassMetadata($metadata)); - } - - public function testReturnsFalseIfNoLoaderReturnedTrue() - { - $metadata = new ClassMetadata('\stdClass'); - - $loader1 = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); - $loader1->expects($this->any()) - ->method('loadClassMetadata') - ->will($this->returnValue(false)); - - $loader2 = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); - $loader2->expects($this->any()) - ->method('loadClassMetadata') - ->will($this->returnValue(false)); - - $chain = new LoaderChain(array( - $loader1, - $loader2, - )); - - $this->assertFalse($chain->loadClassMetadata($metadata)); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php deleted file mode 100644 index 5829336..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php +++ /dev/null @@ -1,143 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Mapping\Loader; - -use Symfony\Component\Validator\Mapping\ClassMetadata; -use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; - -class StaticMethodLoaderTest extends \PHPUnit_Framework_TestCase -{ - private $errorLevel; - - protected function setUp() - { - $this->errorLevel = error_reporting(); - } - - protected function tearDown() - { - error_reporting($this->errorLevel); - } - - public function testLoadClassMetadataReturnsTrueIfSuccessful() - { - $loader = new StaticMethodLoader('loadMetadata'); - $metadata = new ClassMetadata(__NAMESPACE__.'\StaticLoaderEntity'); - - $this->assertTrue($loader->loadClassMetadata($metadata)); - } - - public function testLoadClassMetadataReturnsFalseIfNotSuccessful() - { - $loader = new StaticMethodLoader('loadMetadata'); - $metadata = new ClassMetadata('\stdClass'); - - $this->assertFalse($loader->loadClassMetadata($metadata)); - } - - public function testLoadClassMetadata() - { - $loader = new StaticMethodLoader('loadMetadata'); - $metadata = new ClassMetadata(__NAMESPACE__.'\StaticLoaderEntity'); - - $loader->loadClassMetadata($metadata); - - $this->assertEquals(StaticLoaderEntity::$invokedWith, $metadata); - } - - public function testLoadClassMetadataDoesNotRepeatLoadWithParentClasses() - { - $loader = new StaticMethodLoader('loadMetadata'); - $metadata = new ClassMetadata(__NAMESPACE__.'\StaticLoaderDocument'); - $loader->loadClassMetadata($metadata); - $this->assertCount(0, $metadata->getConstraints()); - - $loader = new StaticMethodLoader('loadMetadata'); - $metadata = new ClassMetadata(__NAMESPACE__.'\BaseStaticLoaderDocument'); - $loader->loadClassMetadata($metadata); - $this->assertCount(1, $metadata->getConstraints()); - } - - public function testLoadClassMetadataIgnoresInterfaces() - { - $loader = new StaticMethodLoader('loadMetadata'); - $metadata = new ClassMetadata(__NAMESPACE__.'\StaticLoaderInterface'); - - $loader->loadClassMetadata($metadata); - - $this->assertCount(0, $metadata->getConstraints()); - } - - public function testLoadClassMetadataInAbstractClasses() - { - $loader = new StaticMethodLoader('loadMetadata'); - $metadata = new ClassMetadata(__NAMESPACE__.'\AbstractStaticLoader'); - - $loader->loadClassMetadata($metadata); - - $this->assertCount(1, $metadata->getConstraints()); - } - - public function testLoadClassMetadataIgnoresAbstractMethods() - { - // Disable error reporting, as AbstractStaticMethodLoader produces a - // strict standards error - error_reporting(0); - - if (0 !== error_reporting()) { - $this->markTestSkipped('Could not disable error reporting'); - } - - $metadata = new ClassMetadata(__NAMESPACE__.'\AbstractStaticMethodLoader'); - - $loader = new StaticMethodLoader('loadMetadata'); - $loader->loadClassMetadata($metadata); - - $this->assertCount(0, $metadata->getConstraints()); - } -} - -interface StaticLoaderInterface -{ - public static function loadMetadata(ClassMetadata $metadata); -} - -abstract class AbstractStaticLoader -{ - public static function loadMetadata(ClassMetadata $metadata) - { - $metadata->addConstraint(new ConstraintA()); - } -} - -class StaticLoaderEntity -{ - public static $invokedWith = null; - - public static function loadMetadata(ClassMetadata $metadata) - { - self::$invokedWith = $metadata; - } -} - -class StaticLoaderDocument extends BaseStaticLoaderDocument -{ -} - -class BaseStaticLoaderDocument -{ - public static function loadMetadata(ClassMetadata $metadata) - { - $metadata->addConstraint(new ConstraintA()); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php deleted file mode 100644 index 8ab2065..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php +++ /dev/null @@ -1,133 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Mapping\Loader; - -use Symfony\Component\Validator\Constraints\All; -use Symfony\Component\Validator\Constraints\Callback; -use Symfony\Component\Validator\Constraints\Choice; -use Symfony\Component\Validator\Constraints\Collection; -use Symfony\Component\Validator\Constraints\NotNull; -use Symfony\Component\Validator\Constraints\Range; -use Symfony\Component\Validator\Constraints\Regex; -use Symfony\Component\Validator\Constraints\True; -use Symfony\Component\Validator\Exception\MappingException; -use Symfony\Component\Validator\Mapping\ClassMetadata; -use Symfony\Component\Validator\Mapping\Loader\XmlFileLoader; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintB; - -class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase -{ - public function testLoadClassMetadataReturnsTrueIfSuccessful() - { - $loader = new XmlFileLoader(__DIR__.'/constraint-mapping.xml'); - $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - - $this->assertTrue($loader->loadClassMetadata($metadata)); - } - - public function testLoadClassMetadataReturnsFalseIfNotSuccessful() - { - $loader = new XmlFileLoader(__DIR__.'/constraint-mapping.xml'); - $metadata = new ClassMetadata('\stdClass'); - - $this->assertFalse($loader->loadClassMetadata($metadata)); - } - - public function testLoadClassMetadata() - { - $loader = new XmlFileLoader(__DIR__.'/constraint-mapping.xml'); - $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - - $loader->loadClassMetadata($metadata); - - $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - $expected->setGroupSequence(array('Foo', 'Entity')); - $expected->addConstraint(new ConstraintA()); - $expected->addConstraint(new ConstraintB()); - $expected->addConstraint(new Callback('validateMe')); - $expected->addConstraint(new Callback('validateMeStatic')); - $expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback'))); - $expected->addPropertyConstraint('firstName', new NotNull()); - $expected->addPropertyConstraint('firstName', new Range(array('min' => 3))); - $expected->addPropertyConstraint('firstName', new Choice(array('A', 'B'))); - $expected->addPropertyConstraint('firstName', new All(array(new NotNull(), new Range(array('min' => 3))))); - $expected->addPropertyConstraint('firstName', new All(array('constraints' => array(new NotNull(), new Range(array('min' => 3)))))); - $expected->addPropertyConstraint('firstName', new Collection(array('fields' => array( - 'foo' => array(new NotNull(), new Range(array('min' => 3))), - 'bar' => array(new Range(array('min' => 5))), - )))); - $expected->addPropertyConstraint('firstName', new Choice(array( - 'message' => 'Must be one of %choices%', - 'choices' => array('A', 'B'), - ))); - $expected->addGetterConstraint('lastName', new NotNull()); - $expected->addGetterConstraint('valid', new True()); - $expected->addGetterConstraint('permissions', new True()); - - $this->assertEquals($expected, $metadata); - } - - public function testLoadClassMetadataWithNonStrings() - { - $loader = new XmlFileLoader(__DIR__.'/constraint-mapping-non-strings.xml'); - $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - - $loader->loadClassMetadata($metadata); - - $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - $expected->addPropertyConstraint('firstName', new Regex(array('pattern' => '/^1/', 'match' => false))); - - $properties = $metadata->getPropertyMetadata('firstName'); - $constraints = $properties[0]->getConstraints(); - - $this->assertFalse($constraints[0]->match); - } - - public function testLoadGroupSequenceProvider() - { - $loader = new XmlFileLoader(__DIR__.'/constraint-mapping.xml'); - $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity'); - - $loader->loadClassMetadata($metadata); - - $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity'); - $expected->setGroupSequenceProvider(true); - - $this->assertEquals($expected, $metadata); - } - - public function testThrowExceptionIfDocTypeIsSet() - { - $loader = new XmlFileLoader(__DIR__.'/withdoctype.xml'); - $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - - $this->setExpectedException('\Symfony\Component\Validator\Exception\MappingException'); - $loader->loadClassMetadata($metadata); - } - - /** - * @see https://github.com/symfony/symfony/pull/12158 - */ - public function testDoNotModifyStateIfExceptionIsThrown() - { - $loader = new XmlFileLoader(__DIR__.'/withdoctype.xml'); - $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - - try { - $loader->loadClassMetadata($metadata); - } catch (MappingException $e) { - $this->setExpectedException('\Symfony\Component\Validator\Exception\MappingException'); - $loader->loadClassMetadata($metadata); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php deleted file mode 100644 index 806a2b0..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php +++ /dev/null @@ -1,123 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Mapping\Loader; - -use Symfony\Component\Validator\Constraints\All; -use Symfony\Component\Validator\Constraints\Callback; -use Symfony\Component\Validator\Constraints\Choice; -use Symfony\Component\Validator\Constraints\Collection; -use Symfony\Component\Validator\Constraints\NotNull; -use Symfony\Component\Validator\Constraints\Range; -use Symfony\Component\Validator\Constraints\True; -use Symfony\Component\Validator\Mapping\ClassMetadata; -use Symfony\Component\Validator\Mapping\Loader\YamlFileLoader; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintB; - -class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase -{ - public function testLoadClassMetadataReturnsFalseIfEmpty() - { - $loader = new YamlFileLoader(__DIR__.'/empty-mapping.yml'); - $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - - $this->assertFalse($loader->loadClassMetadata($metadata)); - } - - public function testLoadClassMetadataThrowsExceptionIfNotAnArray() - { - $loader = new YamlFileLoader(__DIR__.'/nonvalid-mapping.yml'); - $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - - $this->setExpectedException('\InvalidArgumentException'); - $loader->loadClassMetadata($metadata); - } - - /** - * @see https://github.com/symfony/symfony/pull/12158 - */ - public function testDoNotModifyStateIfExceptionIsThrown() - { - $loader = new YamlFileLoader(__DIR__.'/nonvalid-mapping.yml'); - $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - try { - $loader->loadClassMetadata($metadata); - } catch (\InvalidArgumentException $e) { - // Call again. Again an exception should be thrown - $this->setExpectedException('\InvalidArgumentException'); - $loader->loadClassMetadata($metadata); - } - } - - public function testLoadClassMetadataReturnsTrueIfSuccessful() - { - $loader = new YamlFileLoader(__DIR__.'/constraint-mapping.yml'); - $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - - $this->assertTrue($loader->loadClassMetadata($metadata)); - } - - public function testLoadClassMetadataReturnsFalseIfNotSuccessful() - { - $loader = new YamlFileLoader(__DIR__.'/constraint-mapping.yml'); - $metadata = new ClassMetadata('\stdClass'); - - $this->assertFalse($loader->loadClassMetadata($metadata)); - } - - public function testLoadClassMetadata() - { - $loader = new YamlFileLoader(__DIR__.'/constraint-mapping.yml'); - $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - - $loader->loadClassMetadata($metadata); - - $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - $expected->setGroupSequence(array('Foo', 'Entity')); - $expected->addConstraint(new ConstraintA()); - $expected->addConstraint(new ConstraintB()); - $expected->addConstraint(new Callback('validateMe')); - $expected->addConstraint(new Callback('validateMeStatic')); - $expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback'))); - $expected->addPropertyConstraint('firstName', new NotNull()); - $expected->addPropertyConstraint('firstName', new Range(array('min' => 3))); - $expected->addPropertyConstraint('firstName', new Choice(array('A', 'B'))); - $expected->addPropertyConstraint('firstName', new All(array(new NotNull(), new Range(array('min' => 3))))); - $expected->addPropertyConstraint('firstName', new All(array('constraints' => array(new NotNull(), new Range(array('min' => 3)))))); - $expected->addPropertyConstraint('firstName', new Collection(array('fields' => array( - 'foo' => array(new NotNull(), new Range(array('min' => 3))), - 'bar' => array(new Range(array('min' => 5))), - )))); - $expected->addPropertyConstraint('firstName', new Choice(array( - 'message' => 'Must be one of %choices%', - 'choices' => array('A', 'B'), - ))); - $expected->addGetterConstraint('lastName', new NotNull()); - $expected->addGetterConstraint('valid', new True()); - $expected->addGetterConstraint('permissions', new True()); - - $this->assertEquals($expected, $metadata); - } - - public function testLoadGroupSequenceProvider() - { - $loader = new YamlFileLoader(__DIR__.'/constraint-mapping.yml'); - $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity'); - - $loader->loadClassMetadata($metadata); - - $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity'); - $expected->setGroupSequenceProvider(true); - - $this->assertEquals($expected, $metadata); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/constraint-mapping-non-strings.xml b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/constraint-mapping-non-strings.xml deleted file mode 100644 index dfd5edd..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/constraint-mapping-non-strings.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - Symfony\Component\Validator\Tests\Fixtures\ - - - - - - - - - - - - diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/constraint-mapping.xml b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/constraint-mapping.xml deleted file mode 100644 index 9b637e9..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/constraint-mapping.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - - - Symfony\Component\Validator\Tests\Fixtures\ - - - - - Foo - Entity - - - - - - - - - - - - validateMe - - validateMeStatic - - - Symfony\Component\Validator\Tests\Fixtures\CallbackClass - callback - - - - - - - - - - - - - - - - - A - B - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/constraint-mapping.yml b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/constraint-mapping.yml deleted file mode 100644 index e96c5e0..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/constraint-mapping.yml +++ /dev/null @@ -1,62 +0,0 @@ -namespaces: - custom: Symfony\Component\Validator\Tests\Fixtures\ - -Symfony\Component\Validator\Tests\Fixtures\Entity: - group_sequence: - - Foo - - Entity - - constraints: - # Custom constraint - - Symfony\Component\Validator\Tests\Fixtures\ConstraintA: ~ - # Custom constraint with namespaces prefix - - "custom:ConstraintB": ~ - # Callbacks - - Callback: validateMe - - Callback: validateMeStatic - - Callback: [Symfony\Component\Validator\Tests\Fixtures\CallbackClass, callback] - - properties: - firstName: - # Constraint without value - - NotNull: ~ - # Constraint with single value - - Range: - min: 3 - # Constraint with multiple values - - Choice: [A, B] - # Constraint with child constraints - - All: - - NotNull: ~ - - Range: - min: 3 - # Option with child constraints - - All: - constraints: - - NotNull: ~ - - Range: - min: 3 - # Value with child constraints - - Collection: - fields: - foo: - - NotNull: ~ - - Range: - min: 3 - bar: - - Range: - min: 5 - # Constraint with options - - Choice: { choices: [A, B], message: Must be one of %choices% } - dummy: - - getters: - lastName: - - NotNull: ~ - valid: - - "True": ~ - permissions: - - "True": ~ - -Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity: - group_sequence_provider: true diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/empty-mapping.yml b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/empty-mapping.yml deleted file mode 100644 index e69de29..0000000 diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/nonvalid-mapping.yml b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/nonvalid-mapping.yml deleted file mode 100644 index 257cc56..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/nonvalid-mapping.yml +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/withdoctype.xml b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/withdoctype.xml deleted file mode 100644 index 0beacc3..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/Loader/withdoctype.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php deleted file mode 100644 index f91088d..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php +++ /dev/null @@ -1,110 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Mapping; - -use Symfony\Component\Validator\Constraints\Valid; -use Symfony\Component\Validator\Mapping\MemberMetadata; -use Symfony\Component\Validator\Tests\Fixtures\ClassConstraint; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; -use Symfony\Component\Validator\Tests\Fixtures\ConstraintB; - -class MemberMetadataTest extends \PHPUnit_Framework_TestCase -{ - protected $metadata; - - protected function setUp() - { - $this->metadata = new TestMemberMetadata( - 'Symfony\Component\Validator\Tests\Fixtures\Entity', - 'getLastName', - 'lastName' - ); - } - - protected function tearDown() - { - $this->metadata = null; - } - - public function testAddValidSetsMemberToCascaded() - { - $result = $this->metadata->addConstraint(new Valid()); - - $this->assertEquals(array(), $this->metadata->getConstraints()); - $this->assertEquals($result, $this->metadata); - $this->assertTrue($this->metadata->isCascaded()); - } - - public function testAddOtherConstraintDoesNotSetMemberToCascaded() - { - $result = $this->metadata->addConstraint($constraint = new ConstraintA()); - - $this->assertEquals(array($constraint), $this->metadata->getConstraints()); - $this->assertEquals($result, $this->metadata); - $this->assertFalse($this->metadata->isCascaded()); - } - - public function testAddConstraintRequiresClassConstraints() - { - $this->setExpectedException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); - - $this->metadata->addConstraint(new ClassConstraint()); - } - - public function testSerialize() - { - $this->metadata->addConstraint(new ConstraintA(array('property1' => 'A'))); - $this->metadata->addConstraint(new ConstraintB(array('groups' => 'TestGroup'))); - - $metadata = unserialize(serialize($this->metadata)); - - $this->assertEquals($this->metadata, $metadata); - } - - public function testSerializeCollectionCascaded() - { - $this->metadata->addConstraint(new Valid(array('traverse' => true, 'deep' => false))); - - $metadata = unserialize(serialize($this->metadata)); - - $this->assertEquals($this->metadata, $metadata); - } - - public function testSerializeCollectionCascadedDeeply() - { - $this->metadata->addConstraint(new Valid(array('traverse' => true, 'deep' => true))); - - $metadata = unserialize(serialize($this->metadata)); - - $this->assertEquals($this->metadata, $metadata); - } - - public function testSerializeCollectionNotCascaded() - { - $this->metadata->addConstraint(new Valid(array('traverse' => false))); - - $metadata = unserialize(serialize($this->metadata)); - - $this->assertEquals($this->metadata, $metadata); - } -} - -class TestMemberMetadata extends MemberMetadata -{ - public function getPropertyValue($object) - { - } - - protected function newReflectionMember($object) - { - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php deleted file mode 100644 index f411d95..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Mapping; - -use Symfony\Component\Validator\Mapping\PropertyMetadata; -use Symfony\Component\Validator\Tests\Fixtures\Entity; - -class PropertyMetadataTest extends \PHPUnit_Framework_TestCase -{ - const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity'; - const PARENTCLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent'; - - public function testInvalidPropertyName() - { - $this->setExpectedException('Symfony\Component\Validator\Exception\ValidatorException'); - - new PropertyMetadata(self::CLASSNAME, 'foobar'); - } - - public function testGetPropertyValueFromPrivateProperty() - { - $entity = new Entity('foobar'); - $metadata = new PropertyMetadata(self::CLASSNAME, 'internal'); - - $this->assertEquals('foobar', $metadata->getPropertyValue($entity)); - } - - public function testGetPropertyValueFromOverriddenPrivateProperty() - { - $entity = new Entity('foobar'); - $metadata = new PropertyMetadata(self::PARENTCLASS, 'data'); - - $this->assertTrue($metadata->isPublic($entity)); - $this->assertEquals('Overridden data', $metadata->getPropertyValue($entity)); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Util/PropertyPathTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Util/PropertyPathTest.php deleted file mode 100644 index 94802b6..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Util/PropertyPathTest.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Util; - -use Symfony\Component\Validator\Util\PropertyPath; - -class PropertyPathTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider provideAppendPaths - */ - public function testAppend($basePath, $subPath, $expectedPath, $message) - { - $this->assertSame($expectedPath, PropertyPath::append($basePath, $subPath), $message); - } - - public function provideAppendPaths() - { - return array( - array('foo', '', 'foo', 'It returns the basePath if subPath is empty'), - array('', 'bar', 'bar', 'It returns the subPath if basePath is empty'), - array('foo', 'bar', 'foo.bar', 'It append the subPath to the basePath'), - array('foo', '[bar]', 'foo[bar]', 'It does not include the dot separator if subPath uses the array notation'), - ); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Validator/Abstract2Dot5ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Validator/Abstract2Dot5ApiTest.php deleted file mode 100644 index 684731f..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Validator/Abstract2Dot5ApiTest.php +++ /dev/null @@ -1,776 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Validator; - -use Symfony\Component\Validator\Constraints\Callback; -use Symfony\Component\Validator\Constraints\GroupSequence; -use Symfony\Component\Validator\Constraints\NotNull; -use Symfony\Component\Validator\Constraints\Traverse; -use Symfony\Component\Validator\Constraints\Valid; -use Symfony\Component\Validator\ConstraintViolationInterface; -use Symfony\Component\Validator\Context\ExecutionContextInterface; -use Symfony\Component\Validator\Mapping\ClassMetadata; -use Symfony\Component\Validator\MetadataFactoryInterface; -use Symfony\Component\Validator\Tests\Fixtures\Entity; -use Symfony\Component\Validator\Tests\Fixtures\FailingConstraint; -use Symfony\Component\Validator\Tests\Fixtures\FakeClassMetadata; -use Symfony\Component\Validator\Tests\Fixtures\Reference; -use Symfony\Component\Validator\Validator\ValidatorInterface; - -/** - * Verifies that a validator satisfies the API of Symfony 2.5+. - * - * @since 2.5 - * @author Bernhard Schussek - */ -abstract class Abstract2Dot5ApiTest extends AbstractValidatorTest -{ - /** - * @var ValidatorInterface - */ - protected $validator; - - /** - * @param MetadataFactoryInterface $metadataFactory - * - * @return ValidatorInterface - */ - abstract protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array()); - - protected function setUp() - { - parent::setUp(); - - $this->validator = $this->createValidator($this->metadataFactory); - } - - protected function validate($value, $constraints = null, $groups = null) - { - return $this->validator->validate($value, $constraints, $groups); - } - - protected function validateProperty($object, $propertyName, $groups = null) - { - return $this->validator->validateProperty($object, $propertyName, $groups); - } - - protected function validatePropertyValue($object, $propertyName, $value, $groups = null) - { - return $this->validator->validatePropertyValue($object, $propertyName, $value, $groups); - } - - public function testValidateConstraintWithoutGroup() - { - $violations = $this->validator->validate(null, new NotNull()); - - $this->assertCount(1, $violations); - } - - public function testGroupSequenceAbortsAfterFailedGroup() - { - $entity = new Entity(); - - $callback1 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Message 1'); - }; - $callback2 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Message 2'); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => function () {}, - 'groups' => 'Group 1', - ))); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group 2', - ))); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group 3', - ))); - - $sequence = new GroupSequence(array('Group 1', 'Group 2', 'Group 3')); - $violations = $this->validator->validate($entity, new Valid(), $sequence); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message 1', $violations[0]->getMessage()); - } - - public function testGroupSequenceIncludesReferences() - { - $entity = new Entity(); - $entity->reference = new Reference(); - - $callback1 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Reference violation 1'); - }; - $callback2 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Reference violation 2'); - }; - - $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group 1', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group 2', - ))); - - $sequence = new GroupSequence(array('Group 1', 'Entity')); - $violations = $this->validator->validate($entity, new Valid(), $sequence); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Reference violation 1', $violations[0]->getMessage()); - } - - public function testValidateInSeparateContext() - { - $test = $this; - $entity = new Entity(); - $entity->reference = new Reference(); - - $callback1 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $violations = $context - ->getValidator() - // Since the validator is not context aware, the group must - // be passed explicitly - ->validate($value->reference, new Valid(), 'Group') - ; - - /** @var ConstraintViolationInterface[] $violations */ - $test->assertCount(1, $violations); - $test->assertSame('Message value', $violations[0]->getMessage()); - $test->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $test->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $test->assertSame('', $violations[0]->getPropertyPath()); - // The root is different as we're in a new context - $test->assertSame($entity->reference, $violations[0]->getRoot()); - $test->assertSame($entity->reference, $violations[0]->getInvalidValue()); - $test->assertNull($violations[0]->getMessagePluralization()); - $test->assertNull($violations[0]->getCode()); - - // Verify that this method is called - $context->addViolation('Separate violation'); - }; - - $callback2 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($entity->reference, $context->getRoot()); - $test->assertSame($entity->reference, $context->getValue()); - $test->assertSame($entity->reference, $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group', - ))); - - $violations = $this->validator->validate($entity, new Valid(), 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $test->assertSame('Separate violation', $violations[0]->getMessage()); - } - - public function testValidateInContext() - { - $test = $this; - $entity = new Entity(); - $entity->reference = new Reference(); - - $callback1 = function ($value, ExecutionContextInterface $context) use ($test) { - $previousValue = $context->getValue(); - $previousObject = $context->getObject(); - $previousMetadata = $context->getMetadata(); - $previousPath = $context->getPropertyPath(); - $previousGroup = $context->getGroup(); - - $context - ->getValidator() - ->inContext($context) - ->atPath('subpath') - ->validate($value->reference) - ; - - // context changes shouldn't leak out of the validate() call - $test->assertSame($previousValue, $context->getValue()); - $test->assertSame($previousObject, $context->getObject()); - $test->assertSame($previousMetadata, $context->getMetadata()); - $test->assertSame($previousPath, $context->getPropertyPath()); - $test->assertSame($previousGroup, $context->getGroup()); - }; - - $callback2 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('subpath', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity->reference, $context->getValue()); - $test->assertSame($entity->reference, $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group', - ))); - - $violations = $this->validator->validate($entity, new Valid(), 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('subpath', $violations[0]->getPropertyPath()); - $this->assertSame($entity, $violations[0]->getRoot()); - $this->assertSame($entity->reference, $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testValidateArrayInContext() - { - $test = $this; - $entity = new Entity(); - $entity->reference = new Reference(); - - $callback1 = function ($value, ExecutionContextInterface $context) use ($test) { - $previousValue = $context->getValue(); - $previousObject = $context->getObject(); - $previousMetadata = $context->getMetadata(); - $previousPath = $context->getPropertyPath(); - $previousGroup = $context->getGroup(); - - $context - ->getValidator() - ->inContext($context) - ->atPath('subpath') - ->validate(array('key' => $value->reference)) - ; - - // context changes shouldn't leak out of the validate() call - $test->assertSame($previousValue, $context->getValue()); - $test->assertSame($previousObject, $context->getObject()); - $test->assertSame($previousMetadata, $context->getMetadata()); - $test->assertSame($previousPath, $context->getPropertyPath()); - $test->assertSame($previousGroup, $context->getGroup()); - }; - - $callback2 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('subpath[key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity->reference, $context->getValue()); - $test->assertSame($entity->reference, $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group', - ))); - - $violations = $this->validator->validate($entity, new Valid(), 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('subpath[key]', $violations[0]->getPropertyPath()); - $this->assertSame($entity, $violations[0]->getRoot()); - $this->assertSame($entity->reference, $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testTraverseTraversableByDefault() - { - $test = $this; - $entity = new Entity(); - $traversable = new \ArrayIterator(array('key' => $entity)); - - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $traversable) { - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('[key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->metadata, $context->getMetadata()); - $test->assertSame($traversable, $context->getRoot()); - $test->assertSame($entity, $context->getValue()); - $test->assertSame($entity, $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadataFactory->addMetadata(new ClassMetadata('ArrayIterator')); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $violations = $this->validate($traversable, new Valid(), 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('[key]', $violations[0]->getPropertyPath()); - $this->assertSame($traversable, $violations[0]->getRoot()); - $this->assertSame($entity, $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testTraversalEnabledOnClass() - { - $entity = new Entity(); - $traversable = new \ArrayIterator(array('key' => $entity)); - - $callback = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Message'); - }; - - $traversableMetadata = new ClassMetadata('ArrayIterator'); - $traversableMetadata->addConstraint(new Traverse(true)); - - $this->metadataFactory->addMetadata($traversableMetadata); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $violations = $this->validate($traversable, new Valid(), 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - } - - public function testTraversalDisabledOnClass() - { - $test = $this; - $entity = new Entity(); - $traversable = new \ArrayIterator(array('key' => $entity)); - - $callback = function ($value, ExecutionContextInterface $context) use ($test) { - $test->fail('Should not be called'); - }; - - $traversableMetadata = new ClassMetadata('ArrayIterator'); - $traversableMetadata->addConstraint(new Traverse(false)); - - $this->metadataFactory->addMetadata($traversableMetadata); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $violations = $this->validate($traversable, new Valid(), 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(0, $violations); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - */ - public function testExpectTraversableIfTraversalEnabledOnClass() - { - $entity = new Entity(); - - $this->metadata->addConstraint(new Traverse(true)); - - $this->validator->validate($entity); - } - - public function testReferenceTraversalDisabledOnClass() - { - $test = $this; - $entity = new Entity(); - $entity->reference = new \ArrayIterator(array('key' => new Reference())); - - $callback = function ($value, ExecutionContextInterface $context) use ($test) { - $test->fail('Should not be called'); - }; - - $traversableMetadata = new ClassMetadata('ArrayIterator'); - $traversableMetadata->addConstraint(new Traverse(false)); - - $this->metadataFactory->addMetadata($traversableMetadata); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - $this->metadata->addPropertyConstraint('reference', new Valid()); - - $violations = $this->validate($entity, new Valid(), 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(0, $violations); - } - - public function testReferenceTraversalEnabledOnReferenceDisabledOnClass() - { - $test = $this; - $entity = new Entity(); - $entity->reference = new \ArrayIterator(array('key' => new Reference())); - - $callback = function ($value, ExecutionContextInterface $context) use ($test) { - $test->fail('Should not be called'); - }; - - $traversableMetadata = new ClassMetadata('ArrayIterator'); - $traversableMetadata->addConstraint(new Traverse(false)); - - $this->metadataFactory->addMetadata($traversableMetadata); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - $this->metadata->addPropertyConstraint('reference', new Valid(array( - 'traverse' => true, - ))); - - $violations = $this->validate($entity, new Valid(), 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(0, $violations); - } - - public function testReferenceTraversalDisabledOnReferenceEnabledOnClass() - { - $test = $this; - $entity = new Entity(); - $entity->reference = new \ArrayIterator(array('key' => new Reference())); - - $callback = function ($value, ExecutionContextInterface $context) use ($test) { - $test->fail('Should not be called'); - }; - - $traversableMetadata = new ClassMetadata('ArrayIterator'); - $traversableMetadata->addConstraint(new Traverse(true)); - - $this->metadataFactory->addMetadata($traversableMetadata); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - $this->metadata->addPropertyConstraint('reference', new Valid(array( - 'traverse' => false, - ))); - - $violations = $this->validate($entity, new Valid(), 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(0, $violations); - } - - public function testReferenceTraversalRecursionEnabledOnReferenceTraversalEnabledOnClass() - { - $entity = new Entity(); - $entity->reference = new \ArrayIterator(array( - 2 => new \ArrayIterator(array('key' => new Reference())), - )); - - $callback = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Message'); - }; - - $traversableMetadata = new ClassMetadata('ArrayIterator'); - $traversableMetadata->addConstraint(new Traverse(true)); - - $this->metadataFactory->addMetadata($traversableMetadata); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - $this->metadata->addPropertyConstraint('reference', new Valid(array( - 'deep' => true, - ))); - - $violations = $this->validate($entity, new Valid(), 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - } - - public function testReferenceTraversalRecursionDisabledOnReferenceTraversalEnabledOnClass() - { - $test = $this; - $entity = new Entity(); - $entity->reference = new \ArrayIterator(array( - 2 => new \ArrayIterator(array('key' => new Reference())), - )); - - $callback = function ($value, ExecutionContextInterface $context) use ($test) { - $test->fail('Should not be called'); - }; - - $traversableMetadata = new ClassMetadata('ArrayIterator'); - $traversableMetadata->addConstraint(new Traverse(true)); - - $this->metadataFactory->addMetadata($traversableMetadata); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - $this->metadata->addPropertyConstraint('reference', new Valid(array( - 'deep' => false, - ))); - - $violations = $this->validate($entity, new Valid(), 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(0, $violations); - } - - public function testAddCustomizedViolation() - { - $entity = new Entity(); - - $callback = function ($value, ExecutionContextInterface $context) { - $context->buildViolation('Message %param%') - ->setParameter('%param%', 'value') - ->setInvalidValue('Invalid value') - ->setPlural(2) - ->setCode(42) - ->addViolation(); - }; - - $this->metadata->addConstraint(new Callback($callback)); - - $violations = $this->validator->validate($entity); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('', $violations[0]->getPropertyPath()); - $this->assertSame($entity, $violations[0]->getRoot()); - $this->assertSame('Invalid value', $violations[0]->getInvalidValue()); - $this->assertSame(2, $violations[0]->getMessagePluralization()); - $this->assertSame(42, $violations[0]->getCode()); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnsupportedMetadataException - */ - public function testMetadataMustImplementClassMetadataInterface() - { - $entity = new Entity(); - - $metadata = $this->getMock('Symfony\Component\Validator\Tests\Fixtures\LegacyClassMetadata'); - $metadata->expects($this->any()) - ->method('getClassName') - ->will($this->returnValue(get_class($entity))); - - $this->metadataFactory->addMetadata($metadata); - - $this->validator->validate($entity); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnsupportedMetadataException - */ - public function testReferenceMetadataMustImplementClassMetadataInterface() - { - $entity = new Entity(); - $entity->reference = new Reference(); - - $metadata = $this->getMock('Symfony\Component\Validator\Tests\Fixtures\LegacyClassMetadata'); - $metadata->expects($this->any()) - ->method('getClassName') - ->will($this->returnValue(get_class($entity->reference))); - - $this->metadataFactory->addMetadata($metadata); - - $this->metadata->addPropertyConstraint('reference', new Valid()); - - $this->validator->validate($entity); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\UnsupportedMetadataException - * @group legacy - */ - public function testLegacyPropertyMetadataMustImplementPropertyMetadataInterface() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $entity = new Entity(); - - // Legacy interface - $propertyMetadata = $this->getMock('Symfony\Component\Validator\MetadataInterface'); - $metadata = new FakeClassMetadata(get_class($entity)); - $metadata->addCustomPropertyMetadata('firstName', $propertyMetadata); - - $this->metadataFactory->addMetadata($metadata); - - $this->validator->validate($entity); - } - - public function testNoDuplicateValidationIfClassConstraintInMultipleGroups() - { - $entity = new Entity(); - - $callback = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Message'); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => array('Group 1', 'Group 2'), - ))); - - $violations = $this->validator->validate($entity, new Valid(), array('Group 1', 'Group 2')); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - } - - public function testNoDuplicateValidationIfPropertyConstraintInMultipleGroups() - { - $entity = new Entity(); - - $callback = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Message'); - }; - - $this->metadata->addPropertyConstraint('firstName', new Callback(array( - 'callback' => $callback, - 'groups' => array('Group 1', 'Group 2'), - ))); - - $violations = $this->validator->validate($entity, new Valid(), array('Group 1', 'Group 2')); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\RuntimeException - */ - public function testValidateFailsIfNoConstraintsAndNoObjectOrArray() - { - $this->validate('Foobar'); - } - - public function testAccessCurrentObject() - { - $test = $this; - $called = false; - $entity = new Entity(); - $entity->firstName = 'Bernhard'; - - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, &$called) { - $called = true; - $test->assertSame($entity, $context->getObject()); - }; - - $this->metadata->addConstraint(new Callback($callback)); - $this->metadata->addPropertyConstraint('firstName', new Callback($callback)); - - $this->validator->validate($entity); - - $this->assertTrue($called); - } - - public function testInitializeObjectsOnFirstValidation() - { - $test = $this; - $entity = new Entity(); - $entity->initialized = false; - - // prepare initializers that set "initialized" to true - $initializer1 = $this->getMock('Symfony\\Component\\Validator\\ObjectInitializerInterface'); - $initializer2 = $this->getMock('Symfony\\Component\\Validator\\ObjectInitializerInterface'); - - $initializer1->expects($this->once()) - ->method('initialize') - ->with($entity) - ->will($this->returnCallback(function ($object) { - $object->initialized = true; - })); - - $initializer2->expects($this->once()) - ->method('initialize') - ->with($entity); - - $this->validator = $this->createValidator($this->metadataFactory, array( - $initializer1, - $initializer2, - )); - - // prepare constraint which - // * checks that "initialized" is set to true - // * validates the object again - $callback = function ($object, ExecutionContextInterface $context) use ($test) { - $test->assertTrue($object->initialized); - - // validate again in same group - $validator = $context->getValidator()->inContext($context); - - $validator->validate($object); - - // validate again in other group - $validator->validate($object, null, 'SomeGroup'); - }; - - $this->metadata->addConstraint(new Callback($callback)); - - $this->validate($entity); - - $this->assertTrue($entity->initialized); - } - - public function testPassConstraintToViolation() - { - $constraint = new FailingConstraint(); - $violations = $this->validate('Foobar', $constraint); - - $this->assertCount(1, $violations); - $this->assertSame($constraint, $violations[0]->getConstraint()); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Validator/AbstractLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Validator/AbstractLegacyApiTest.php deleted file mode 100644 index a4c1fe8..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Validator/AbstractLegacyApiTest.php +++ /dev/null @@ -1,315 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Validator; - -use Symfony\Component\Validator\Constraints\Callback; -use Symfony\Component\Validator\Constraints\Valid; -use Symfony\Component\Validator\ConstraintViolationInterface; -use Symfony\Component\Validator\ExecutionContextInterface; -use Symfony\Component\Validator\MetadataFactoryInterface; -use Symfony\Component\Validator\Tests\Fixtures\Entity; -use Symfony\Component\Validator\Tests\Fixtures\Reference; -use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface; - -/** - * Verifies that a validator satisfies the API of Symfony < 2.5. - * - * @since 2.5 - * @author Bernhard Schussek - */ -abstract class AbstractLegacyApiTest extends AbstractValidatorTest -{ - /** - * @var LegacyValidatorInterface - */ - protected $validator; - - /** - * @param MetadataFactoryInterface $metadataFactory - * - * @return LegacyValidatorInterface - */ - abstract protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array()); - - protected function setUp() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - parent::setUp(); - - $this->validator = $this->createValidator($this->metadataFactory); - } - - protected function validate($value, $constraints = null, $groups = null) - { - if (null === $constraints) { - $constraints = new Valid(); - } - - if ($constraints instanceof Valid) { - return $this->validator->validate($value, $groups, $constraints->traverse, $constraints->deep); - } - - return $this->validator->validateValue($value, $constraints, $groups); - } - - protected function validateProperty($object, $propertyName, $groups = null) - { - return $this->validator->validateProperty($object, $propertyName, $groups); - } - - protected function validatePropertyValue($object, $propertyName, $value, $groups = null) - { - return $this->validator->validatePropertyValue($object, $propertyName, $value, $groups); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\NoSuchMetadataException - */ - public function testTraversableTraverseDisabled() - { - $test = $this; - $entity = new Entity(); - $traversable = new \ArrayIterator(array('key' => $entity)); - - $callback = function () use ($test) { - $test->fail('Should not be called'); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $this->validator->validate($traversable, 'Group'); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\NoSuchMetadataException - */ - public function testRecursiveTraversableRecursiveTraversalDisabled() - { - $test = $this; - $entity = new Entity(); - $traversable = new \ArrayIterator(array( - 2 => new \ArrayIterator(array('key' => $entity)), - )); - - $callback = function () use ($test) { - $test->fail('Should not be called'); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $this->validator->validate($traversable, 'Group'); - } - - public function testValidateInContext() - { - $test = $this; - $entity = new Entity(); - $entity->reference = new Reference(); - - $callback1 = function ($value, ExecutionContextInterface $context) use ($test) { - $previousValue = $context->getValue(); - $previousMetadata = $context->getMetadata(); - $previousPath = $context->getPropertyPath(); - $previousGroup = $context->getGroup(); - - $context->validate($value->reference, 'subpath'); - - // context changes shouldn't leak out of the validate() call - $test->assertSame($previousValue, $context->getValue()); - $test->assertSame($previousMetadata, $context->getMetadata()); - $test->assertSame($previousPath, $context->getPropertyPath()); - $test->assertSame($previousGroup, $context->getGroup()); - }; - - $callback2 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('subpath', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($test->metadataFactory, $context->getMetadataFactory()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity->reference, $context->getValue()); - $test->assertSame($entity->reference, $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group', - ))); - - $violations = $this->validator->validate($entity, 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('subpath', $violations[0]->getPropertyPath()); - $this->assertSame($entity, $violations[0]->getRoot()); - $this->assertSame($entity->reference, $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testValidateArrayInContext() - { - $test = $this; - $entity = new Entity(); - $entity->reference = new Reference(); - - $callback1 = function ($value, ExecutionContextInterface $context) use ($test) { - $previousValue = $context->getValue(); - $previousMetadata = $context->getMetadata(); - $previousPath = $context->getPropertyPath(); - $previousGroup = $context->getGroup(); - - $context->validate(array('key' => $value->reference), 'subpath'); - - // context changes shouldn't leak out of the validate() call - $test->assertSame($previousValue, $context->getValue()); - $test->assertSame($previousMetadata, $context->getMetadata()); - $test->assertSame($previousPath, $context->getPropertyPath()); - $test->assertSame($previousGroup, $context->getGroup()); - }; - - $callback2 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('subpath[key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($test->metadataFactory, $context->getMetadataFactory()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity->reference, $context->getValue()); - $test->assertSame($entity->reference, $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group', - ))); - - $violations = $this->validator->validate($entity, 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('subpath[key]', $violations[0]->getPropertyPath()); - $this->assertSame($entity, $violations[0]->getRoot()); - $this->assertSame($entity->reference, $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testAddCustomizedViolation() - { - $entity = new Entity(); - - $callback = function ($value, ExecutionContextInterface $context) { - $context->addViolation( - 'Message %param%', - array('%param%' => 'value'), - 'Invalid value', - 2, - 'Code' - ); - }; - - $this->metadata->addConstraint(new Callback($callback)); - - $violations = $this->validator->validate($entity); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('', $violations[0]->getPropertyPath()); - $this->assertSame($entity, $violations[0]->getRoot()); - $this->assertSame('Invalid value', $violations[0]->getInvalidValue()); - $this->assertSame(2, $violations[0]->getMessagePluralization()); - $this->assertSame('Code', $violations[0]->getCode()); - } - - public function testInitializeObjectsOnFirstValidation() - { - $test = $this; - $entity = new Entity(); - $entity->initialized = false; - - // prepare initializers that set "initialized" to true - $initializer1 = $this->getMock('Symfony\\Component\\Validator\\ObjectInitializerInterface'); - $initializer2 = $this->getMock('Symfony\\Component\\Validator\\ObjectInitializerInterface'); - - $initializer1->expects($this->once()) - ->method('initialize') - ->with($entity) - ->will($this->returnCallback(function ($object) { - $object->initialized = true; - })); - - $initializer2->expects($this->once()) - ->method('initialize') - ->with($entity); - - $this->validator = $this->createValidator($this->metadataFactory, array( - $initializer1, - $initializer2, - )); - - // prepare constraint which - // * checks that "initialized" is set to true - // * validates the object again - $callback = function ($object, ExecutionContextInterface $context) use ($test) { - $test->assertTrue($object->initialized); - - // validate again in same group - $context->validate($object); - - // validate again in other group - $context->validate($object, '', 'SomeGroup'); - }; - - $this->metadata->addConstraint(new Callback($callback)); - - $this->validate($entity); - - $this->assertTrue($entity->initialized); - } - - public function testGetMetadataFactory() - { - $this->assertSame($this->metadataFactory, $this->validator->getMetadataFactory()); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php deleted file mode 100644 index b1c4edb..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php +++ /dev/null @@ -1,1288 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Validator; - -use Symfony\Component\Validator\Constraints\Callback; -use Symfony\Component\Validator\Constraints\GroupSequence; -use Symfony\Component\Validator\Constraints\Valid; -use Symfony\Component\Validator\ConstraintViolationInterface; -use Symfony\Component\Validator\ExecutionContextInterface; -use Symfony\Component\Validator\Mapping\ClassMetadata; -use Symfony\Component\Validator\Tests\Fixtures\Entity; -use Symfony\Component\Validator\Tests\Fixtures\FakeMetadataFactory; -use Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity; -use Symfony\Component\Validator\Tests\Fixtures\Reference; - -/** - * @since 2.5 - * @author Bernhard Schussek - */ -abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase -{ - const ENTITY_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\Entity'; - - const REFERENCE_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\Reference'; - - /** - * @var FakeMetadataFactory - */ - public $metadataFactory; - - /** - * @var ClassMetadata - */ - public $metadata; - - /** - * @var ClassMetadata - */ - public $referenceMetadata; - - protected function setUp() - { - $this->metadataFactory = new FakeMetadataFactory(); - $this->metadata = new ClassMetadata(self::ENTITY_CLASS); - $this->referenceMetadata = new ClassMetadata(self::REFERENCE_CLASS); - $this->metadataFactory->addMetadata($this->metadata); - $this->metadataFactory->addMetadata($this->referenceMetadata); - } - - protected function tearDown() - { - $this->metadataFactory = null; - $this->metadata = null; - $this->referenceMetadata = null; - } - - abstract protected function validate($value, $constraints = null, $groups = null); - - abstract protected function validateProperty($object, $propertyName, $groups = null); - - abstract protected function validatePropertyValue($object, $propertyName, $value, $groups = null); - - public function testValidate() - { - $test = $this; - - $callback = function ($value, ExecutionContextInterface $context) use ($test) { - $test->assertNull($context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame('Bernhard', $context->getRoot()); - $test->assertSame('Bernhard', $context->getValue()); - $test->assertSame('Bernhard', $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $constraint = new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - )); - - $violations = $this->validate('Bernhard', $constraint, 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('', $violations[0]->getPropertyPath()); - $this->assertSame('Bernhard', $violations[0]->getRoot()); - $this->assertSame('Bernhard', $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testClassConstraint() - { - $test = $this; - $entity = new Entity(); - - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->metadata, $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity, $context->getValue()); - $test->assertSame($entity, $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $violations = $this->validate($entity, null, 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('', $violations[0]->getPropertyPath()); - $this->assertSame($entity, $violations[0]->getRoot()); - $this->assertSame($entity, $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testPropertyConstraint() - { - $test = $this; - $entity = new Entity(); - $entity->firstName = 'Bernhard'; - - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $propertyMetadatas = $test->metadata->getPropertyMetadata('firstName'); - - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertSame('firstName', $context->getPropertyName()); - $test->assertSame('firstName', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($propertyMetadatas[0], $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame('Bernhard', $context->getValue()); - $test->assertSame('Bernhard', $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addPropertyConstraint('firstName', new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $violations = $this->validate($entity, null, 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('firstName', $violations[0]->getPropertyPath()); - $this->assertSame($entity, $violations[0]->getRoot()); - $this->assertSame('Bernhard', $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testGetterConstraint() - { - $test = $this; - $entity = new Entity(); - $entity->setLastName('Schussek'); - - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $propertyMetadatas = $test->metadata->getPropertyMetadata('lastName'); - - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertSame('lastName', $context->getPropertyName()); - $test->assertSame('lastName', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($propertyMetadatas[0], $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame('Schussek', $context->getValue()); - $test->assertSame('Schussek', $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addGetterConstraint('lastName', new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $violations = $this->validate($entity, null, 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('lastName', $violations[0]->getPropertyPath()); - $this->assertSame($entity, $violations[0]->getRoot()); - $this->assertSame('Schussek', $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testArray() - { - $test = $this; - $entity = new Entity(); - $array = array('key' => $entity); - - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $array) { - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('[key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->metadata, $context->getMetadata()); - $test->assertSame($array, $context->getRoot()); - $test->assertSame($entity, $context->getValue()); - $test->assertSame($entity, $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $violations = $this->validate($array, null, 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('[key]', $violations[0]->getPropertyPath()); - $this->assertSame($array, $violations[0]->getRoot()); - $this->assertSame($entity, $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testRecursiveArray() - { - $test = $this; - $entity = new Entity(); - $array = array(2 => array('key' => $entity)); - - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $array) { - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('[2][key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->metadata, $context->getMetadata()); - $test->assertSame($array, $context->getRoot()); - $test->assertSame($entity, $context->getValue()); - $test->assertSame($entity, $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $violations = $this->validate($array, null, 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('[2][key]', $violations[0]->getPropertyPath()); - $this->assertSame($array, $violations[0]->getRoot()); - $this->assertSame($entity, $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testTraversable() - { - $test = $this; - $entity = new Entity(); - $traversable = new \ArrayIterator(array('key' => $entity)); - - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $traversable) { - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('[key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->metadata, $context->getMetadata()); - $test->assertSame($traversable, $context->getRoot()); - $test->assertSame($entity, $context->getValue()); - $test->assertSame($entity, $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $violations = $this->validate($traversable, null, 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('[key]', $violations[0]->getPropertyPath()); - $this->assertSame($traversable, $violations[0]->getRoot()); - $this->assertSame($entity, $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testRecursiveTraversable() - { - $test = $this; - $entity = new Entity(); - $traversable = new \ArrayIterator(array( - 2 => new \ArrayIterator(array('key' => $entity)), - )); - - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $traversable) { - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('[2][key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->metadata, $context->getMetadata()); - $test->assertSame($traversable, $context->getRoot()); - $test->assertSame($entity, $context->getValue()); - $test->assertSame($entity, $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $violations = $this->validate($traversable, null, 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('[2][key]', $violations[0]->getPropertyPath()); - $this->assertSame($traversable, $violations[0]->getRoot()); - $this->assertSame($entity, $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testReferenceClassConstraint() - { - $test = $this; - $entity = new Entity(); - $entity->reference = new Reference(); - - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('reference', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity->reference, $context->getValue()); - $test->assertSame($entity->reference, $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $violations = $this->validate($entity, null, 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('reference', $violations[0]->getPropertyPath()); - $this->assertSame($entity, $violations[0]->getRoot()); - $this->assertSame($entity->reference, $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testReferencePropertyConstraint() - { - $test = $this; - $entity = new Entity(); - $entity->reference = new Reference(); - $entity->reference->value = 'Foobar'; - - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $propertyMetadatas = $test->referenceMetadata->getPropertyMetadata('value'); - - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertSame('value', $context->getPropertyName()); - $test->assertSame('reference.value', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($propertyMetadatas[0], $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame('Foobar', $context->getValue()); - $test->assertSame('Foobar', $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addPropertyConstraint('value', new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $violations = $this->validate($entity, null, 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('reference.value', $violations[0]->getPropertyPath()); - $this->assertSame($entity, $violations[0]->getRoot()); - $this->assertSame('Foobar', $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testReferenceGetterConstraint() - { - $test = $this; - $entity = new Entity(); - $entity->reference = new Reference(); - $entity->reference->setPrivateValue('Bamboo'); - - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $propertyMetadatas = $test->referenceMetadata->getPropertyMetadata('privateValue'); - - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertSame('privateValue', $context->getPropertyName()); - $test->assertSame('reference.privateValue', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($propertyMetadatas[0], $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame('Bamboo', $context->getValue()); - $test->assertSame('Bamboo', $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addPropertyConstraint('privateValue', new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $violations = $this->validate($entity, null, 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('reference.privateValue', $violations[0]->getPropertyPath()); - $this->assertSame($entity, $violations[0]->getRoot()); - $this->assertSame('Bamboo', $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testsIgnoreNullReference() - { - $entity = new Entity(); - $entity->reference = null; - - $this->metadata->addPropertyConstraint('reference', new Valid()); - - $violations = $this->validate($entity); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(0, $violations); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\NoSuchMetadataException - */ - public function testFailOnScalarReferences() - { - $entity = new Entity(); - $entity->reference = 'string'; - - $this->metadata->addPropertyConstraint('reference', new Valid()); - - $this->validate($entity); - } - - public function testArrayReference() - { - $test = $this; - $entity = new Entity(); - $entity->reference = array('key' => new Reference()); - - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('reference[key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity->reference['key'], $context->getValue()); - $test->assertSame($entity->reference['key'], $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $violations = $this->validate($entity, null, 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('reference[key]', $violations[0]->getPropertyPath()); - $this->assertSame($entity, $violations[0]->getRoot()); - $this->assertSame($entity->reference['key'], $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - // https://github.com/symfony/symfony/issues/6246 - public function testRecursiveArrayReference() - { - $test = $this; - $entity = new Entity(); - $entity->reference = array(2 => array('key' => new Reference())); - - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('reference[2][key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity->reference[2]['key'], $context->getValue()); - $test->assertSame($entity->reference[2]['key'], $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $violations = $this->validate($entity, null, 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('reference[2][key]', $violations[0]->getPropertyPath()); - $this->assertSame($entity, $violations[0]->getRoot()); - $this->assertSame($entity->reference[2]['key'], $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testArrayTraversalCannotBeDisabled() - { - $entity = new Entity(); - $entity->reference = array('key' => new Reference()); - - $callback = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addPropertyConstraint('reference', new Valid(array( - 'traverse' => false, - ))); - $this->referenceMetadata->addConstraint(new Callback($callback)); - - $violations = $this->validate($entity); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - } - - public function testRecursiveArrayTraversalCannotBeDisabled() - { - $entity = new Entity(); - $entity->reference = array(2 => array('key' => new Reference())); - - $callback = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addPropertyConstraint('reference', new Valid(array( - 'traverse' => false, - ))); - $this->referenceMetadata->addConstraint(new Callback($callback)); - - $violations = $this->validate($entity); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - } - - public function testIgnoreScalarsDuringArrayTraversal() - { - $entity = new Entity(); - $entity->reference = array('string', 1234); - - $this->metadata->addPropertyConstraint('reference', new Valid()); - - $violations = $this->validate($entity); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(0, $violations); - } - - public function testIgnoreNullDuringArrayTraversal() - { - $entity = new Entity(); - $entity->reference = array(null); - - $this->metadata->addPropertyConstraint('reference', new Valid()); - - $violations = $this->validate($entity); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(0, $violations); - } - - public function testTraversableReference() - { - $test = $this; - $entity = new Entity(); - $entity->reference = new \ArrayIterator(array('key' => new Reference())); - - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('reference[key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity->reference['key'], $context->getValue()); - $test->assertSame($entity->reference['key'], $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $violations = $this->validate($entity, null, 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('reference[key]', $violations[0]->getPropertyPath()); - $this->assertSame($entity, $violations[0]->getRoot()); - $this->assertSame($entity->reference['key'], $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testDisableTraversableTraversal() - { - $entity = new Entity(); - $entity->reference = new \ArrayIterator(array('key' => new Reference())); - - $callback = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadataFactory->addMetadata(new ClassMetadata('ArrayIterator')); - $this->metadata->addPropertyConstraint('reference', new Valid(array( - 'traverse' => false, - ))); - $this->referenceMetadata->addConstraint(new Callback($callback)); - - $violations = $this->validate($entity); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(0, $violations); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\NoSuchMetadataException - */ - public function testMetadataMustExistIfTraversalIsDisabled() - { - $entity = new Entity(); - $entity->reference = new \ArrayIterator(); - - $this->metadata->addPropertyConstraint('reference', new Valid(array( - 'traverse' => false, - ))); - - $this->validate($entity); - } - - public function testEnableRecursiveTraversableTraversal() - { - $test = $this; - $entity = new Entity(); - $entity->reference = new \ArrayIterator(array( - 2 => new \ArrayIterator(array('key' => new Reference())), - )); - - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); - $test->assertNull($context->getPropertyName()); - $test->assertSame('reference[2][key]', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($test->referenceMetadata, $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame($entity->reference[2]['key'], $context->getValue()); - $test->assertSame($entity->reference[2]['key'], $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $this->metadata->addPropertyConstraint('reference', new Valid(array( - 'deep' => true, - ))); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - - $violations = $this->validate($entity, null, 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('reference[2][key]', $violations[0]->getPropertyPath()); - $this->assertSame($entity, $violations[0]->getRoot()); - $this->assertSame($entity->reference[2]['key'], $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testValidateProperty() - { - $test = $this; - $entity = new Entity(); - $entity->firstName = 'Bernhard'; - $entity->setLastName('Schussek'); - - $callback1 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $propertyMetadatas = $test->metadata->getPropertyMetadata('firstName'); - - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertSame('firstName', $context->getPropertyName()); - $test->assertSame('firstName', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($propertyMetadatas[0], $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame('Bernhard', $context->getValue()); - $test->assertSame('Bernhard', $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $callback2 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Other violation'); - }; - - $this->metadata->addPropertyConstraint('firstName', new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group', - ))); - $this->metadata->addPropertyConstraint('lastName', new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group', - ))); - - $violations = $this->validateProperty($entity, 'firstName', 'Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('firstName', $violations[0]->getPropertyPath()); - $this->assertSame($entity, $violations[0]->getRoot()); - $this->assertSame('Bernhard', $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - /** - * Cannot be UnsupportedMetadataException for BC with Symfony < 2.5. - * - * @expectedException \Symfony\Component\Validator\Exception\ValidatorException - * @group legacy - */ - public function testLegacyValidatePropertyFailsIfPropertiesNotSupported() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - // $metadata does not implement PropertyMetadataContainerInterface - $metadata = $this->getMock('Symfony\Component\Validator\MetadataInterface'); - - $this->metadataFactory->addMetadataForValue('VALUE', $metadata); - - $this->validateProperty('VALUE', 'someProperty'); - } - - /** - * https://github.com/symfony/symfony/issues/11604 - */ - public function testValidatePropertyWithoutConstraints() - { - $entity = new Entity(); - $violations = $this->validateProperty($entity, 'lastName'); - - $this->assertCount(0, $violations, '->validateProperty() returns no violations if no constraints have been configured for the property being validated'); - } - - public function testValidatePropertyValue() - { - $test = $this; - $entity = new Entity(); - $entity->setLastName('Schussek'); - - $callback1 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { - $propertyMetadatas = $test->metadata->getPropertyMetadata('firstName'); - - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertSame('firstName', $context->getPropertyName()); - $test->assertSame('firstName', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($propertyMetadatas[0], $context->getMetadata()); - $test->assertSame($entity, $context->getRoot()); - $test->assertSame('Bernhard', $context->getValue()); - $test->assertSame('Bernhard', $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $callback2 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Other violation'); - }; - - $this->metadata->addPropertyConstraint('firstName', new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group', - ))); - $this->metadata->addPropertyConstraint('lastName', new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group', - ))); - - $violations = $this->validatePropertyValue( - $entity, - 'firstName', - 'Bernhard', - 'Group' - ); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('firstName', $violations[0]->getPropertyPath()); - $this->assertSame($entity, $violations[0]->getRoot()); - $this->assertSame('Bernhard', $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - public function testValidatePropertyValueWithClassName() - { - $test = $this; - - $callback1 = function ($value, ExecutionContextInterface $context) use ($test) { - $propertyMetadatas = $test->metadata->getPropertyMetadata('firstName'); - - $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); - $test->assertSame('firstName', $context->getPropertyName()); - $test->assertSame('', $context->getPropertyPath()); - $test->assertSame('Group', $context->getGroup()); - $test->assertSame($propertyMetadatas[0], $context->getMetadata()); - $test->assertSame('Bernhard', $context->getRoot()); - $test->assertSame('Bernhard', $context->getValue()); - $test->assertSame('Bernhard', $value); - - $context->addViolation('Message %param%', array('%param%' => 'value')); - }; - - $callback2 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Other violation'); - }; - - $this->metadata->addPropertyConstraint('firstName', new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group', - ))); - $this->metadata->addPropertyConstraint('lastName', new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group', - ))); - - $violations = $this->validatePropertyValue( - self::ENTITY_CLASS, - 'firstName', - 'Bernhard', - 'Group' - ); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Message value', $violations[0]->getMessage()); - $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); - $this->assertSame(array('%param%' => 'value'), $violations[0]->getMessageParameters()); - $this->assertSame('', $violations[0]->getPropertyPath()); - $this->assertSame('Bernhard', $violations[0]->getRoot()); - $this->assertSame('Bernhard', $violations[0]->getInvalidValue()); - $this->assertNull($violations[0]->getMessagePluralization()); - $this->assertNull($violations[0]->getCode()); - } - - /** - * Cannot be UnsupportedMetadataException for BC with Symfony < 2.5. - * - * @expectedException \Symfony\Component\Validator\Exception\ValidatorException - * @group legacy - */ - public function testLegacyValidatePropertyValueFailsIfPropertiesNotSupported() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - // $metadata does not implement PropertyMetadataContainerInterface - $metadata = $this->getMock('Symfony\Component\Validator\MetadataInterface'); - - $this->metadataFactory->addMetadataForValue('VALUE', $metadata); - - $this->validatePropertyValue('VALUE', 'someProperty', 'someValue'); - } - - /** - * https://github.com/symfony/symfony/issues/11604 - */ - public function testValidatePropertyValueWithoutConstraints() - { - $entity = new Entity(); - $violations = $this->validatePropertyValue($entity, 'lastName', 'foo'); - - $this->assertCount(0, $violations, '->validatePropertyValue() returns no violations if no constraints have been configured for the property being validated'); - } - - public function testValidateObjectOnlyOncePerGroup() - { - $entity = new Entity(); - $entity->reference = new Reference(); - $entity->reference2 = $entity->reference; - - $callback = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Message'); - }; - - $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->metadata->addPropertyConstraint('reference2', new Valid()); - $this->referenceMetadata->addConstraint(new Callback($callback)); - - $violations = $this->validate($entity); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - } - - public function testValidateDifferentObjectsSeparately() - { - $entity = new Entity(); - $entity->reference = new Reference(); - $entity->reference2 = new Reference(); - - $callback = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Message'); - }; - - $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->metadata->addPropertyConstraint('reference2', new Valid()); - $this->referenceMetadata->addConstraint(new Callback($callback)); - - $violations = $this->validate($entity); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(2, $violations); - } - - public function testValidateSingleGroup() - { - $entity = new Entity(); - - $callback = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Message'); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group 1', - ))); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group 2', - ))); - - $violations = $this->validate($entity, null, 'Group 2'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - } - - public function testValidateMultipleGroups() - { - $entity = new Entity(); - - $callback = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Message'); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group 1', - ))); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group 2', - ))); - - $violations = $this->validate($entity, null, array('Group 1', 'Group 2')); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(2, $violations); - } - - public function testReplaceDefaultGroupByGroupSequenceObject() - { - $entity = new Entity(); - - $callback1 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Violation in Group 2'); - }; - $callback2 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Violation in Group 3'); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => function () {}, - 'groups' => 'Group 1', - ))); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group 2', - ))); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group 3', - ))); - - $sequence = new GroupSequence(array('Group 1', 'Group 2', 'Group 3', 'Entity')); - $this->metadata->setGroupSequence($sequence); - - $violations = $this->validate($entity, null, 'Default'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Violation in Group 2', $violations[0]->getMessage()); - } - - public function testReplaceDefaultGroupByGroupSequenceArray() - { - $entity = new Entity(); - - $callback1 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Violation in Group 2'); - }; - $callback2 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Violation in Group 3'); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => function () {}, - 'groups' => 'Group 1', - ))); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group 2', - ))); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group 3', - ))); - - $sequence = array('Group 1', 'Group 2', 'Group 3', 'Entity'); - $this->metadata->setGroupSequence($sequence); - - $violations = $this->validate($entity, null, 'Default'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Violation in Group 2', $violations[0]->getMessage()); - } - - public function testPropagateDefaultGroupToReferenceWhenReplacingDefaultGroup() - { - $entity = new Entity(); - $entity->reference = new Reference(); - - $callback1 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Violation in Default group'); - }; - $callback2 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Violation in group sequence'); - }; - - $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Default', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group 1', - ))); - - $sequence = new GroupSequence(array('Group 1', 'Entity')); - $this->metadata->setGroupSequence($sequence); - - $violations = $this->validate($entity, null, 'Default'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Violation in Default group', $violations[0]->getMessage()); - } - - public function testValidateCustomGroupWhenDefaultGroupWasReplaced() - { - $entity = new Entity(); - - $callback1 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Violation in other group'); - }; - $callback2 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Violation in group sequence'); - }; - - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Other Group', - ))); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group 1', - ))); - - $sequence = new GroupSequence(array('Group 1', 'Entity')); - $this->metadata->setGroupSequence($sequence); - - $violations = $this->validate($entity, null, 'Other Group'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Violation in other group', $violations[0]->getMessage()); - } - - public function testReplaceDefaultGroupWithObjectFromGroupSequenceProvider() - { - $sequence = new GroupSequence(array('Group 1', 'Group 2', 'Group 3', 'Entity')); - $entity = new GroupSequenceProviderEntity($sequence); - - $callback1 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Violation in Group 2'); - }; - $callback2 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Violation in Group 3'); - }; - - $metadata = new ClassMetadata(get_class($entity)); - $metadata->addConstraint(new Callback(array( - 'callback' => function () {}, - 'groups' => 'Group 1', - ))); - $metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group 2', - ))); - $metadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group 3', - ))); - $metadata->setGroupSequenceProvider(true); - - $this->metadataFactory->addMetadata($metadata); - - $violations = $this->validate($entity, null, 'Default'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Violation in Group 2', $violations[0]->getMessage()); - } - - public function testReplaceDefaultGroupWithArrayFromGroupSequenceProvider() - { - $sequence = array('Group 1', 'Group 2', 'Group 3', 'Entity'); - $entity = new GroupSequenceProviderEntity($sequence); - - $callback1 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Violation in Group 2'); - }; - $callback2 = function ($value, ExecutionContextInterface $context) { - $context->addViolation('Violation in Group 3'); - }; - - $metadata = new ClassMetadata(get_class($entity)); - $metadata->addConstraint(new Callback(array( - 'callback' => function () {}, - 'groups' => 'Group 1', - ))); - $metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group 2', - ))); - $metadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group 3', - ))); - $metadata->setGroupSequenceProvider(true); - - $this->metadataFactory->addMetadata($metadata); - - $violations = $this->validate($entity, null, 'Default'); - - /** @var ConstraintViolationInterface[] $violations */ - $this->assertCount(1, $violations); - $this->assertSame('Violation in Group 2', $violations[0]->getMessage()); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Validator/LegacyValidator2Dot5ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Validator/LegacyValidator2Dot5ApiTest.php deleted file mode 100644 index 624abd4..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Validator/LegacyValidator2Dot5ApiTest.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Validator; - -use Symfony\Component\Validator\ConstraintValidatorFactory; -use Symfony\Component\Validator\Context\LegacyExecutionContextFactory; -use Symfony\Component\Validator\DefaultTranslator; -use Symfony\Component\Validator\MetadataFactoryInterface; -use Symfony\Component\Validator\Validator\LegacyValidator; - -/** - * @group legacy - */ -class LegacyValidator2Dot5ApiTest extends Abstract2Dot5ApiTest -{ - protected function setUp() - { - if (PHP_VERSION_ID < 50309) { - $this->markTestSkipped('Not supported prior to PHP 5.3.9'); - } - - parent::setUp(); - } - - protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array()) - { - $contextFactory = new LegacyExecutionContextFactory($metadataFactory, new DefaultTranslator()); - $validatorFactory = new ConstraintValidatorFactory(); - - return new LegacyValidator($contextFactory, $metadataFactory, $validatorFactory, $objectInitializers); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Validator/LegacyValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Validator/LegacyValidatorLegacyApiTest.php deleted file mode 100644 index 965a769..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Validator/LegacyValidatorLegacyApiTest.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Validator; - -use Symfony\Component\Validator\ConstraintValidatorFactory; -use Symfony\Component\Validator\Context\LegacyExecutionContextFactory; -use Symfony\Component\Validator\DefaultTranslator; -use Symfony\Component\Validator\MetadataFactoryInterface; -use Symfony\Component\Validator\Validator\LegacyValidator; - -/** - * @group legacy - */ -class LegacyValidatorLegacyApiTest extends AbstractLegacyApiTest -{ - protected function setUp() - { - if (PHP_VERSION_ID < 50309) { - $this->markTestSkipped('Not supported prior to PHP 5.3.9'); - } - - parent::setUp(); - } - - protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array()) - { - $contextFactory = new LegacyExecutionContextFactory($metadataFactory, new DefaultTranslator()); - $validatorFactory = new ConstraintValidatorFactory(); - - return new LegacyValidator($contextFactory, $metadataFactory, $validatorFactory, $objectInitializers); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Validator/RecursiveValidator2Dot5ApiTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Validator/RecursiveValidator2Dot5ApiTest.php deleted file mode 100644 index 6235fda..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Validator/RecursiveValidator2Dot5ApiTest.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Validator; - -use Symfony\Component\Validator\ConstraintValidatorFactory; -use Symfony\Component\Validator\Context\ExecutionContextFactory; -use Symfony\Component\Validator\DefaultTranslator; -use Symfony\Component\Validator\MetadataFactoryInterface; -use Symfony\Component\Validator\Validator\RecursiveValidator; - -class RecursiveValidator2Dot5ApiTest extends Abstract2Dot5ApiTest -{ - protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array()) - { - $contextFactory = new ExecutionContextFactory(new DefaultTranslator()); - $validatorFactory = new ConstraintValidatorFactory(); - - return new RecursiveValidator($contextFactory, $metadataFactory, $validatorFactory, $objectInitializers); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php deleted file mode 100644 index e2585d7..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php +++ /dev/null @@ -1,160 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests; - -use Symfony\Component\Validator\Validation; -use Symfony\Component\Validator\ValidatorBuilder; -use Symfony\Component\Validator\ValidatorBuilderInterface; - -class ValidatorBuilderTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var ValidatorBuilderInterface - */ - protected $builder; - - protected function setUp() - { - $this->builder = new ValidatorBuilder(); - } - - protected function tearDown() - { - $this->builder = null; - } - - public function testAddObjectInitializer() - { - $this->assertSame($this->builder, $this->builder->addObjectInitializer( - $this->getMock('Symfony\Component\Validator\ObjectInitializerInterface') - )); - } - - public function testAddObjectInitializers() - { - $this->assertSame($this->builder, $this->builder->addObjectInitializers(array())); - } - - public function testAddXmlMapping() - { - $this->assertSame($this->builder, $this->builder->addXmlMapping('mapping')); - } - - public function testAddXmlMappings() - { - $this->assertSame($this->builder, $this->builder->addXmlMappings(array())); - } - - public function testAddYamlMapping() - { - $this->assertSame($this->builder, $this->builder->addYamlMapping('mapping')); - } - - public function testAddYamlMappings() - { - $this->assertSame($this->builder, $this->builder->addYamlMappings(array())); - } - - public function testAddMethodMapping() - { - $this->assertSame($this->builder, $this->builder->addMethodMapping('mapping')); - } - - public function testAddMethodMappings() - { - $this->assertSame($this->builder, $this->builder->addMethodMappings(array())); - } - - public function testEnableAnnotationMapping() - { - $this->assertSame($this->builder, $this->builder->enableAnnotationMapping()); - } - - public function testDisableAnnotationMapping() - { - $this->assertSame($this->builder, $this->builder->disableAnnotationMapping()); - } - - public function testSetMetadataCache() - { - $this->assertSame($this->builder, $this->builder->setMetadataCache( - $this->getMock('Symfony\Component\Validator\Mapping\Cache\CacheInterface')) - ); - } - - public function testSetConstraintValidatorFactory() - { - $this->assertSame($this->builder, $this->builder->setConstraintValidatorFactory( - $this->getMock('Symfony\Component\Validator\ConstraintValidatorFactoryInterface')) - ); - } - - public function testSetTranslator() - { - $this->assertSame($this->builder, $this->builder->setTranslator( - $this->getMock('Symfony\Component\Translation\TranslatorInterface')) - ); - } - - public function testSetTranslationDomain() - { - $this->assertSame($this->builder, $this->builder->setTranslationDomain('TRANS_DOMAIN')); - } - - /** - * @group legacy - */ - public function testLegacyDefaultApiVersion() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - if (PHP_VERSION_ID < 50309) { - // Old implementation on PHP < 5.3.9 - $this->assertInstanceOf('Symfony\Component\Validator\Validator', $this->builder->getValidator()); - } else { - // Legacy compatible implementation on PHP >= 5.3.9 - $this->assertInstanceOf('Symfony\Component\Validator\Validator\LegacyValidator', $this->builder->getValidator()); - } - } - - /** - * @group legacy - */ - public function testLegacySetApiVersion24() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $this->assertSame($this->builder, $this->builder->setApiVersion(Validation::API_VERSION_2_4)); - $this->assertInstanceOf('Symfony\Component\Validator\Validator', $this->builder->getValidator()); - } - - public function testSetApiVersion25() - { - $this->assertSame($this->builder, $this->builder->setApiVersion(Validation::API_VERSION_2_5)); - $this->assertInstanceOf('Symfony\Component\Validator\Validator\RecursiveValidator', $this->builder->getValidator()); - } - - /** - * @group legacy - */ - public function testLegacySetApiVersion24And25() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - if (PHP_VERSION_ID < 50309) { - $this->markTestSkipped('Not supported prior to PHP 5.3.9'); - } - - $this->assertSame($this->builder, $this->builder->setApiVersion(Validation::API_VERSION_2_5_BC)); - $this->assertInstanceOf('Symfony\Component\Validator\Validator\LegacyValidator', $this->builder->getValidator()); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/ValidatorTest.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/ValidatorTest.php deleted file mode 100644 index 3cc36f5..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/ValidatorTest.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests; - -use Symfony\Component\Validator\Constraints\Valid; -use Symfony\Component\Validator\ConstraintValidatorFactory; -use Symfony\Component\Validator\DefaultTranslator; -use Symfony\Component\Validator\MetadataFactoryInterface; -use Symfony\Component\Validator\Tests\Fixtures\Entity; -use Symfony\Component\Validator\Tests\Validator\AbstractLegacyApiTest; -use Symfony\Component\Validator\Validator as LegacyValidator; - -class ValidatorTest extends AbstractLegacyApiTest -{ - protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array()) - { - return new LegacyValidator($metadataFactory, new ConstraintValidatorFactory(), new DefaultTranslator(), 'validators', $objectInitializers); - } - - /** - * @expectedException \Symfony\Component\Validator\Exception\ValidatorException - */ - public function testValidateValueRejectsValid() - { - $this->validator->validateValue(new Entity(), new Valid()); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Util/PropertyPath.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Util/PropertyPath.php deleted file mode 100644 index 4d397a9..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Util/PropertyPath.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Util; - -/** - * Contains utility methods for dealing with property paths. - * - * For more extensive functionality, use Symfony's PropertyAccess component. - * - * @since 2.5 - * @author Bernhard Schussek - */ -class PropertyPath -{ - /** - * Appends a path to a given property path. - * - * If the base path is empty, the appended path will be returned unchanged. - * If the base path is not empty, and the appended path starts with a - * squared opening bracket ("["), the concatenation of the two paths is - * returned. Otherwise, the concatenation of the two paths is returned, - * separated by a dot ("."). - * - * @param string $basePath The base path - * @param string $subPath The path to append - * - * @return string The concatenation of the two property paths - */ - public static function append($basePath, $subPath) - { - if ('' !== (string) $subPath) { - if ('[' === $subPath{0}) { - return $basePath.$subPath; - } - - return $basePath ? $basePath.'.'.$subPath : $subPath; - } - - return $basePath; - } - - /** - * Not instantiable. - */ - private function __construct() - { - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Validation.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Validation.php deleted file mode 100644 index b304dbb..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Validation.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -/** - * Entry point for the Validator component. - * - * @author Bernhard Schussek - */ -final class Validation -{ - /** - * The Validator API provided by Symfony 2.4 and older. - */ - const API_VERSION_2_4 = 1; - - /** - * The Validator API provided by Symfony 2.5 and newer. - */ - const API_VERSION_2_5 = 2; - - /** - * The Validator API provided by Symfony 2.5 and newer with a backwards - * compatibility layer for 2.4 and older. - */ - const API_VERSION_2_5_BC = 3; - - /** - * Creates a new validator. - * - * If you want to configure the validator, use - * {@link createValidatorBuilder()} instead. - * - * @return ValidatorInterface The new validator. - */ - public static function createValidator() - { - return self::createValidatorBuilder()->getValidator(); - } - - /** - * Creates a configurable builder for validator objects. - * - * @return ValidatorBuilderInterface The new builder. - */ - public static function createValidatorBuilder() - { - return new ValidatorBuilder(); - } - - /** - * This class cannot be instantiated. - */ - private function __construct() - { - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/ValidationVisitor.php b/core/vendor/symfony/validator/Symfony/Component/Validator/ValidationVisitor.php deleted file mode 100644 index 3af8249..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/ValidationVisitor.php +++ /dev/null @@ -1,210 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -use Symfony\Component\Translation\TranslatorInterface; -use Symfony\Component\Validator\Exception\NoSuchMetadataException; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; - -/** - * Default implementation of {@link ValidationVisitorInterface} and - * {@link GlobalExecutionContextInterface}. - * - * @author Bernhard Schussek - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - */ -class ValidationVisitor implements ValidationVisitorInterface, GlobalExecutionContextInterface -{ - /** - * @var mixed - */ - private $root; - - /** - * @var MetadataFactoryInterface - */ - private $metadataFactory; - - /** - * @var ConstraintValidatorFactoryInterface - */ - private $validatorFactory; - - /** - * @var TranslatorInterface - */ - private $translator; - - /** - * @var null|string - */ - private $translationDomain; - - /** - * @var array - */ - private $objectInitializers; - - /** - * @var ConstraintViolationList - */ - private $violations; - - /** - * @var array - */ - private $validatedObjects = array(); - - /** - * Creates a new validation visitor. - * - * @param mixed $root The value passed to the validator. - * @param MetadataFactoryInterface $metadataFactory The factory for obtaining metadata instances. - * @param ConstraintValidatorFactoryInterface $validatorFactory The factory for creating constraint validators. - * @param TranslatorInterface $translator The translator for translating violation messages. - * @param string|null $translationDomain The domain of the translation messages. - * @param ObjectInitializerInterface[] $objectInitializers The initializers for preparing objects before validation. - * - * @throws UnexpectedTypeException If any of the object initializers is not an instance of ObjectInitializerInterface - */ - public function __construct($root, MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, TranslatorInterface $translator, $translationDomain = null, array $objectInitializers = array()) - { - foreach ($objectInitializers as $initializer) { - if (!$initializer instanceof ObjectInitializerInterface) { - throw new UnexpectedTypeException($initializer, 'Symfony\Component\Validator\ObjectInitializerInterface'); - } - } - - $this->root = $root; - $this->metadataFactory = $metadataFactory; - $this->validatorFactory = $validatorFactory; - $this->translator = $translator; - $this->translationDomain = $translationDomain; - $this->objectInitializers = $objectInitializers; - $this->violations = new ConstraintViolationList(); - } - - /** - * {@inheritdoc} - */ - public function visit(MetadataInterface $metadata, $value, $group, $propertyPath) - { - $context = new ExecutionContext( - $this, - $this->translator, - $this->translationDomain, - $metadata, - $value, - $group, - $propertyPath - ); - - $context->validateValue($value, $metadata->findConstraints($group)); - } - - /** - * {@inheritdoc} - */ - public function validate($value, $group, $propertyPath, $traverse = false, $deep = false) - { - if (null === $value) { - return; - } - - if (is_object($value)) { - $hash = spl_object_hash($value); - - // Exit, if the object is already validated for the current group - if (isset($this->validatedObjects[$hash][$group])) { - return; - } - - // Initialize if the object wasn't initialized before - if (!isset($this->validatedObjects[$hash])) { - foreach ($this->objectInitializers as $initializer) { - if (!$initializer instanceof ObjectInitializerInterface) { - throw new \LogicException('Validator initializers must implement ObjectInitializerInterface.'); - } - $initializer->initialize($value); - } - } - - // Remember validating this object before starting and possibly - // traversing the object graph - $this->validatedObjects[$hash][$group] = true; - } - - // Validate arrays recursively by default, otherwise every driver needs - // to implement special handling for arrays. - // https://github.com/symfony/symfony/issues/6246 - if (is_array($value) || ($traverse && $value instanceof \Traversable)) { - foreach ($value as $key => $element) { - // Ignore any scalar values in the collection - if (is_object($element) || is_array($element)) { - // Only repeat the traversal if $deep is set - $this->validate($element, $group, $propertyPath.'['.$key.']', $deep, $deep); - } - } - - try { - $this->metadataFactory->getMetadataFor($value)->accept($this, $value, $group, $propertyPath); - } catch (NoSuchMetadataException $e) { - // Metadata doesn't necessarily have to exist for - // traversable objects, because we know how to validate - // them anyway. Optionally, additional metadata is supported. - } - } else { - $this->metadataFactory->getMetadataFor($value)->accept($this, $value, $group, $propertyPath); - } - } - - /** - * {@inheritdoc} - */ - public function getViolations() - { - return $this->violations; - } - - /** - * {@inheritdoc} - */ - public function getRoot() - { - return $this->root; - } - - /** - * {@inheritdoc} - */ - public function getVisitor() - { - return $this; - } - - /** - * {@inheritdoc} - */ - public function getValidatorFactory() - { - return $this->validatorFactory; - } - - /** - * {@inheritdoc} - */ - public function getMetadataFactory() - { - return $this->metadataFactory; - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/ValidationVisitorInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/ValidationVisitorInterface.php deleted file mode 100644 index 483a1b5..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/ValidationVisitorInterface.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -/** - * Validates values against constraints defined in {@link MetadataInterface} - * instances. - * - * This interface is an implementation of the Visitor design pattern. A value - * is validated by first passing it to the {@link validate} method. That method - * will determine the matching {@link MetadataInterface} for validating the - * value. It then calls the {@link MetadataInterface::accept} method of that - * metadata. accept() does two things: - * - *
    - *
  1. It calls {@link visit} to validate the value against the constraints of - * the metadata.
  2. - *
  3. It calls accept() on all nested metadata instances with the - * corresponding values extracted from the current value. For example, if the - * current metadata represents a class and the current value is an object of - * that class, the metadata contains nested instances for each property of that - * class. It forwards the call to these nested metadata with the values of the - * corresponding properties in the original object.
  4. - *
- * - * @author Bernhard Schussek - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - */ -interface ValidationVisitorInterface -{ - /** - * Validates a value. - * - * If the value is an array or a traversable object, you can set the - * parameter $traverse to true in order to run through - * the collection and validate each element. If these elements can be - * collections again and you want to traverse them recursively, set the - * parameter $deep to true as well. - * - * If you set $traversable to true, the visitor will - * nevertheless try to find metadata for the collection and validate its - * constraints. If no such metadata is found, the visitor ignores that and - * only iterates the collection. - * - * If you don't set $traversable to true and the visitor - * does not find metadata for the given value, it will fail with an - * exception. - * - * @param mixed $value The value to validate. - * @param string $group The validation group to validate. - * @param string $propertyPath The current property path in the validation graph. - * @param bool $traverse Whether to traverse the value if it is traversable. - * @param bool $deep Whether to traverse nested traversable values recursively. - * - * @throws Exception\NoSuchMetadataException If no metadata can be found for - * the given value. - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - */ - public function validate($value, $group, $propertyPath, $traverse = false, $deep = false); - - /** - * Validates a value against the constraints defined in some metadata. - * - * This method implements the Visitor design pattern. See also - * {@link ValidationVisitorInterface}. - * - * @param MetadataInterface $metadata The metadata holding the constraints. - * @param mixed $value The value to validate. - * @param string $group The validation group to validate. - * @param string $propertyPath The current property path in the validation graph. - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - */ - public function visit(MetadataInterface $metadata, $value, $group, $propertyPath); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Validator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Validator.php deleted file mode 100644 index 6edbb7a..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Validator.php +++ /dev/null @@ -1,235 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -use Symfony\Component\Translation\TranslatorInterface; -use Symfony\Component\Validator\Constraints\Valid; -use Symfony\Component\Validator\Exception\ValidatorException; - -/** - * Default implementation of {@link ValidatorInterface}. - * - * @author Fabien Potencier - * @author Bernhard Schussek - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link Validator\RecursiveValidator} instead. - */ -class Validator implements ValidatorInterface, Mapping\Factory\MetadataFactoryInterface -{ - /** - * @var MetadataFactoryInterface - */ - private $metadataFactory; - - /** - * @var ConstraintValidatorFactoryInterface - */ - private $validatorFactory; - - /** - * @var TranslatorInterface - */ - private $translator; - - /** - * @var null|string - */ - private $translationDomain; - - /** - * @var array - */ - private $objectInitializers; - - public function __construct( - MetadataFactoryInterface $metadataFactory, - ConstraintValidatorFactoryInterface $validatorFactory, - TranslatorInterface $translator, - $translationDomain = 'validators', - array $objectInitializers = array() - ) { - $this->metadataFactory = $metadataFactory; - $this->validatorFactory = $validatorFactory; - $this->translator = $translator; - $this->translationDomain = $translationDomain; - $this->objectInitializers = $objectInitializers; - } - - /** - * {@inheritdoc} - */ - public function getMetadataFactory() - { - return $this->metadataFactory; - } - - /** - * {@inheritdoc} - */ - public function getMetadataFor($value) - { - return $this->metadataFactory->getMetadataFor($value); - } - - /** - * {@inheritdoc} - */ - public function hasMetadataFor($value) - { - return $this->metadataFactory->hasMetadataFor($value); - } - - /** - * {@inheritdoc} - */ - public function validate($value, $groups = null, $traverse = false, $deep = false) - { - $visitor = $this->createVisitor($value); - - foreach ($this->resolveGroups($groups) as $group) { - $visitor->validate($value, $group, '', $traverse, $deep); - } - - return $visitor->getViolations(); - } - - /** - * {@inheritdoc} - * - * @throws ValidatorException If the metadata for the value does not support properties. - */ - public function validateProperty($containingValue, $property, $groups = null) - { - $visitor = $this->createVisitor($containingValue); - $metadata = $this->metadataFactory->getMetadataFor($containingValue); - - if (!$metadata instanceof PropertyMetadataContainerInterface) { - $valueAsString = is_scalar($containingValue) - ? '"'.$containingValue.'"' - : 'the value of type '.gettype($containingValue); - - throw new ValidatorException(sprintf('The metadata for %s does not support properties.', $valueAsString)); - } - - foreach ($this->resolveGroups($groups) as $group) { - if (!$metadata->hasPropertyMetadata($property)) { - continue; - } - - foreach ($metadata->getPropertyMetadata($property) as $propMeta) { - $propMeta->accept($visitor, $propMeta->getPropertyValue($containingValue), $group, $property); - } - } - - return $visitor->getViolations(); - } - - /** - * {@inheritdoc} - * - * @throws ValidatorException If the metadata for the value does not support properties. - */ - public function validatePropertyValue($containingValue, $property, $value, $groups = null) - { - $visitor = $this->createVisitor(is_object($containingValue) ? $containingValue : $value); - $metadata = $this->metadataFactory->getMetadataFor($containingValue); - - if (!$metadata instanceof PropertyMetadataContainerInterface) { - $valueAsString = is_scalar($containingValue) - ? '"'.$containingValue.'"' - : 'the value of type '.gettype($containingValue); - - throw new ValidatorException(sprintf('The metadata for '.$valueAsString.' does not support properties.')); - } - - // If $containingValue is passed as class name, take $value as root - // and start the traversal with an empty property path - $propertyPath = is_object($containingValue) ? $property : ''; - - foreach ($this->resolveGroups($groups) as $group) { - if (!$metadata->hasPropertyMetadata($property)) { - continue; - } - - foreach ($metadata->getPropertyMetadata($property) as $propMeta) { - $propMeta->accept($visitor, $value, $group, $propertyPath); - } - } - - return $visitor->getViolations(); - } - - /** - * {@inheritdoc} - */ - public function validateValue($value, $constraints, $groups = null) - { - $context = new ExecutionContext($this->createVisitor($value), $this->translator, $this->translationDomain); - - $constraints = is_array($constraints) ? $constraints : array($constraints); - - foreach ($constraints as $constraint) { - if ($constraint instanceof Valid) { - // Why can't the Valid constraint be executed directly? - // - // It cannot be executed like regular other constraints, because regular - // constraints are only executed *if they belong to the validated group*. - // The Valid constraint, on the other hand, is always executed and propagates - // the group to the cascaded object. The propagated group depends on - // - // * Whether a group sequence is currently being executed. Then the default - // group is propagated. - // - // * Otherwise the validated group is propagated. - - throw new ValidatorException( - sprintf( - 'The constraint %s cannot be validated. Use the method validate() instead.', - get_class($constraint) - ) - ); - } - - $context->validateValue($value, $constraint, '', $groups); - } - - return $context->getViolations(); - } - - /** - * @param mixed $root - * - * @return ValidationVisitor - */ - private function createVisitor($root) - { - return new ValidationVisitor( - $root, - $this->metadataFactory, - $this->validatorFactory, - $this->translator, - $this->translationDomain, - $this->objectInitializers - ); - } - - /** - * @param null|string|string[] $groups - * - * @return string[] - */ - private function resolveGroups($groups) - { - return $groups ? (array) $groups : array(Constraint::DEFAULT_GROUP); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php deleted file mode 100644 index 767f895..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php +++ /dev/null @@ -1,89 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Validator; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintViolationListInterface; - -/** - * A validator in a specific execution context. - * - * @since 2.5 - * @author Bernhard Schussek - */ -interface ContextualValidatorInterface -{ - /** - * Appends the given path to the property path of the context. - * - * If called multiple times, the path will always be reset to the context's - * original path with the given path appended to it. - * - * @param string $path The path to append - * - * @return ContextualValidatorInterface This validator - */ - public function atPath($path); - - /** - * Validates a value against a constraint or a list of constraints. - * - * If no constraint is passed, the constraint - * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. - * - * @param mixed $value The value to validate - * @param Constraint|Constraint[] $constraints The constraint(s) to validate - * against - * @param array|null $groups The validation groups to - * validate. If none is given, - * "Default" is assumed - * - * @return ContextualValidatorInterface This validator - */ - public function validate($value, $constraints = null, $groups = null); - - /** - * Validates a property of an object against the constraints specified - * for this property. - * - * @param object $object The object - * @param string $propertyName The name of the validated property - * @param array|null $groups The validation groups to validate. If - * none is given, "Default" is assumed - * - * @return ContextualValidatorInterface This validator - */ - public function validateProperty($object, $propertyName, $groups = null); - - /** - * Validates a value against the constraints specified for an object's - * property. - * - * @param object|string $objectOrClass The object or its class name - * @param string $propertyName The name of the property - * @param mixed $value The value to validate against the - * property's constraints - * @param array|null $groups The validation groups to validate. If - * none is given, "Default" is assumed - * - * @return ContextualValidatorInterface This validator - */ - public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null); - - /** - * Returns the violations that have been generated so far in the context - * of the validator. - * - * @return ConstraintViolationListInterface The constraint violations - */ - public function getViolations(); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/LegacyValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/LegacyValidator.php deleted file mode 100644 index ce3501f..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/LegacyValidator.php +++ /dev/null @@ -1,79 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Validator; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Constraints\GroupSequence; -use Symfony\Component\Validator\Constraints\Valid; -use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface; - -/** - * A validator that supports both the API of Symfony < 2.5 and Symfony 2.5+. - * - * This class is incompatible with PHP versions < 5.3.9, because it implements - * two different interfaces specifying the same method validate(): - * - * - {@link \Symfony\Component\Validator\ValidatorInterface} - * - {@link \Symfony\Component\Validator\Validator\ValidatorInterface} - * - * In PHP versions prior to 5.3.9, either use {@link RecursiveValidator} or the - * deprecated class {@link \Symfony\Component\Validator\Validator} instead. - * - * @since 2.5 - * @author Bernhard Schussek - * - * @see \Symfony\Component\Validator\ValidatorInterface - * @see \Symfony\Component\Validator\Validator\ValidatorInterface - * - * @deprecated Implemented for backwards compatibility with Symfony < 2.5. - * To be removed in Symfony 3.0. - */ -class LegacyValidator extends RecursiveValidator implements LegacyValidatorInterface -{ - public function validate($value, $groups = null, $traverse = false, $deep = false) - { - $numArgs = func_num_args(); - - // Use new signature if constraints are given in the second argument - if (self::testConstraints($groups) && ($numArgs < 3 || 3 === $numArgs && self::testGroups($traverse))) { - // Rename to avoid total confusion ;) - $constraints = $groups; - $groups = $traverse; - - return parent::validate($value, $constraints, $groups); - } - - $constraint = new Valid(array('traverse' => $traverse, 'deep' => $deep)); - - return parent::validate($value, $constraint, $groups); - } - - public function validateValue($value, $constraints, $groups = null) - { - return parent::validate($value, $constraints, $groups); - } - - public function getMetadataFactory() - { - return $this->metadataFactory; - } - - private static function testConstraints($constraints) - { - return null === $constraints || $constraints instanceof Constraint || (is_array($constraints) && current($constraints) instanceof Constraint); - } - - private static function testGroups($groups) - { - return null === $groups || is_string($groups) || $groups instanceof GroupSequence || (is_array($groups) && (is_string(current($groups)) || current($groups) instanceof GroupSequence)); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php deleted file mode 100644 index 191decd..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php +++ /dev/null @@ -1,866 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Validator; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Constraints\GroupSequence; -use Symfony\Component\Validator\ConstraintValidatorFactoryInterface; -use Symfony\Component\Validator\Context\ExecutionContextInterface; -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; -use Symfony\Component\Validator\Exception\NoSuchMetadataException; -use Symfony\Component\Validator\Exception\RuntimeException; -use Symfony\Component\Validator\Exception\UnsupportedMetadataException; -use Symfony\Component\Validator\Exception\ValidatorException; -use Symfony\Component\Validator\Mapping\CascadingStrategy; -use Symfony\Component\Validator\Mapping\ClassMetadataInterface; -use Symfony\Component\Validator\Mapping\GenericMetadata; -use Symfony\Component\Validator\Mapping\MetadataInterface; -use Symfony\Component\Validator\Mapping\PropertyMetadataInterface; -use Symfony\Component\Validator\Mapping\TraversalStrategy; -use Symfony\Component\Validator\MetadataFactoryInterface; -use Symfony\Component\Validator\ObjectInitializerInterface; -use Symfony\Component\Validator\Util\PropertyPath; - -/** - * Recursive implementation of {@link ContextualValidatorInterface}. - * - * @since 2.5 - * @author Bernhard Schussek - */ -class RecursiveContextualValidator implements ContextualValidatorInterface -{ - /** - * @var ExecutionContextInterface - */ - private $context; - - /** - * @var MetadataFactoryInterface - */ - private $metadataFactory; - - /** - * @var ConstraintValidatorFactoryInterface - */ - private $validatorFactory; - - /** - * @var ObjectInitializerInterface[] - */ - private $objectInitializers; - - /** - * Creates a validator for the given context. - * - * @param ExecutionContextInterface $context The execution context - * @param MetadataFactoryInterface $metadataFactory The factory for - * fetching the metadata - * of validated objects - * @param ConstraintValidatorFactoryInterface $validatorFactory The factory for creating - * constraint validators - * @param ObjectInitializerInterface[] $objectInitializers The object initializers - */ - public function __construct(ExecutionContextInterface $context, MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, array $objectInitializers = array()) - { - $this->context = $context; - $this->defaultPropertyPath = $context->getPropertyPath(); - $this->defaultGroups = array($context->getGroup() ?: Constraint::DEFAULT_GROUP); - $this->metadataFactory = $metadataFactory; - $this->validatorFactory = $validatorFactory; - $this->objectInitializers = $objectInitializers; - } - - /** - * {@inheritdoc} - */ - public function atPath($path) - { - $this->defaultPropertyPath = $this->context->getPropertyPath($path); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function validate($value, $constraints = null, $groups = null) - { - $groups = $groups ? $this->normalizeGroups($groups) : $this->defaultGroups; - - $previousValue = $this->context->getValue(); - $previousObject = $this->context->getObject(); - $previousMetadata = $this->context->getMetadata(); - $previousPath = $this->context->getPropertyPath(); - $previousGroup = $this->context->getGroup(); - - // If explicit constraints are passed, validate the value against - // those constraints - if (null !== $constraints) { - // You can pass a single constraint or an array of constraints - // Make sure to deal with an array in the rest of the code - if (!is_array($constraints)) { - $constraints = array($constraints); - } - - $metadata = new GenericMetadata(); - $metadata->addConstraints($constraints); - - $this->validateGenericNode( - $value, - null, - is_object($value) ? spl_object_hash($value) : null, - $metadata, - $this->defaultPropertyPath, - $groups, - null, - TraversalStrategy::IMPLICIT, - $this->context - ); - - $this->context->setNode($previousValue, $previousObject, $previousMetadata, $previousPath); - $this->context->setGroup($previousGroup); - - return $this; - } - - // If an object is passed without explicit constraints, validate that - // object against the constraints defined for the object's class - if (is_object($value)) { - $this->validateObject( - $value, - $this->defaultPropertyPath, - $groups, - TraversalStrategy::IMPLICIT, - $this->context - ); - - $this->context->setNode($previousValue, $previousObject, $previousMetadata, $previousPath); - $this->context->setGroup($previousGroup); - - return $this; - } - - // If an array is passed without explicit constraints, validate each - // object in the array - if (is_array($value)) { - $this->validateEachObjectIn( - $value, - $this->defaultPropertyPath, - $groups, - true, - $this->context - ); - - $this->context->setNode($previousValue, $previousObject, $previousMetadata, $previousPath); - $this->context->setGroup($previousGroup); - - return $this; - } - - throw new RuntimeException(sprintf( - 'Cannot validate values of type "%s" automatically. Please '. - 'provide a constraint.', - gettype($value) - )); - } - - /** - * {@inheritdoc} - */ - public function validateProperty($object, $propertyName, $groups = null) - { - $classMetadata = $this->metadataFactory->getMetadataFor($object); - - if (!$classMetadata instanceof ClassMetadataInterface) { - // Cannot be UnsupportedMetadataException because of BC with - // Symfony < 2.5 - throw new ValidatorException(sprintf( - 'The metadata factory should return instances of '. - '"\Symfony\Component\Validator\Mapping\ClassMetadataInterface", '. - 'got: "%s".', - is_object($classMetadata) ? get_class($classMetadata) : gettype($classMetadata) - )); - } - - $propertyMetadatas = $classMetadata->getPropertyMetadata($propertyName); - $groups = $groups ? $this->normalizeGroups($groups) : $this->defaultGroups; - $cacheKey = spl_object_hash($object); - $propertyPath = PropertyPath::append($this->defaultPropertyPath, $propertyName); - - $previousValue = $this->context->getValue(); - $previousObject = $this->context->getObject(); - $previousMetadata = $this->context->getMetadata(); - $previousPath = $this->context->getPropertyPath(); - $previousGroup = $this->context->getGroup(); - - foreach ($propertyMetadatas as $propertyMetadata) { - $propertyValue = $propertyMetadata->getPropertyValue($object); - - $this->validateGenericNode( - $propertyValue, - $object, - $cacheKey.':'.$propertyName, - $propertyMetadata, - $propertyPath, - $groups, - null, - TraversalStrategy::IMPLICIT, - $this->context - ); - } - - $this->context->setNode($previousValue, $previousObject, $previousMetadata, $previousPath); - $this->context->setGroup($previousGroup); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null) - { - $classMetadata = $this->metadataFactory->getMetadataFor($objectOrClass); - - if (!$classMetadata instanceof ClassMetadataInterface) { - // Cannot be UnsupportedMetadataException because of BC with - // Symfony < 2.5 - throw new ValidatorException(sprintf( - 'The metadata factory should return instances of '. - '"\Symfony\Component\Validator\Mapping\ClassMetadataInterface", '. - 'got: "%s".', - is_object($classMetadata) ? get_class($classMetadata) : gettype($classMetadata) - )); - } - - $propertyMetadatas = $classMetadata->getPropertyMetadata($propertyName); - $groups = $groups ? $this->normalizeGroups($groups) : $this->defaultGroups; - - if (is_object($objectOrClass)) { - $object = $objectOrClass; - $cacheKey = spl_object_hash($objectOrClass); - $propertyPath = PropertyPath::append($this->defaultPropertyPath, $propertyName); - } else { - // $objectOrClass contains a class name - $object = null; - $cacheKey = null; - $propertyPath = $this->defaultPropertyPath; - } - - $previousValue = $this->context->getValue(); - $previousObject = $this->context->getObject(); - $previousMetadata = $this->context->getMetadata(); - $previousPath = $this->context->getPropertyPath(); - $previousGroup = $this->context->getGroup(); - - foreach ($propertyMetadatas as $propertyMetadata) { - $this->validateGenericNode( - $value, - $object, - $cacheKey.':'.$propertyName, - $propertyMetadata, - $propertyPath, - $groups, - null, - TraversalStrategy::IMPLICIT, - $this->context - ); - } - - $this->context->setNode($previousValue, $previousObject, $previousMetadata, $previousPath); - $this->context->setGroup($previousGroup); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function getViolations() - { - return $this->context->getViolations(); - } - - /** - * Normalizes the given group or list of groups to an array. - * - * @param mixed $groups The groups to normalize - * - * @return array A group array - */ - protected function normalizeGroups($groups) - { - if (is_array($groups)) { - return $groups; - } - - return array($groups); - } - /** - * Validates an object against the constraints defined for its class. - * - * If no metadata is available for the class, but the class is an instance - * of {@link \Traversable} and the selected traversal strategy allows - * traversal, the object will be iterated and each nested object will be - * validated instead. - * - * @param object $object The object to cascade - * @param string $propertyPath The current property path - * @param string[] $groups The validated groups - * @param int $traversalStrategy The strategy for traversing the - * cascaded object - * @param ExecutionContextInterface $context The current execution context - * - * @throws NoSuchMetadataException If the object has no associated metadata - * and does not implement {@link \Traversable} - * or if traversal is disabled via the - * $traversalStrategy argument - * @throws UnsupportedMetadataException If the metadata returned by the - * metadata factory does not implement - * {@link ClassMetadataInterface} - */ - private function validateObject($object, $propertyPath, array $groups, $traversalStrategy, ExecutionContextInterface $context) - { - try { - $classMetadata = $this->metadataFactory->getMetadataFor($object); - - if (!$classMetadata instanceof ClassMetadataInterface) { - throw new UnsupportedMetadataException(sprintf( - 'The metadata factory should return instances of '. - '"Symfony\Component\Validator\Mapping\ClassMetadataInterface", '. - 'got: "%s".', - is_object($classMetadata) ? get_class($classMetadata) : gettype($classMetadata) - )); - } - - $this->validateClassNode( - $object, - spl_object_hash($object), - $classMetadata, - $propertyPath, - $groups, - null, - $traversalStrategy, - $context - ); - } catch (NoSuchMetadataException $e) { - // Rethrow if not Traversable - if (!$object instanceof \Traversable) { - throw $e; - } - - // Rethrow unless IMPLICIT or TRAVERSE - if (!($traversalStrategy & (TraversalStrategy::IMPLICIT | TraversalStrategy::TRAVERSE))) { - throw $e; - } - - $this->validateEachObjectIn( - $object, - $propertyPath, - $groups, - $traversalStrategy & TraversalStrategy::STOP_RECURSION, - $context - ); - } - } - - /** - * Validates each object in a collection against the constraints defined - * for their classes. - * - * If the parameter $recursive is set to true, nested {@link \Traversable} - * objects are iterated as well. Nested arrays are always iterated, - * regardless of the value of $recursive. - * - * @param array|\Traversable $collection The collection - * @param string $propertyPath The current property path - * @param string[] $groups The validated groups - * @param bool $stopRecursion Whether to disable - * recursive iteration. For - * backwards compatibility - * with Symfony < 2.5. - * @param ExecutionContextInterface $context The current execution context - * - * @see ClassNode - * @see CollectionNode - */ - private function validateEachObjectIn($collection, $propertyPath, array $groups, $stopRecursion, ExecutionContextInterface $context) - { - if ($stopRecursion) { - $traversalStrategy = TraversalStrategy::NONE; - } else { - $traversalStrategy = TraversalStrategy::IMPLICIT; - } - - foreach ($collection as $key => $value) { - if (is_array($value)) { - // Arrays are always cascaded, independent of the specified - // traversal strategy - // (BC with Symfony < 2.5) - $this->validateEachObjectIn( - $value, - $propertyPath.'['.$key.']', - $groups, - $stopRecursion, - $context - ); - - continue; - } - - // Scalar and null values in the collection are ignored - // (BC with Symfony < 2.5) - if (is_object($value)) { - $this->validateObject( - $value, - $propertyPath.'['.$key.']', - $groups, - $traversalStrategy, - $context - ); - } - } - } - - /** - * Validates a class node. - * - * A class node is a combination of an object with a {@link ClassMetadataInterface} - * instance. Each class node (conceptionally) has zero or more succeeding - * property nodes: - * - * (Article:class node) - * \ - * ($title:property node) - * - * This method validates the passed objects against all constraints defined - * at class level. It furthermore triggers the validation of each of the - * class' properties against the constraints for that property. - * - * If the selected traversal strategy allows traversal, the object is - * iterated and each nested object is validated against its own constraints. - * The object is not traversed if traversal is disabled in the class - * metadata. - * - * If the passed groups contain the group "Default", the validator will - * check whether the "Default" group has been replaced by a group sequence - * in the class metadata. If this is the case, the group sequence is - * validated instead. - * - * @param object $object The validated object - * @param string $cacheKey The key for caching - * the validated object - * @param ClassMetadataInterface $metadata The class metadata of - * the object - * @param string $propertyPath The property path leading - * to the object - * @param string[] $groups The groups in which the - * object should be validated - * @param string[]|null $cascadedGroups The groups in which - * cascaded objects should - * be validated - * @param int $traversalStrategy The strategy used for - * traversing the object - * @param ExecutionContextInterface $context The current execution context - * - * @throws UnsupportedMetadataException If a property metadata does not - * implement {@link PropertyMetadataInterface} - * @throws ConstraintDefinitionException If traversal was enabled but the - * object does not implement - * {@link \Traversable} - * - * @see TraversalStrategy - */ - private function validateClassNode($object, $cacheKey, ClassMetadataInterface $metadata = null, $propertyPath, array $groups, $cascadedGroups, $traversalStrategy, ExecutionContextInterface $context) - { - $context->setNode($object, $object, $metadata, $propertyPath); - - if (!$context->isObjectInitialized($cacheKey)) { - foreach ($this->objectInitializers as $initializer) { - $initializer->initialize($object); - } - - $context->markObjectAsInitialized($cacheKey); - } - - foreach ($groups as $key => $group) { - // If the "Default" group is replaced by a group sequence, remember - // to cascade the "Default" group when traversing the group - // sequence - $defaultOverridden = false; - - // Use the object hash for group sequences - $groupHash = is_object($group) ? spl_object_hash($group) : $group; - - if ($context->isGroupValidated($cacheKey, $groupHash)) { - // Skip this group when validating the properties and when - // traversing the object - unset($groups[$key]); - - continue; - } - - $context->markGroupAsValidated($cacheKey, $groupHash); - - // Replace the "Default" group by the group sequence defined - // for the class, if applicable. - // This is done after checking the cache, so that - // spl_object_hash() isn't called for this sequence and - // "Default" is used instead in the cache. This is useful - // if the getters below return different group sequences in - // every call. - if (Constraint::DEFAULT_GROUP === $group) { - if ($metadata->hasGroupSequence()) { - // The group sequence is statically defined for the class - $group = $metadata->getGroupSequence(); - $defaultOverridden = true; - } elseif ($metadata->isGroupSequenceProvider()) { - // The group sequence is dynamically obtained from the validated - // object - /** @var \Symfony\Component\Validator\GroupSequenceProviderInterface $object */ - $group = $object->getGroupSequence(); - $defaultOverridden = true; - - if (!$group instanceof GroupSequence) { - $group = new GroupSequence($group); - } - } - } - - // If the groups (=[,G3,G4]) contain a group sequence - // (=), then call validateClassNode() with each entry of the - // group sequence and abort if necessary (G1, G2) - if ($group instanceof GroupSequence) { - $this->stepThroughGroupSequence( - $object, - $object, - $cacheKey, - $metadata, - $propertyPath, - $traversalStrategy, - $group, - $defaultOverridden ? Constraint::DEFAULT_GROUP : null, - $context - ); - - // Skip the group sequence when validating properties, because - // stepThroughGroupSequence() already validates the properties - unset($groups[$key]); - - continue; - } - - $this->validateInGroup($object, $cacheKey, $metadata, $group, $context); - } - - // If no more groups should be validated for the property nodes, - // we can safely quit - if (0 === count($groups)) { - return; - } - - // Validate all properties against their constraints - foreach ($metadata->getConstrainedProperties() as $propertyName) { - // If constraints are defined both on the getter of a property as - // well as on the property itself, then getPropertyMetadata() - // returns two metadata objects, not just one - foreach ($metadata->getPropertyMetadata($propertyName) as $propertyMetadata) { - if (!$propertyMetadata instanceof PropertyMetadataInterface) { - throw new UnsupportedMetadataException(sprintf( - 'The property metadata instances should implement '. - '"Symfony\Component\Validator\Mapping\PropertyMetadataInterface", '. - 'got: "%s".', - is_object($propertyMetadata) ? get_class($propertyMetadata) : gettype($propertyMetadata) - )); - } - - $propertyValue = $propertyMetadata->getPropertyValue($object); - - $this->validateGenericNode( - $propertyValue, - $object, - $cacheKey.':'.$propertyName, - $propertyMetadata, - $propertyPath - ? $propertyPath.'.'.$propertyName - : $propertyName, - $groups, - $cascadedGroups, - TraversalStrategy::IMPLICIT, - $context - ); - } - } - - // If no specific traversal strategy was requested when this method - // was called, use the traversal strategy of the class' metadata - if ($traversalStrategy & TraversalStrategy::IMPLICIT) { - // Keep the STOP_RECURSION flag, if it was set - $traversalStrategy = $metadata->getTraversalStrategy() - | ($traversalStrategy & TraversalStrategy::STOP_RECURSION); - } - - // Traverse only if IMPLICIT or TRAVERSE - if (!($traversalStrategy & (TraversalStrategy::IMPLICIT | TraversalStrategy::TRAVERSE))) { - return; - } - - // If IMPLICIT, stop unless we deal with a Traversable - if ($traversalStrategy & TraversalStrategy::IMPLICIT && !$object instanceof \Traversable) { - return; - } - - // If TRAVERSE, fail if we have no Traversable - if (!$object instanceof \Traversable) { - // Must throw a ConstraintDefinitionException for backwards - // compatibility reasons with Symfony < 2.5 - throw new ConstraintDefinitionException(sprintf( - 'Traversal was enabled for "%s", but this class '. - 'does not implement "\Traversable".', - get_class($object) - )); - } - - $this->validateEachObjectIn( - $object, - $propertyPath, - $groups, - $traversalStrategy & TraversalStrategy::STOP_RECURSION, - $context - ); - } - - /** - * Validates a node that is not a class node. - * - * Currently, two such node types exist: - * - * - property nodes, which consist of the value of an object's - * property together with a {@link PropertyMetadataInterface} instance - * - generic nodes, which consist of a value and some arbitrary - * constraints defined in a {@link MetadataInterface} container - * - * In both cases, the value is validated against all constraints defined - * in the passed metadata object. Then, if the value is an instance of - * {@link \Traversable} and the selected traversal strategy permits it, - * the value is traversed and each nested object validated against its own - * constraints. Arrays are always traversed. - * - * @param mixed $value The validated value - * @param object|null $object The current object - * @param string $cacheKey The key for caching - * the validated value - * @param MetadataInterface $metadata The metadata of the - * value - * @param string $propertyPath The property path leading - * to the value - * @param string[] $groups The groups in which the - * value should be validated - * @param string[]|null $cascadedGroups The groups in which - * cascaded objects should - * be validated - * @param int $traversalStrategy The strategy used for - * traversing the value - * @param ExecutionContextInterface $context The current execution context - * - * @see TraversalStrategy - */ - private function validateGenericNode($value, $object, $cacheKey, MetadataInterface $metadata = null, $propertyPath, array $groups, $cascadedGroups, $traversalStrategy, ExecutionContextInterface $context) - { - $context->setNode($value, $object, $metadata, $propertyPath); - - foreach ($groups as $key => $group) { - if ($group instanceof GroupSequence) { - $this->stepThroughGroupSequence( - $value, - $object, - $cacheKey, - $metadata, - $propertyPath, - $traversalStrategy, - $group, - null, - $context - ); - - // Skip the group sequence when cascading, as the cascading - // logic is already done in stepThroughGroupSequence() - unset($groups[$key]); - - continue; - } - - $this->validateInGroup($value, $cacheKey, $metadata, $group, $context); - } - - if (0 === count($groups)) { - return; - } - - if (null === $value) { - return; - } - - $cascadingStrategy = $metadata->getCascadingStrategy(); - - // Quit unless we have an array or a cascaded object - if (!is_array($value) && !($cascadingStrategy & CascadingStrategy::CASCADE)) { - return; - } - - // If no specific traversal strategy was requested when this method - // was called, use the traversal strategy of the node's metadata - if ($traversalStrategy & TraversalStrategy::IMPLICIT) { - // Keep the STOP_RECURSION flag, if it was set - $traversalStrategy = $metadata->getTraversalStrategy() - | ($traversalStrategy & TraversalStrategy::STOP_RECURSION); - } - - // The $cascadedGroups property is set, if the "Default" group is - // overridden by a group sequence - // See validateClassNode() - $cascadedGroups = count($cascadedGroups) > 0 - ? $cascadedGroups - : $groups; - - if (is_array($value)) { - // Arrays are always traversed, independent of the specified - // traversal strategy - // (BC with Symfony < 2.5) - $this->validateEachObjectIn( - $value, - $propertyPath, - $cascadedGroups, - $traversalStrategy & TraversalStrategy::STOP_RECURSION, - $context - ); - - return; - } - - // If the value is a scalar, pass it anyway, because we want - // a NoSuchMetadataException to be thrown in that case - // (BC with Symfony < 2.5) - $this->validateObject( - $value, - $propertyPath, - $cascadedGroups, - $traversalStrategy, - $context - ); - - // Currently, the traversal strategy can only be TRAVERSE for a - // generic node if the cascading strategy is CASCADE. Thus, traversable - // objects will always be handled within validateObject() and there's - // nothing more to do here. - - // see GenericMetadata::addConstraint() - } - - /** - * Sequentially validates a node's value in each group of a group sequence. - * - * If any of the constraints generates a violation, subsequent groups in the - * group sequence are skipped. - * - * @param mixed $value The validated value - * @param object|null $object The current object - * @param string $cacheKey The key for caching - * the validated value - * @param MetadataInterface $metadata The metadata of the - * value - * @param string $propertyPath The property path leading - * to the value - * @param int $traversalStrategy The strategy used for - * traversing the value - * @param GroupSequence $groupSequence The group sequence - * @param string[]|null $cascadedGroup The group that should - * be passed to cascaded - * objects instead of - * the group sequence - * @param ExecutionContextInterface $context The execution context - */ - private function stepThroughGroupSequence($value, $object, $cacheKey, MetadataInterface $metadata = null, $propertyPath, $traversalStrategy, GroupSequence $groupSequence, $cascadedGroup, ExecutionContextInterface $context) - { - $violationCount = count($context->getViolations()); - $cascadedGroups = $cascadedGroup ? array($cascadedGroup) : null; - - foreach ($groupSequence->groups as $groupInSequence) { - $groups = array($groupInSequence); - - if ($metadata instanceof ClassMetadataInterface) { - $this->validateClassNode( - $value, - $cacheKey, - $metadata, - $propertyPath, - $groups, - $cascadedGroups, - $traversalStrategy, - $context - ); - } else { - $this->validateGenericNode( - $value, - $object, - $cacheKey, - $metadata, - $propertyPath, - $groups, - $cascadedGroups, - $traversalStrategy, - $context - ); - } - - // Abort sequence validation if a violation was generated - if (count($context->getViolations()) > $violationCount) { - break; - } - } - } - - /** - * 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 - */ - 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 ($context->isConstraintValidated($cacheKey, $constraintHash)) { - continue; - } - - $context->markConstraintAsValidated($cacheKey, $constraintHash); - } - - $context->setConstraint($constraint); - - $validator = $this->validatorFactory->getInstance($constraint); - $validator->initialize($context); - $validator->validate($value, $constraint); - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/RecursiveValidator.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/RecursiveValidator.php deleted file mode 100644 index ddf0850..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/RecursiveValidator.php +++ /dev/null @@ -1,140 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Validator; - -use Symfony\Component\Validator\ConstraintValidatorFactoryInterface; -use Symfony\Component\Validator\Context\ExecutionContextFactoryInterface; -use Symfony\Component\Validator\Context\ExecutionContextInterface; -use Symfony\Component\Validator\MetadataFactoryInterface; -use Symfony\Component\Validator\ObjectInitializerInterface; - -/** - * Recursive implementation of {@link ValidatorInterface}. - * - * @since 2.5 - * @author Bernhard Schussek - */ -class RecursiveValidator implements ValidatorInterface -{ - /** - * @var ExecutionContextFactoryInterface - */ - protected $contextFactory; - - /** - * @var MetadataFactoryInterface - */ - protected $metadataFactory; - - /** - * @var ConstraintValidatorFactoryInterface - */ - protected $validatorFactory; - - /** - * @var ObjectInitializerInterface[] - */ - protected $objectInitializers; - - /** - * Creates a new validator. - * - * @param ExecutionContextFactoryInterface $contextFactory The factory for - * creating new contexts - * @param MetadataFactoryInterface $metadataFactory The factory for - * fetching the metadata - * of validated objects - * @param ConstraintValidatorFactoryInterface $validatorFactory The factory for creating - * constraint validators - * @param ObjectInitializerInterface[] $objectInitializers The object initializers - */ - public function __construct(ExecutionContextFactoryInterface $contextFactory, MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, array $objectInitializers = array()) - { - $this->contextFactory = $contextFactory; - $this->metadataFactory = $metadataFactory; - $this->validatorFactory = $validatorFactory; - $this->objectInitializers = $objectInitializers; - } - - /** - * {@inheritdoc} - */ - public function startContext($root = null) - { - return new RecursiveContextualValidator( - $this->contextFactory->createContext($this, $root), - $this->metadataFactory, - $this->validatorFactory, - $this->objectInitializers - ); - } - - /** - * {@inheritdoc} - */ - public function inContext(ExecutionContextInterface $context) - { - return new RecursiveContextualValidator( - $context, - $this->metadataFactory, - $this->validatorFactory, - $this->objectInitializers - ); - } - - /** - * {@inheritdoc} - */ - public function getMetadataFor($object) - { - return $this->metadataFactory->getMetadataFor($object); - } - - /** - * {@inheritdoc} - */ - public function hasMetadataFor($object) - { - return $this->metadataFactory->hasMetadataFor($object); - } - - /** - * {@inheritdoc} - */ - public function validate($value, $constraints = null, $groups = null) - { - return $this->startContext($value) - ->validate($value, $constraints, $groups) - ->getViolations(); - } - - /** - * {@inheritdoc} - */ - public function validateProperty($object, $propertyName, $groups = null) - { - return $this->startContext($object) - ->validateProperty($object, $propertyName, $groups) - ->getViolations(); - } - - /** - * {@inheritdoc} - */ - public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null) - { - // If a class name is passed, take $value as root - return $this->startContext(is_object($objectOrClass) ? $objectOrClass : $value) - ->validatePropertyValue($objectOrClass, $propertyName, $value, $groups) - ->getViolations(); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/ValidatorInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/ValidatorInterface.php deleted file mode 100644 index 2582bf6..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Validator/ValidatorInterface.php +++ /dev/null @@ -1,100 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Validator; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintViolationListInterface; -use Symfony\Component\Validator\Context\ExecutionContextInterface; -use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; - -/** - * Validates PHP values against constraints. - * - * @since 2.5 - * @author Bernhard Schussek - */ -interface ValidatorInterface extends MetadataFactoryInterface -{ - /** - * Validates a value against a constraint or a list of constraints. - * - * If no constraint is passed, the constraint - * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. - * - * @param mixed $value The value to validate - * @param Constraint|Constraint[] $constraints The constraint(s) to validate - * against - * @param array|null $groups The validation groups to - * validate. If none is given, - * "Default" is assumed - * - * @return ConstraintViolationListInterface A list of constraint violations. - * If the list is empty, validation - * succeeded - */ - public function validate($value, $constraints = null, $groups = null); - - /** - * Validates a property of an object against the constraints specified - * for this property. - * - * @param object $object The object - * @param string $propertyName The name of the validated property - * @param array|null $groups The validation groups to validate. If - * none is given, "Default" is assumed - * - * @return ConstraintViolationListInterface A list of constraint violations. - * If the list is empty, validation - * succeeded - */ - public function validateProperty($object, $propertyName, $groups = null); - - /** - * Validates a value against the constraints specified for an object's - * property. - * - * @param object|string $objectOrClass The object or its class name - * @param string $propertyName The name of the property - * @param mixed $value The value to validate against the - * property's constraints - * @param array|null $groups The validation groups to validate. If - * none is given, "Default" is assumed - * - * @return ConstraintViolationListInterface A list of constraint violations. - * If the list is empty, validation - * succeeded - */ - public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null); - - /** - * Starts a new validation context and returns a validator for that context. - * - * The returned validator collects all violations generated within its - * context. You can access these violations with the - * {@link ContextualValidatorInterface::getViolations()} method. - * - * @return ContextualValidatorInterface The validator for the new context - */ - public function startContext(); - - /** - * Returns a validator in the given execution context. - * - * The returned validator adds all generated violations to the given - * context. - * - * @param ExecutionContextInterface $context The execution context - * - * @return ContextualValidatorInterface The validator for that context - */ - public function inContext(ExecutionContextInterface $context); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/ValidatorBuilder.php b/core/vendor/symfony/validator/Symfony/Component/Validator/ValidatorBuilder.php deleted file mode 100644 index 1d65478..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/ValidatorBuilder.php +++ /dev/null @@ -1,412 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -use Doctrine\Common\Annotations\AnnotationReader; -use Doctrine\Common\Annotations\CachedReader; -use Doctrine\Common\Annotations\Reader; -use Doctrine\Common\Cache\ArrayCache; -use Symfony\Component\PropertyAccess\PropertyAccessorInterface; -use Symfony\Component\Translation\TranslatorInterface; -use Symfony\Component\Validator\Context\ExecutionContextFactory; -use Symfony\Component\Validator\Context\LegacyExecutionContextFactory; -use Symfony\Component\Validator\Exception\InvalidArgumentException; -use Symfony\Component\Validator\Exception\ValidatorException; -use Symfony\Component\Validator\Mapping\Cache\CacheInterface; -use Symfony\Component\Validator\Mapping\ClassMetadataFactory; -use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory; -use Symfony\Component\Validator\Mapping\Loader\AnnotationLoader; -use Symfony\Component\Validator\Mapping\Loader\LoaderChain; -use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader; -use Symfony\Component\Validator\Mapping\Loader\XmlFileLoader; -use Symfony\Component\Validator\Mapping\Loader\XmlFilesLoader; -use Symfony\Component\Validator\Mapping\Loader\YamlFileLoader; -use Symfony\Component\Validator\Mapping\Loader\YamlFilesLoader; -use Symfony\Component\Validator\Validator\LegacyValidator; -use Symfony\Component\Validator\Validator\RecursiveValidator; -use Symfony\Component\Validator\Validator as ValidatorV24; - -/** - * The default implementation of {@link ValidatorBuilderInterface}. - * - * @author Bernhard Schussek - */ -class ValidatorBuilder implements ValidatorBuilderInterface -{ - /** - * @var array - */ - private $initializers = array(); - - /** - * @var array - */ - private $xmlMappings = array(); - - /** - * @var array - */ - private $yamlMappings = array(); - - /** - * @var array - */ - private $methodMappings = array(); - - /** - * @var Reader|null - */ - private $annotationReader; - - /** - * @var MetadataFactoryInterface|null - */ - private $metadataFactory; - - /** - * @var ConstraintValidatorFactoryInterface|null - */ - private $validatorFactory; - - /** - * @var CacheInterface|null - */ - private $metadataCache; - - /** - * @var TranslatorInterface|null - */ - private $translator; - - /** - * @var null|string - */ - private $translationDomain; - - /** - * @var PropertyAccessorInterface|null - */ - private $propertyAccessor; - - /** - * @var int|null - */ - private $apiVersion; - - /** - * {@inheritdoc} - */ - public function addObjectInitializer(ObjectInitializerInterface $initializer) - { - $this->initializers[] = $initializer; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addObjectInitializers(array $initializers) - { - $this->initializers = array_merge($this->initializers, $initializers); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addXmlMapping($path) - { - if (null !== $this->metadataFactory) { - throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); - } - - $this->xmlMappings[] = $path; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addXmlMappings(array $paths) - { - if (null !== $this->metadataFactory) { - throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); - } - - $this->xmlMappings = array_merge($this->xmlMappings, $paths); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addYamlMapping($path) - { - if (null !== $this->metadataFactory) { - throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); - } - - $this->yamlMappings[] = $path; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addYamlMappings(array $paths) - { - if (null !== $this->metadataFactory) { - throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); - } - - $this->yamlMappings = array_merge($this->yamlMappings, $paths); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addMethodMapping($methodName) - { - if (null !== $this->metadataFactory) { - throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); - } - - $this->methodMappings[] = $methodName; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addMethodMappings(array $methodNames) - { - if (null !== $this->metadataFactory) { - throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); - } - - $this->methodMappings = array_merge($this->methodMappings, $methodNames); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function enableAnnotationMapping(Reader $annotationReader = null) - { - if (null !== $this->metadataFactory) { - throw new ValidatorException('You cannot enable annotation mapping after setting a custom metadata factory. Configure your metadata factory instead.'); - } - - if (null === $annotationReader) { - if (!class_exists('Doctrine\Common\Annotations\AnnotationReader') || !class_exists('Doctrine\Common\Cache\ArrayCache')) { - throw new \RuntimeException('Enabling annotation based constraint mapping requires the packages doctrine/annotations and doctrine/cache to be installed.'); - } - - $annotationReader = new CachedReader(new AnnotationReader(), new ArrayCache()); - } - - $this->annotationReader = $annotationReader; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function disableAnnotationMapping() - { - $this->annotationReader = null; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setMetadataFactory(MetadataFactoryInterface $metadataFactory) - { - if (count($this->xmlMappings) > 0 || count($this->yamlMappings) > 0 || count($this->methodMappings) > 0 || null !== $this->annotationReader) { - throw new ValidatorException('You cannot set a custom metadata factory after adding custom mappings. You should do either of both.'); - } - - $this->metadataFactory = $metadataFactory; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setMetadataCache(CacheInterface $cache) - { - if (null !== $this->metadataFactory) { - throw new ValidatorException('You cannot set a custom metadata cache after setting a custom metadata factory. Configure your metadata factory instead.'); - } - - $this->metadataCache = $cache; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory) - { - if (null !== $this->propertyAccessor) { - throw new ValidatorException('You cannot set a validator factory after setting a custom property accessor. Remove the call to setPropertyAccessor() if you want to call setConstraintValidatorFactory().'); - } - - $this->validatorFactory = $validatorFactory; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setTranslator(TranslatorInterface $translator) - { - $this->translator = $translator; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setTranslationDomain($translationDomain) - { - $this->translationDomain = $translationDomain; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setPropertyAccessor(PropertyAccessorInterface $propertyAccessor) - { - if (null !== $this->validatorFactory) { - throw new ValidatorException('You cannot set a property accessor after setting a custom validator factory. Configure your validator factory instead.'); - } - - $this->propertyAccessor = $propertyAccessor; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setApiVersion($apiVersion) - { - if (!in_array($apiVersion, array(Validation::API_VERSION_2_4, Validation::API_VERSION_2_5, Validation::API_VERSION_2_5_BC))) { - throw new InvalidArgumentException(sprintf( - 'The requested API version is invalid: "%s"', - $apiVersion - )); - } - - if (PHP_VERSION_ID < 50309 && $apiVersion === Validation::API_VERSION_2_5_BC) { - throw new InvalidArgumentException(sprintf( - 'The Validator API that is compatible with both Symfony 2.4 '. - 'and Symfony 2.5 can only be used on PHP 5.3.9 and higher. '. - 'Your current PHP version is %s.', - PHP_VERSION - )); - } - - $this->apiVersion = $apiVersion; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function getValidator() - { - $metadataFactory = $this->metadataFactory; - $apiVersion = $this->apiVersion; - - if (null === $apiVersion) { - $apiVersion = PHP_VERSION_ID < 50309 - ? Validation::API_VERSION_2_4 - : Validation::API_VERSION_2_5_BC; - } - - if (!$metadataFactory) { - $loaders = array(); - - if (count($this->xmlMappings) > 1) { - $loaders[] = new XmlFilesLoader($this->xmlMappings); - } elseif (1 === count($this->xmlMappings)) { - $loaders[] = new XmlFileLoader($this->xmlMappings[0]); - } - - if (count($this->yamlMappings) > 1) { - $loaders[] = new YamlFilesLoader($this->yamlMappings); - } elseif (1 === count($this->yamlMappings)) { - $loaders[] = new YamlFileLoader($this->yamlMappings[0]); - } - - foreach ($this->methodMappings as $methodName) { - $loaders[] = new StaticMethodLoader($methodName); - } - - if ($this->annotationReader) { - $loaders[] = new AnnotationLoader($this->annotationReader); - } - - $loader = null; - - if (count($loaders) > 1) { - $loader = new LoaderChain($loaders); - } elseif (1 === count($loaders)) { - $loader = $loaders[0]; - } - - if (Validation::API_VERSION_2_5 === $apiVersion) { - $metadataFactory = new LazyLoadingMetadataFactory($loader, $this->metadataCache); - } else { - $metadataFactory = new ClassMetadataFactory($loader, $this->metadataCache); - } - } - - $validatorFactory = $this->validatorFactory ?: new ConstraintValidatorFactory($this->propertyAccessor); - $translator = $this->translator ?: new DefaultTranslator(); - - if (Validation::API_VERSION_2_4 === $apiVersion) { - return new ValidatorV24($metadataFactory, $validatorFactory, $translator, $this->translationDomain, $this->initializers); - } - - if (Validation::API_VERSION_2_5 === $apiVersion) { - $contextFactory = new ExecutionContextFactory($translator, $this->translationDomain); - - return new RecursiveValidator($contextFactory, $metadataFactory, $validatorFactory, $this->initializers); - } - - $contextFactory = new LegacyExecutionContextFactory($metadataFactory, $translator, $this->translationDomain); - - return new LegacyValidator($contextFactory, $metadataFactory, $validatorFactory, $this->initializers); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/ValidatorBuilderInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/ValidatorBuilderInterface.php deleted file mode 100644 index 2fd0f9c..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/ValidatorBuilderInterface.php +++ /dev/null @@ -1,193 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -use Doctrine\Common\Annotations\Reader; -use Symfony\Component\PropertyAccess\PropertyAccessorInterface; -use Symfony\Component\Translation\TranslatorInterface; -use Symfony\Component\Validator\Mapping\Cache\CacheInterface; - -/** - * A configurable builder for ValidatorInterface objects. - * - * @author Bernhard Schussek - */ -interface ValidatorBuilderInterface -{ - /** - * Adds an object initializer to the validator. - * - * @param ObjectInitializerInterface $initializer The initializer - * - * @return ValidatorBuilderInterface The builder object - */ - public function addObjectInitializer(ObjectInitializerInterface $initializer); - - /** - * Adds a list of object initializers to the validator. - * - * @param array $initializers The initializer - * - * @return ValidatorBuilderInterface The builder object - */ - public function addObjectInitializers(array $initializers); - - /** - * Adds an XML constraint mapping file to the validator. - * - * @param string $path The path to the mapping file - * - * @return ValidatorBuilderInterface The builder object - */ - public function addXmlMapping($path); - - /** - * Adds a list of XML constraint mapping files to the validator. - * - * @param array $paths The paths to the mapping files - * - * @return ValidatorBuilderInterface The builder object - */ - public function addXmlMappings(array $paths); - - /** - * Adds a YAML constraint mapping file to the validator. - * - * @param string $path The path to the mapping file - * - * @return ValidatorBuilderInterface The builder object - */ - public function addYamlMapping($path); - - /** - * Adds a list of YAML constraint mappings file to the validator. - * - * @param array $paths The paths to the mapping files - * - * @return ValidatorBuilderInterface The builder object - */ - public function addYamlMappings(array $paths); - - /** - * Enables constraint mapping using the given static method. - * - * @param string $methodName The name of the method - * - * @return ValidatorBuilderInterface The builder object - */ - public function addMethodMapping($methodName); - - /** - * Enables constraint mapping using the given static methods. - * - * @param array $methodNames The names of the methods - * - * @return ValidatorBuilderInterface The builder object - */ - public function addMethodMappings(array $methodNames); - - /** - * Enables annotation based constraint mapping. - * - * @param Reader $annotationReader The annotation reader to be used - * - * @return ValidatorBuilderInterface The builder object - */ - public function enableAnnotationMapping(Reader $annotationReader = null); - - /** - * Disables annotation based constraint mapping. - * - * @return ValidatorBuilderInterface The builder object - */ - public function disableAnnotationMapping(); - - /** - * Sets the class metadata factory used by the validator. - * - * @param MetadataFactoryInterface $metadataFactory The metadata factory - * - * @return ValidatorBuilderInterface The builder object - */ - public function setMetadataFactory(MetadataFactoryInterface $metadataFactory); - - /** - * Sets the cache for caching class metadata. - * - * @param CacheInterface $cache The cache instance - * - * @return ValidatorBuilderInterface The builder object - */ - public function setMetadataCache(CacheInterface $cache); - - /** - * Sets the constraint validator factory used by the validator. - * - * @param ConstraintValidatorFactoryInterface $validatorFactory The validator factory - * - * @return ValidatorBuilderInterface The builder object - */ - public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory); - - /** - * Sets the translator used for translating violation messages. - * - * @param TranslatorInterface $translator The translator instance - * - * @return ValidatorBuilderInterface The builder object - */ - public function setTranslator(TranslatorInterface $translator); - - /** - * Sets the default translation domain of violation messages. - * - * The same message can have different translations in different domains. - * Pass the domain that is used for violation messages by default to this - * method. - * - * @param string $translationDomain The translation domain of the violation messages - * - * @return ValidatorBuilderInterface The builder object - */ - public function setTranslationDomain($translationDomain); - - /** - * Sets the property accessor for resolving property paths. - * - * @param PropertyAccessorInterface $propertyAccessor The property accessor - * - * @return ValidatorBuilderInterface The builder object - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - */ - public function setPropertyAccessor(PropertyAccessorInterface $propertyAccessor); - - /** - * Sets the API version that the returned validator should support. - * - * @param int $apiVersion The required API version - * - * @return ValidatorBuilderInterface The builder object - * - * @see Validation::API_VERSION_2_4 - * @see Validation::API_VERSION_2_5 - * @see Validation::API_VERSION_2_5_BC - */ - public function setApiVersion($apiVersion); - - /** - * Builds and returns a new validator object. - * - * @return ValidatorInterface The built validator. - */ - public function getValidator(); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/ValidatorInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/ValidatorInterface.php deleted file mode 100644 index 03c8921..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/ValidatorInterface.php +++ /dev/null @@ -1,114 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator; - -/** - * Validates values and graphs of objects and arrays. - * - * @author Bernhard Schussek - * - * @api - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link Validator\ValidatorInterface} instead. - */ -interface ValidatorInterface -{ - /** - * Validates a value. - * - * The accepted values depend on the {@link MetadataFactoryInterface} - * implementation. - * - * The signature changed with Symfony 2.5 (see - * {@link Validator\ValidatorInterface::validate()}. This signature will be - * disabled in Symfony 3.0. - * - * @param mixed $value The value to validate - * @param array|null $groups The validation groups to validate. - * @param bool $traverse Whether to traverse the value if it is traversable. - * @param bool $deep Whether to traverse nested traversable values recursively. - * - * @return ConstraintViolationListInterface A list of constraint violations. If the - * list is empty, validation succeeded. - * - * @api - */ - public function validate($value, $groups = null, $traverse = false, $deep = false); - - /** - * Validates a property of a value against its current value. - * - * The accepted values depend on the {@link MetadataFactoryInterface} - * implementation. - * - * @param mixed $containingValue The value containing the property. - * @param string $property The name of the property to validate. - * @param array|null $groups The validation groups to validate. - * - * @return ConstraintViolationListInterface A list of constraint violations. If the - * list is empty, validation succeeded. - * - * @api - */ - public function validateProperty($containingValue, $property, $groups = null); - - /** - * Validate a property of a value against a potential value. - * - * The accepted values depend on the {@link MetadataFactoryInterface} - * implementation. - * - * @param mixed $containingValue The value containing the property. - * @param string $property The name of the property to validate - * @param string $value The value to validate against the - * constraints of the property. - * @param array|null $groups The validation groups to validate. - * - * @return ConstraintViolationListInterface A list of constraint violations. If the - * list is empty, validation succeeded. - * - * @api - */ - public function validatePropertyValue($containingValue, $property, $value, $groups = null); - - /** - * Validates a value against a constraint or a list of constraints. - * - * @param mixed $value The value to validate. - * @param Constraint|Constraint[] $constraints The constraint(s) to validate against. - * @param array|null $groups The validation groups to validate. - * - * @return ConstraintViolationListInterface A list of constraint violations. If the - * list is empty, validation succeeded. - * - * @api - * - * @deprecated Renamed to {@link Validator\ValidatorInterface::validate()} - * in Symfony 2.5. Will be removed in Symfony 3.0. - */ - public function validateValue($value, $constraints, $groups = null); - - /** - * Returns the factory for metadata instances. - * - * @return MetadataFactoryInterface The metadata factory. - * - * @api - * - * @deprecated Deprecated since version 2.5, to be removed in Symfony 3.0. - * Use {@link Validator\ValidatorInterface::getMetadataFor()} or - * {@link Validator\ValidatorInterface::hasMetadataFor()} - * instead. - */ - public function getMetadataFactory(); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php deleted file mode 100644 index b752c39..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php +++ /dev/null @@ -1,225 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Violation; - -use Symfony\Component\Translation\TranslatorInterface; -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintViolation; -use Symfony\Component\Validator\ConstraintViolationList; -use Symfony\Component\Validator\Util\PropertyPath; - -/** - * Default implementation of {@link ConstraintViolationBuilderInterface}. - * - * @since 2.5 - * @author Bernhard Schussek - * - * @internal You should not instantiate or use this class. Code against - * {@link ConstraintViolationBuilderInterface} instead. - */ -class ConstraintViolationBuilder implements ConstraintViolationBuilderInterface -{ - /** - * @var ConstraintViolationList - */ - private $violations; - - /** - * @var string - */ - private $message; - - /** - * @var array - */ - private $parameters; - - /** - * @var mixed - */ - private $root; - - /** - * @var mixed - */ - private $invalidValue; - - /** - * @var string - */ - private $propertyPath; - - /** - * @var TranslatorInterface - */ - private $translator; - - /** - * @var string|null - */ - private $translationDomain; - - /** - * @var int|null - */ - private $plural; - - /** - * @var Constraint - */ - private $constraint; - - /** - * @var mixed - */ - private $code; - - /** - * @var mixed - */ - private $cause; - - public function __construct(ConstraintViolationList $violations, Constraint $constraint, $message, array $parameters, $root, $propertyPath, $invalidValue, TranslatorInterface $translator, $translationDomain = null) - { - $this->violations = $violations; - $this->message = $message; - $this->parameters = $parameters; - $this->root = $root; - $this->propertyPath = $propertyPath; - $this->invalidValue = $invalidValue; - $this->translator = $translator; - $this->translationDomain = $translationDomain; - $this->constraint = $constraint; - } - - /** - * {@inheritdoc} - */ - public function atPath($path) - { - $this->propertyPath = PropertyPath::append($this->propertyPath, $path); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setParameter($key, $value) - { - $this->parameters[$key] = $value; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setParameters(array $parameters) - { - $this->parameters = $parameters; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setTranslationDomain($translationDomain) - { - $this->translationDomain = $translationDomain; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setInvalidValue($invalidValue) - { - $this->invalidValue = $invalidValue; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setPlural($number) - { - $this->plural = $number; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setCode($code) - { - $this->code = $code; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setCause($cause) - { - $this->cause = $cause; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addViolation() - { - if (null === $this->plural) { - $translatedMessage = $this->translator->trans( - $this->message, - $this->parameters, - $this->translationDomain - ); - } else { - try { - $translatedMessage = $this->translator->transChoice( - $this->message, - $this->plural, - $this->parameters, - $this->translationDomain# - ); - } catch (\InvalidArgumentException $e) { - $translatedMessage = $this->translator->trans( - $this->message, - $this->parameters, - $this->translationDomain - ); - } - } - - $this->violations->add(new ConstraintViolation( - $translatedMessage, - $this->message, - $this->parameters, - $this->root, - $this->propertyPath, - $this->invalidValue, - $this->plural, - $this->code, - $this->constraint, - $this->cause - )); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Violation/ConstraintViolationBuilderInterface.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Violation/ConstraintViolationBuilderInterface.php deleted file mode 100644 index 3dc270a..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Violation/ConstraintViolationBuilderInterface.php +++ /dev/null @@ -1,115 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Violation; - -/** - * Builds {@link \Symfony\Component\Validator\ConstraintViolationInterface} - * objects. - * - * Use the various methods on this interface to configure the built violation. - * Finally, call {@link addViolation()} to add the violation to the current - * execution context. - * - * @since 2.5 - * @author Bernhard Schussek - */ -interface ConstraintViolationBuilderInterface -{ - /** - * Stores the property path at which the violation should be generated. - * - * The passed path will be appended to the current property path of the - * execution context. - * - * @param string $path The property path - * - * @return ConstraintViolationBuilderInterface This builder - */ - public function atPath($path); - - /** - * Sets a parameter to be inserted into the violation message. - * - * @param string $key The name of the parameter - * @param string $value The value to be inserted in the parameter's place - * - * @return ConstraintViolationBuilderInterface This builder - */ - public function setParameter($key, $value); - - /** - * Sets all parameters to be inserted into the violation message. - * - * @param array $parameters An array with the parameter names as keys and - * the values to be inserted in their place as - * values - * - * @return ConstraintViolationBuilderInterface This builder - */ - public function setParameters(array $parameters); - - /** - * Sets the translation domain which should be used for translating the - * violation message. - * - * @param string $translationDomain The translation domain - * - * @return ConstraintViolationBuilderInterface This builder - * - * @see \Symfony\Component\Translation\TranslatorInterface - */ - public function setTranslationDomain($translationDomain); - - /** - * Sets the invalid value that caused this violation. - * - * @param mixed $invalidValue The invalid value - * - * @return ConstraintViolationBuilderInterface This builder - */ - public function setInvalidValue($invalidValue); - - /** - * Sets the number which determines how the plural form of the violation - * message is chosen when it is translated. - * - * @param int $number The number for determining the plural form - * - * @return ConstraintViolationBuilderInterface This builder - * - * @see \Symfony\Component\Translation\TranslatorInterface::transChoice() - */ - public function setPlural($number); - - /** - * Sets the violation code. - * - * @param int $code The violation code - * - * @return ConstraintViolationBuilderInterface This builder - */ - public function setCode($code); - - /** - * Sets the cause of the violation. - * - * @param mixed $cause The cause of the violation - * - * @return ConstraintViolationBuilderInterface This builder - */ - public function setCause($cause); - - /** - * Adds the violation to the current execution context. - */ - public function addViolation(); -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/Violation/LegacyConstraintViolationBuilder.php b/core/vendor/symfony/validator/Symfony/Component/Validator/Violation/LegacyConstraintViolationBuilder.php deleted file mode 100644 index 5519f42..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/Violation/LegacyConstraintViolationBuilder.php +++ /dev/null @@ -1,164 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Violation; - -use Symfony\Component\Validator\ExecutionContextInterface; - -/** - * Backwards-compatible implementation of {@link ConstraintViolationBuilderInterface}. - * - * @author Bernhard Schussek - * - * @internal You should not instantiate or use this class. Code against - * {@link ConstraintViolationBuilderInterface} instead. - * - * @deprecated This class will be removed in Symfony 3.0. - */ -class LegacyConstraintViolationBuilder implements ConstraintViolationBuilderInterface -{ - /** - * @var ExecutionContextInterface - */ - private $context; - - /** - * @var string - */ - private $message; - - /** - * @var array - */ - private $parameters; - - /** - * @var mixed - */ - private $invalidValue; - - /** - * @var string - */ - private $propertyPath; - - /** - * @var int|null - */ - private $plural; - - /** - * @var mixed - */ - private $code; - - public function __construct(ExecutionContextInterface $context, $message, array $parameters) - { - $this->context = $context; - $this->message = $message; - $this->parameters = $parameters; - $this->invalidValue = $context->getValue(); - } - - /** - * {@inheritdoc} - */ - public function atPath($path) - { - $this->propertyPath = $path; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setParameter($key, $value) - { - $this->parameters[$key] = $value; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setParameters(array $parameters) - { - $this->parameters = $parameters; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setTranslationDomain($translationDomain) - { - // can't be set in the old API - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setInvalidValue($invalidValue) - { - $this->invalidValue = $invalidValue; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setPlural($number) - { - $this->plural = $number; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setCode($code) - { - $this->code = $code; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setCause($cause) - { - // do nothing - we can't save the cause through the old API - - return $this; - } - - /** - * {@inheritdoc} - */ - public function addViolation() - { - if ($this->propertyPath) { - $this->context->addViolationAt($this->propertyPath, $this->message, $this->parameters, $this->invalidValue, $this->plural, $this->code); - - return; - } - - $this->context->addViolation($this->message, $this->parameters, $this->invalidValue, $this->plural, $this->code); - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/composer.json b/core/vendor/symfony/validator/Symfony/Component/Validator/composer.json deleted file mode 100644 index 2d781ea..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/composer.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "symfony/validator", - "type": "library", - "description": "Symfony Validator Component", - "keywords": [], - "homepage": "http://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.3", - "symfony/translation": "~2.0,>=2.0.5" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7", - "doctrine/common": "~2.3", - "symfony/http-foundation": "~2.1", - "symfony/intl": "~2.3", - "symfony/yaml": "~2.0,>=2.0.5", - "symfony/config": "~2.2", - "symfony/property-access": "~2.3", - "symfony/expression-language": "~2.4", - "doctrine/annotations": "~1.0", - "doctrine/cache": "~1.0", - "egulias/email-validator": "~1.2,>=1.2.1" - }, - "suggest": { - "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", - "doctrine/cache": "For using the default cached annotation reader and metadata cache.", - "symfony/http-foundation": "", - "symfony/intl": "", - "symfony/yaml": "", - "symfony/config": "", - "egulias/email-validator": "Strict (RFC compliant) email validation", - "symfony/property-access": "For using the 2.4 Validator API", - "symfony/expression-language": "For using the 2.4 Expression validator" - }, - "autoload": { - "psr-0": { "Symfony\\Component\\Validator\\": "" } - }, - "target-dir": "Symfony/Component/Validator", - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - } -} diff --git a/core/vendor/symfony/validator/Symfony/Component/Validator/phpunit.xml.dist b/core/vendor/symfony/validator/Symfony/Component/Validator/phpunit.xml.dist deleted file mode 100644 index 1bf4391..0000000 --- a/core/vendor/symfony/validator/Symfony/Component/Validator/phpunit.xml.dist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./vendor - ./Tests - - - - diff --git a/core/vendor/symfony/validator/Tests/ConstraintTest.php b/core/vendor/symfony/validator/Tests/ConstraintTest.php new file mode 100644 index 0000000..f63570c --- /dev/null +++ b/core/vendor/symfony/validator/Tests/ConstraintTest.php @@ -0,0 +1,209 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Tests\Fixtures\ClassConstraint; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintB; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintC; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintWithValue; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintWithValueAsDefault; + +class ConstraintTest extends \PHPUnit_Framework_TestCase +{ + public function testSetProperties() + { + $constraint = new ConstraintA(array( + 'property1' => 'foo', + 'property2' => 'bar', + )); + + $this->assertEquals('foo', $constraint->property1); + $this->assertEquals('bar', $constraint->property2); + } + + public function testSetNotExistingPropertyThrowsException() + { + $this->setExpectedException('Symfony\Component\Validator\Exception\InvalidOptionsException'); + + new ConstraintA(array( + 'foo' => 'bar', + )); + } + + public function testMagicPropertiesAreNotAllowed() + { + $constraint = new ConstraintA(); + + $this->setExpectedException('Symfony\Component\Validator\Exception\InvalidOptionsException'); + + $constraint->foo = 'bar'; + } + + public function testInvalidAndRequiredOptionsPassed() + { + $this->setExpectedException('Symfony\Component\Validator\Exception\InvalidOptionsException'); + + new ConstraintC(array( + 'option1' => 'default', + 'foo' => 'bar', + )); + } + + public function testSetDefaultProperty() + { + $constraint = new ConstraintA('foo'); + + $this->assertEquals('foo', $constraint->property2); + } + + public function testSetDefaultPropertyDoctrineStyle() + { + $constraint = new ConstraintA(array('value' => 'foo')); + + $this->assertEquals('foo', $constraint->property2); + } + + public function testSetDefaultPropertyDoctrineStylePlusOtherProperty() + { + $constraint = new ConstraintA(array('value' => 'foo', 'property1' => 'bar')); + + $this->assertEquals('foo', $constraint->property2); + $this->assertEquals('bar', $constraint->property1); + } + + public function testSetDefaultPropertyDoctrineStyleWhenDefaultPropertyIsNamedValue() + { + $constraint = new ConstraintWithValueAsDefault(array('value' => 'foo')); + + $this->assertEquals('foo', $constraint->value); + $this->assertNull($constraint->property); + } + + public function testDontSetDefaultPropertyIfValuePropertyExists() + { + $constraint = new ConstraintWithValue(array('value' => 'foo')); + + $this->assertEquals('foo', $constraint->value); + $this->assertNull($constraint->property); + } + + public function testSetUndefinedDefaultProperty() + { + $this->setExpectedException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); + + new ConstraintB('foo'); + } + + public function testRequiredOptionsMustBeDefined() + { + $this->setExpectedException('Symfony\Component\Validator\Exception\MissingOptionsException'); + + new ConstraintC(); + } + + public function testRequiredOptionsPassed() + { + new ConstraintC(array('option1' => 'default')); + } + + public function testGroupsAreConvertedToArray() + { + $constraint = new ConstraintA(array('groups' => 'Foo')); + + $this->assertEquals(array('Foo'), $constraint->groups); + } + + public function testAddDefaultGroupAddsGroup() + { + $constraint = new ConstraintA(array('groups' => 'Default')); + $constraint->addImplicitGroupName('Foo'); + $this->assertEquals(array('Default', 'Foo'), $constraint->groups); + } + + public function testAllowsSettingZeroRequiredPropertyValue() + { + $constraint = new ConstraintA(0); + $this->assertEquals(0, $constraint->property2); + } + + public function testCanCreateConstraintWithNoDefaultOptionAndEmptyArray() + { + new ConstraintB(array()); + } + + public function testGetTargetsCanBeString() + { + $constraint = new ClassConstraint(); + + $this->assertEquals('class', $constraint->getTargets()); + } + + public function testGetTargetsCanBeArray() + { + $constraint = new ConstraintA(); + + $this->assertEquals(array('property', 'class'), $constraint->getTargets()); + } + + public function testSerialize() + { + $constraint = new ConstraintA(array( + 'property1' => 'foo', + 'property2' => 'bar', + )); + + $restoredConstraint = unserialize(serialize($constraint)); + + $this->assertEquals($constraint, $restoredConstraint); + } + + public function testSerializeInitializesGroupsOptionToDefault() + { + $constraint = new ConstraintA(array( + 'property1' => 'foo', + 'property2' => 'bar', + )); + + $constraint = unserialize(serialize($constraint)); + + $expected = new ConstraintA(array( + 'property1' => 'foo', + 'property2' => 'bar', + 'groups' => 'Default', + )); + + $this->assertEquals($expected, $constraint); + } + + public function testSerializeKeepsCustomGroups() + { + $constraint = new ConstraintA(array( + 'property1' => 'foo', + 'property2' => 'bar', + 'groups' => 'MyGroup', + )); + + $constraint = unserialize(serialize($constraint)); + + $this->assertSame(array('MyGroup'), $constraint->groups); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\InvalidArgumentException + */ + public function testGetErrorNameForUnknownCode() + { + Constraint::getErrorName(1); + } +} diff --git a/core/vendor/symfony/validator/Tests/ConstraintViolationListTest.php b/core/vendor/symfony/validator/Tests/ConstraintViolationListTest.php new file mode 100644 index 0000000..30d7ff0 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/ConstraintViolationListTest.php @@ -0,0 +1,134 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests; + +use Symfony\Component\Validator\ConstraintViolation; +use Symfony\Component\Validator\ConstraintViolationList; + +class ConstraintViolationListTest extends \PHPUnit_Framework_TestCase +{ + protected $list; + + protected function setUp() + { + $this->list = new ConstraintViolationList(); + } + + protected function tearDown() + { + $this->list = null; + } + + public function testInit() + { + $this->assertCount(0, $this->list); + } + + public function testInitWithViolations() + { + $violation = $this->getViolation('Error'); + $this->list = new ConstraintViolationList(array($violation)); + + $this->assertCount(1, $this->list); + $this->assertSame($violation, $this->list[0]); + } + + public function testAdd() + { + $violation = $this->getViolation('Error'); + $this->list->add($violation); + + $this->assertCount(1, $this->list); + $this->assertSame($violation, $this->list[0]); + } + + public function testAddAll() + { + $violations = array( + 10 => $this->getViolation('Error 1'), + 20 => $this->getViolation('Error 2'), + 30 => $this->getViolation('Error 3'), + ); + $otherList = new ConstraintViolationList($violations); + $this->list->addAll($otherList); + + $this->assertCount(3, $this->list); + + $this->assertSame($violations[10], $this->list[0]); + $this->assertSame($violations[20], $this->list[1]); + $this->assertSame($violations[30], $this->list[2]); + } + + public function testIterator() + { + $violations = array( + 10 => $this->getViolation('Error 1'), + 20 => $this->getViolation('Error 2'), + 30 => $this->getViolation('Error 3'), + ); + + $this->list = new ConstraintViolationList($violations); + + // indices are reset upon adding -> array_values() + $this->assertSame(array_values($violations), iterator_to_array($this->list)); + } + + public function testArrayAccess() + { + $violation = $this->getViolation('Error'); + $this->list[] = $violation; + + $this->assertSame($violation, $this->list[0]); + $this->assertTrue(isset($this->list[0])); + + unset($this->list[0]); + + $this->assertFalse(isset($this->list[0])); + + $this->list[10] = $violation; + + $this->assertSame($violation, $this->list[10]); + $this->assertTrue(isset($this->list[10])); + } + + public function testToString() + { + $this->list = new ConstraintViolationList(array( + $this->getViolation('Error 1', 'Root'), + $this->getViolation('Error 2', 'Root', 'foo.bar'), + $this->getViolation('Error 3', 'Root', '[baz]'), + $this->getViolation('Error 4', '', 'foo.bar'), + $this->getViolation('Error 5', '', '[baz]'), + )); + + $expected = <<assertEquals($expected, (string) $this->list); + } + + protected function getViolation($message, $root = null, $propertyPath = null) + { + return new ConstraintViolation($message, $message, array(), $root, $propertyPath, null); + } +} diff --git a/core/vendor/symfony/validator/Tests/ConstraintViolationTest.php b/core/vendor/symfony/validator/Tests/ConstraintViolationTest.php new file mode 100644 index 0000000..2ceb016 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/ConstraintViolationTest.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests; + +use Symfony\Component\Validator\ConstraintViolation; + +class ConstraintViolationTest extends \PHPUnit_Framework_TestCase +{ + public function testToStringHandlesArrays() + { + $violation = new ConstraintViolation( + 'Array', + '{{ value }}', + array('{{ value }}' => array(1, 2, 3)), + 'Root', + 'property.path', + null + ); + + $expected = <<assertSame($expected, (string) $violation); + } + + public function testToStringHandlesArrayRoots() + { + $violation = new ConstraintViolation( + '42 cannot be used here', + 'this is the message template', + array(), + array('some_value' => 42), + 'some_value', + null + ); + + $expected = <<assertSame($expected, (string) $violation); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php b/core/vendor/symfony/validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php new file mode 100644 index 0000000..4013fd4 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php @@ -0,0 +1,173 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Intl\Util\IntlTestHelper; +use Symfony\Component\Validator\Constraint; + +class ComparisonTest_Class +{ + protected $value; + + public function __construct($value) + { + $this->value = $value; + } + + public function __toString() + { + return (string) $this->value; + } +} + +/** + * @author Daniel Holmes + */ +abstract class AbstractComparisonValidatorTestCase extends AbstractConstraintValidatorTest +{ + protected static function addPhp5Dot5Comparisons(array $comparisons) + { + if (version_compare(PHP_VERSION, '5.5.0-dev', '<')) { + return $comparisons; + } + + $result = $comparisons; + + // Duplicate all tests involving DateTime objects to be tested with + // DateTimeImmutable objects as well + foreach ($comparisons as $comparison) { + $add = false; + + foreach ($comparison as $i => $value) { + if ($value instanceof \DateTime) { + $comparison[$i] = new \DateTimeImmutable( + $value->format('Y-m-d H:i:s.u e'), + $value->getTimezone() + ); + $add = true; + } elseif ('DateTime' === $value) { + $comparison[$i] = 'DateTimeImmutable'; + $add = true; + } + } + + if ($add) { + $result[] = $comparison; + } + } + + return $result; + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testThrowsConstraintExceptionIfNoValueOrProperty() + { + $comparison = $this->createConstraint(array()); + + $this->validator->validate('some value', $comparison); + } + + /** + * @dataProvider provideAllValidComparisons + * + * @param mixed $dirtyValue + * @param mixed $comparisonValue + */ + public function testValidComparisonToValue($dirtyValue, $comparisonValue) + { + $constraint = $this->createConstraint(array('value' => $comparisonValue)); + + $this->validator->validate($dirtyValue, $constraint); + + $this->assertNoViolation(); + } + + /** + * @return array + */ + public function provideAllValidComparisons() + { + // The provider runs before setUp(), so we need to manually fix + // the default timezone + $this->setDefaultTimezone('UTC'); + + $comparisons = self::addPhp5Dot5Comparisons($this->provideValidComparisons()); + + $this->restoreDefaultTimezone(); + + return $comparisons; + } + + /** + * @return array + */ + abstract public function provideValidComparisons(); + + /** + * @dataProvider provideAllInvalidComparisons + * + * @param mixed $dirtyValue + * @param mixed $dirtyValueAsString + * @param mixed $comparedValue + * @param mixed $comparedValueString + * @param string $comparedValueType + */ + public function testInvalidComparisonToValue($dirtyValue, $dirtyValueAsString, $comparedValue, $comparedValueString, $comparedValueType) + { + // Conversion of dates to string differs between ICU versions + // Make sure we have the correct version loaded + if ($dirtyValue instanceof \DateTime || $dirtyValue instanceof \DateTimeInterface) { + IntlTestHelper::requireIntl($this); + } + + $constraint = $this->createConstraint(array('value' => $comparedValue)); + $constraint->message = 'Constraint Message'; + + $this->validator->validate($dirtyValue, $constraint); + + $this->buildViolation('Constraint Message') + ->setParameter('{{ value }}', $dirtyValueAsString) + ->setParameter('{{ compared_value }}', $comparedValueString) + ->setParameter('{{ compared_value_type }}', $comparedValueType) + ->assertRaised(); + } + + /** + * @return array + */ + public function provideAllInvalidComparisons() + { + // The provider runs before setUp(), so we need to manually fix + // the default timezone + $this->setDefaultTimezone('UTC'); + + $comparisons = self::addPhp5Dot5Comparisons($this->provideInvalidComparisons()); + + $this->restoreDefaultTimezone(); + + return $comparisons; + } + + /** + * @return array + */ + abstract public function provideInvalidComparisons(); + + /** + * @param array $options Options for the constraint + * + * @return Constraint + */ + abstract protected function createConstraint(array $options); +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/AbstractConstraintValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/AbstractConstraintValidatorTest.php new file mode 100644 index 0000000..55ddbfe --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/AbstractConstraintValidatorTest.php @@ -0,0 +1,445 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\NotNull; +use Symfony\Component\Validator\ConstraintValidatorInterface; +use Symfony\Component\Validator\ConstraintViolation; +use Symfony\Component\Validator\Context\ExecutionContext; +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Context\LegacyExecutionContext; +use Symfony\Component\Validator\ExecutionContextInterface as LegacyExecutionContextInterface; +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Mapping\PropertyMetadata; +use Symfony\Component\Validator\Validation; + +/** + * @since 2.5.3 + * + * @author Bernhard Schussek + */ +abstract class AbstractConstraintValidatorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var ExecutionContextInterface + */ + protected $context; + + /** + * @var ConstraintValidatorInterface + */ + protected $validator; + + protected $group; + protected $metadata; + protected $object; + protected $value; + protected $root; + protected $propertyPath; + protected $constraint; + protected $defaultTimezone; + + protected function setUp() + { + if (Validation::API_VERSION_2_5 !== $this->getApiVersion()) { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + } + + $this->group = 'MyGroup'; + $this->metadata = null; + $this->object = null; + $this->value = 'InvalidValue'; + $this->root = 'root'; + $this->propertyPath = 'property.path'; + + // Initialize the context with some constraint so that we can + // successfully build a violation. + $this->constraint = new NotNull(); + + $this->context = $this->createContext(); + $this->validator = $this->createValidator(); + $this->validator->initialize($this->context); + + \Locale::setDefault('en'); + + $this->setDefaultTimezone('UTC'); + } + + protected function tearDown() + { + $this->restoreDefaultTimezone(); + } + + protected function setDefaultTimezone($defaultTimezone) + { + // Make sure this method can not be called twice before calling + // also restoreDefaultTimezone() + if (null === $this->defaultTimezone) { + $this->defaultTimezone = date_default_timezone_get(); + date_default_timezone_set($defaultTimezone); + } + } + + protected function restoreDefaultTimezone() + { + if (null !== $this->defaultTimezone) { + date_default_timezone_set($this->defaultTimezone); + $this->defaultTimezone = null; + } + } + + protected function createContext() + { + $translator = $this->getMock('Symfony\Component\Translation\TranslatorInterface'); + $validator = $this->getMock('Symfony\Component\Validator\Validator\ValidatorInterface'); + $contextualValidator = $this->getMock('Symfony\Component\Validator\Validator\ContextualValidatorInterface'); + + switch ($this->getApiVersion()) { + case Validation::API_VERSION_2_5: + $context = new ExecutionContext( + $validator, + $this->root, + $translator + ); + break; + case Validation::API_VERSION_2_4: + case Validation::API_VERSION_2_5_BC: + $context = new LegacyExecutionContext( + $validator, + $this->root, + $this->getMock('Symfony\Component\Validator\MetadataFactoryInterface'), + $translator + ); + break; + default: + throw new \RuntimeException('Invalid API version'); + } + + $context->setGroup($this->group); + $context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath); + $context->setConstraint($this->constraint); + + $validator->expects($this->any()) + ->method('inContext') + ->with($context) + ->will($this->returnValue($contextualValidator)); + + return $context; + } + + /** + * @param mixed $message + * @param array $parameters + * @param string $propertyPath + * @param string $invalidValue + * @param null $plural + * @param null $code + * + * @return ConstraintViolation + * + * @deprecated to be removed in Symfony 3.0. Use {@link buildViolation()} instead. + */ + protected function createViolation($message, array $parameters = array(), $propertyPath = 'property.path', $invalidValue = 'InvalidValue', $plural = null, $code = null) + { + return new ConstraintViolation( + null, + $message, + $parameters, + $this->root, + $propertyPath, + $invalidValue, + $plural, + $code, + $this->constraint + ); + } + + protected function setGroup($group) + { + $this->group = $group; + $this->context->setGroup($group); + } + + protected function setObject($object) + { + $this->object = $object; + $this->metadata = is_object($object) + ? new ClassMetadata(get_class($object)) + : null; + + $this->context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath); + } + + protected function setProperty($object, $property) + { + $this->object = $object; + $this->metadata = is_object($object) + ? new PropertyMetadata(get_class($object), $property) + : null; + + $this->context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath); + } + + protected function setValue($value) + { + $this->value = $value; + $this->context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath); + } + + protected function setRoot($root) + { + $this->root = $root; + $this->context = $this->createContext(); + $this->validator->initialize($this->context); + } + + protected function setPropertyPath($propertyPath) + { + $this->propertyPath = $propertyPath; + $this->context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath); + } + + protected function expectNoValidate() + { + $validator = $this->context->getValidator()->inContext($this->context); + $validator->expects($this->never()) + ->method('atPath'); + $validator->expects($this->never()) + ->method('validate'); + } + + protected function expectValidateAt($i, $propertyPath, $value, $group) + { + $validator = $this->context->getValidator()->inContext($this->context); + $validator->expects($this->at(2 * $i)) + ->method('atPath') + ->with($propertyPath) + ->will($this->returnValue($validator)); + $validator->expects($this->at(2 * $i + 1)) + ->method('validate') + ->with($value, $this->logicalOr(null, array()), $group); + } + + protected function expectValidateValueAt($i, $propertyPath, $value, $constraints, $group = null) + { + $contextualValidator = $this->context->getValidator()->inContext($this->context); + $contextualValidator->expects($this->at(2 * $i)) + ->method('atPath') + ->with($propertyPath) + ->will($this->returnValue($contextualValidator)); + $contextualValidator->expects($this->at(2 * $i + 1)) + ->method('validate') + ->with($value, $constraints, $group); + } + + protected function assertNoViolation() + { + $this->assertSame(0, $violationsCount = count($this->context->getViolations()), sprintf('0 violation expected. Got %u.', $violationsCount)); + } + + /** + * @param mixed $message + * @param array $parameters + * @param string $propertyPath + * @param string $invalidValue + * @param null $plural + * @param null $code + * + * @deprecated To be removed in Symfony 3.0. Use + * {@link buildViolation()} instead. + */ + protected function assertViolation($message, array $parameters = array(), $propertyPath = 'property.path', $invalidValue = 'InvalidValue', $plural = null, $code = null) + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0. Use the buildViolation() method instead.', E_USER_DEPRECATED); + + $this->buildViolation($message) + ->setParameters($parameters) + ->atPath($propertyPath) + ->setInvalidValue($invalidValue) + ->setCode($code) + ->setPlural($plural) + ->assertRaised(); + } + + /** + * @param array $expected + * + * @deprecated To be removed in Symfony 3.0. Use + * {@link buildViolation()} instead. + */ + protected function assertViolations(array $expected) + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0. Use the buildViolation() method instead.', E_USER_DEPRECATED); + + $violations = $this->context->getViolations(); + + $this->assertCount(count($expected), $violations); + + $i = 0; + + foreach ($expected as $violation) { + $this->assertEquals($violation, $violations[$i++]); + } + } + + /** + * @param $message + * + * @return ConstraintViolationAssertion + */ + protected function buildViolation($message) + { + return new ConstraintViolationAssertion($this->context, $message, $this->constraint); + } + + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + abstract protected function createValidator(); +} + +/** + * @internal + */ +class ConstraintViolationAssertion +{ + /** + * @var LegacyExecutionContextInterface + */ + private $context; + + /** + * @var ConstraintViolationAssertion[] + */ + private $assertions; + + private $message; + private $parameters = array(); + private $invalidValue = 'InvalidValue'; + private $propertyPath = 'property.path'; + private $translationDomain; + private $plural; + private $code; + private $constraint; + private $cause; + + public function __construct(LegacyExecutionContextInterface $context, $message, Constraint $constraint = null, array $assertions = array()) + { + $this->context = $context; + $this->message = $message; + $this->constraint = $constraint; + $this->assertions = $assertions; + } + + public function atPath($path) + { + $this->propertyPath = $path; + + return $this; + } + + public function setParameter($key, $value) + { + $this->parameters[$key] = $value; + + return $this; + } + + public function setParameters(array $parameters) + { + $this->parameters = $parameters; + + return $this; + } + + public function setTranslationDomain($translationDomain) + { + $this->translationDomain = $translationDomain; + + return $this; + } + + public function setInvalidValue($invalidValue) + { + $this->invalidValue = $invalidValue; + + return $this; + } + + public function setPlural($number) + { + $this->plural = $number; + + return $this; + } + + public function setCode($code) + { + $this->code = $code; + + return $this; + } + + public function setCause($cause) + { + $this->cause = $cause; + + return $this; + } + + public function buildNextViolation($message) + { + $assertions = $this->assertions; + $assertions[] = $this; + + return new self($this->context, $message, $this->constraint, $assertions); + } + + public function assertRaised() + { + $expected = array(); + foreach ($this->assertions as $assertion) { + $expected[] = $assertion->getViolation(); + } + $expected[] = $this->getViolation(); + + $violations = iterator_to_array($this->context->getViolations()); + + \PHPUnit_Framework_Assert::assertSame($expectedCount = count($expected), $violationsCount = count($violations), sprintf('%u violation(s) expected. Got %u.', $expectedCount, $violationsCount)); + + reset($violations); + + foreach ($expected as $violation) { + \PHPUnit_Framework_Assert::assertEquals($violation, current($violations)); + next($violations); + } + } + + private function getViolation() + { + return new ConstraintViolation( + null, + $this->message, + $this->parameters, + $this->context->getRoot(), + $this->propertyPath, + $this->invalidValue, + $this->plural, + $this->code, + $this->constraint, + $this->cause + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/AllTest.php b/core/vendor/symfony/validator/Tests/Constraints/AllTest.php new file mode 100644 index 0000000..36b5198 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/AllTest.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\All; +use Symfony\Component\Validator\Constraints\Valid; + +/** + * @author Bernhard Schussek + */ +class AllTest extends \PHPUnit_Framework_TestCase +{ + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testRejectNonConstraints() + { + new All(array( + 'foo', + )); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testRejectValidConstraint() + { + new All(array( + new Valid(), + )); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/AllValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/AllValidatorTest.php new file mode 100644 index 0000000..57dd600 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/AllValidatorTest.php @@ -0,0 +1,93 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\All; +use Symfony\Component\Validator\Constraints\AllValidator; +use Symfony\Component\Validator\Constraints\NotNull; +use Symfony\Component\Validator\Constraints\Range; +use Symfony\Component\Validator\Validation; + +class AllValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new AllValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new All(new Range(array('min' => 4)))); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testThrowsExceptionIfNotTraversable() + { + $this->validator->validate('foo.barbar', new All(new Range(array('min' => 4)))); + } + + /** + * @dataProvider getValidArguments + */ + public function testWalkSingleConstraint($array) + { + $constraint = new Range(array('min' => 4)); + + $i = 0; + + foreach ($array as $key => $value) { + $this->expectValidateValueAt($i++, '['.$key.']', $value, array($constraint)); + } + + $this->validator->validate($array, new All($constraint)); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getValidArguments + */ + public function testWalkMultipleConstraints($array) + { + $constraint1 = new Range(array('min' => 4)); + $constraint2 = new NotNull(); + + $constraints = array($constraint1, $constraint2); + + $i = 0; + + foreach ($array as $key => $value) { + $this->expectValidateValueAt($i++, '['.$key.']', $value, array($constraint1, $constraint2)); + } + + $this->validator->validate($array, new All($constraints)); + + $this->assertNoViolation(); + } + + public function getValidArguments() + { + return array( + array(array(5, 6, 7)), + array(new \ArrayObject(array(5, 6, 7))), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/BlankValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/BlankValidatorTest.php new file mode 100644 index 0000000..a7f3d7d --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/BlankValidatorTest.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Blank; +use Symfony\Component\Validator\Constraints\BlankValidator; +use Symfony\Component\Validator\Validation; + +class BlankValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new BlankValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Blank()); + + $this->assertNoViolation(); + } + + public function testBlankIsValid() + { + $this->validator->validate('', new Blank()); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getInvalidValues + */ + public function testInvalidValues($value, $valueAsString) + { + $constraint = new Blank(array( + 'message' => 'myMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', $valueAsString) + ->assertRaised(); + } + + public function getInvalidValues() + { + return array( + array('foobar', '"foobar"'), + array(0, '0'), + array(false, 'false'), + array(1234, '1234'), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/CallbackValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/CallbackValidatorTest.php new file mode 100644 index 0000000..b53f6c6 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/CallbackValidatorTest.php @@ -0,0 +1,369 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\Callback; +use Symfony\Component\Validator\Constraints\CallbackValidator; +use Symfony\Component\Validator\ExecutionContextInterface; +use Symfony\Component\Validator\Validation; + +class CallbackValidatorTest_Class +{ + public static function validateCallback($object, ExecutionContextInterface $context) + { + $context->addViolation('Callback message', array('{{ value }}' => 'foobar')); + + return false; + } +} + +class CallbackValidatorTest_Object +{ + public function validate(ExecutionContextInterface $context) + { + $context->addViolation('My message', array('{{ value }}' => 'foobar')); + + return false; + } + + public static function validateStatic($object, ExecutionContextInterface $context) + { + $context->addViolation('Static message', array('{{ value }}' => 'baz')); + + return false; + } +} + +class CallbackValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new CallbackValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Callback()); + + $this->assertNoViolation(); + } + + public function testSingleMethod() + { + $object = new CallbackValidatorTest_Object(); + $constraint = new Callback('validate'); + + $this->validator->validate($object, $constraint); + + $this->buildViolation('My message') + ->setParameter('{{ value }}', 'foobar') + ->assertRaised(); + } + + public function testSingleMethodExplicitName() + { + $object = new CallbackValidatorTest_Object(); + $constraint = new Callback(array('callback' => 'validate')); + + $this->validator->validate($object, $constraint); + + $this->buildViolation('My message') + ->setParameter('{{ value }}', 'foobar') + ->assertRaised(); + } + + public function testSingleStaticMethod() + { + $object = new CallbackValidatorTest_Object(); + $constraint = new Callback('validateStatic'); + + $this->validator->validate($object, $constraint); + + $this->buildViolation('Static message') + ->setParameter('{{ value }}', 'baz') + ->assertRaised(); + } + + public function testClosure() + { + $object = new CallbackValidatorTest_Object(); + $constraint = new Callback(function ($object, ExecutionContextInterface $context) { + $context->addViolation('My message', array('{{ value }}' => 'foobar')); + + return false; + }); + + $this->validator->validate($object, $constraint); + + $this->buildViolation('My message') + ->setParameter('{{ value }}', 'foobar') + ->assertRaised(); + } + + public function testClosureNullObject() + { + $constraint = new Callback(function ($object, ExecutionContextInterface $context) { + $context->addViolation('My message', array('{{ value }}' => 'foobar')); + + return false; + }); + + $this->validator->validate(null, $constraint); + + $this->buildViolation('My message') + ->setParameter('{{ value }}', 'foobar') + ->assertRaised(); + } + + public function testClosureExplicitName() + { + $object = new CallbackValidatorTest_Object(); + $constraint = new Callback(array( + 'callback' => function ($object, ExecutionContextInterface $context) { + $context->addViolation('My message', array('{{ value }}' => 'foobar')); + + return false; + }, + )); + + $this->validator->validate($object, $constraint); + + $this->buildViolation('My message') + ->setParameter('{{ value }}', 'foobar') + ->assertRaised(); + } + + public function testArrayCallable() + { + $object = new CallbackValidatorTest_Object(); + $constraint = new Callback(array(__CLASS__.'_Class', 'validateCallback')); + + $this->validator->validate($object, $constraint); + + $this->buildViolation('Callback message') + ->setParameter('{{ value }}', 'foobar') + ->assertRaised(); + } + + public function testArrayCallableNullObject() + { + $constraint = new Callback(array(__CLASS__.'_Class', 'validateCallback')); + + $this->validator->validate(null, $constraint); + + $this->buildViolation('Callback message') + ->setParameter('{{ value }}', 'foobar') + ->assertRaised(); + } + + public function testArrayCallableExplicitName() + { + $object = new CallbackValidatorTest_Object(); + $constraint = new Callback(array( + 'callback' => array(__CLASS__.'_Class', 'validateCallback'), + )); + + $this->validator->validate($object, $constraint); + + $this->buildViolation('Callback message') + ->setParameter('{{ value }}', 'foobar') + ->assertRaised(); + } + + // BC with Symfony < 2.4 + /** + * @group legacy + */ + public function testLegacySingleMethodBc() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + $object = new CallbackValidatorTest_Object(); + $constraint = new Callback(array('validate')); + + $this->validator->validate($object, $constraint); + + $this->buildViolation('My message') + ->setParameter('{{ value }}', 'foobar') + ->assertRaised(); + } + + // BC with Symfony < 2.4 + /** + * @group legacy + */ + public function testLegacySingleMethodBcExplicitName() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + $object = new CallbackValidatorTest_Object(); + $constraint = new Callback(array('methods' => array('validate'))); + + $this->validator->validate($object, $constraint); + + $this->buildViolation('My message') + ->setParameter('{{ value }}', 'foobar') + ->assertRaised(); + } + + // BC with Symfony < 2.4 + /** + * @group legacy + */ + public function testLegacyMultipleMethodsBc() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + $object = new CallbackValidatorTest_Object(); + $constraint = new Callback(array('validate', 'validateStatic')); + + $this->validator->validate($object, $constraint); + + $this->buildViolation('My message') + ->setParameter('{{ value }}', 'foobar') + ->buildNextViolation('Static message') + ->setParameter('{{ value }}', 'baz') + ->assertRaised(); + } + + // BC with Symfony < 2.4 + /** + * @group legacy + */ + public function testLegacyMultipleMethodsBcExplicitName() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + $object = new CallbackValidatorTest_Object(); + $constraint = new Callback(array( + 'methods' => array('validate', 'validateStatic'), + )); + + $this->validator->validate($object, $constraint); + + $this->buildViolation('My message') + ->setParameter('{{ value }}', 'foobar') + ->buildNextViolation('Static message') + ->setParameter('{{ value }}', 'baz') + ->assertRaised(); + } + + // BC with Symfony < 2.4 + /** + * @group legacy + */ + public function testLegacySingleStaticMethodBc() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + $object = new CallbackValidatorTest_Object(); + $constraint = new Callback(array( + array(__CLASS__.'_Class', 'validateCallback'), + )); + + $this->validator->validate($object, $constraint); + + $this->buildViolation('Callback message') + ->setParameter('{{ value }}', 'foobar') + ->assertRaised(); + } + + // BC with Symfony < 2.4 + /** + * @group legacy + */ + public function testLegacySingleStaticMethodBcExplicitName() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + $object = new CallbackValidatorTest_Object(); + $constraint = new Callback(array( + 'methods' => array(array(__CLASS__.'_Class', 'validateCallback')), + )); + + $this->validator->validate($object, $constraint); + + $this->buildViolation('Callback message') + ->setParameter('{{ value }}', 'foobar') + ->assertRaised(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testExpectValidMethods() + { + $object = new CallbackValidatorTest_Object(); + + $this->validator->validate($object, new Callback(array('foobar'))); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testExpectValidCallbacks() + { + $object = new CallbackValidatorTest_Object(); + + $this->validator->validate($object, new Callback(array(array('foo', 'bar')))); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + * @group legacy + */ + public function testLegacyExpectEitherCallbackOrMethods() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + $object = new CallbackValidatorTest_Object(); + + $this->validator->validate($object, new Callback(array( + 'callback' => 'validate', + 'methods' => array('validateStatic'), + ))); + } + + public function testConstraintGetTargets() + { + $constraint = new Callback(array()); + $targets = array(Constraint::CLASS_CONSTRAINT, Constraint::PROPERTY_CONSTRAINT); + + $this->assertEquals($targets, $constraint->getTargets()); + } + + // Should succeed. Needed when defining constraints as annotations. + public function testNoConstructorArguments() + { + new Callback(); + } + + public function testAnnotationInvocationSingleValued() + { + $constraint = new Callback(array('value' => 'validateStatic')); + + $this->assertEquals(new Callback('validateStatic'), $constraint); + } + + public function testAnnotationInvocationMultiValued() + { + $constraint = new Callback(array('value' => array(__CLASS__.'_Class', 'validateCallback'))); + + $this->assertEquals(new Callback(array(__CLASS__.'_Class', 'validateCallback')), $constraint); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/CardSchemeValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/CardSchemeValidatorTest.php new file mode 100644 index 0000000..aab54e5 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/CardSchemeValidatorTest.php @@ -0,0 +1,133 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\CardScheme; +use Symfony\Component\Validator\Constraints\CardSchemeValidator; +use Symfony\Component\Validator\Validation; + +class CardSchemeValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new CardSchemeValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new CardScheme(array('schemes' => array()))); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $this->validator->validate('', new CardScheme(array('schemes' => array()))); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getValidNumbers + */ + public function testValidNumbers($scheme, $number) + { + $this->validator->validate($number, new CardScheme(array('schemes' => $scheme))); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getInvalidNumbers + */ + public function testInvalidNumbers($scheme, $number, $code) + { + $constraint = new CardScheme(array( + 'schemes' => $scheme, + 'message' => 'myMessage', + )); + + $this->validator->validate($number, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', is_string($number) ? '"'.$number.'"' : $number) + ->setCode($code) + ->assertRaised(); + } + + public function getValidNumbers() + { + return array( + array('AMEX', '378282246310005'), + array('AMEX', '371449635398431'), + array('AMEX', '378734493671000'), + array('AMEX', '347298508610146'), + array('CHINA_UNIONPAY', '6228888888888888'), + array('CHINA_UNIONPAY', '62288888888888888'), + array('CHINA_UNIONPAY', '622888888888888888'), + array('CHINA_UNIONPAY', '6228888888888888888'), + array('DINERS', '30569309025904'), + array('DINERS', '36088894118515'), + array('DINERS', '38520000023237'), + array('DISCOVER', '6011111111111117'), + array('DISCOVER', '6011000990139424'), + array('INSTAPAYMENT', '6372476031350068'), + array('INSTAPAYMENT', '6385537775789749'), + array('INSTAPAYMENT', '6393440808445746'), + array('JCB', '3530111333300000'), + array('JCB', '3566002020360505'), + array('JCB', '213112345678901'), + array('JCB', '180012345678901'), + array('LASER', '6304678107004080'), + array('LASER', '6706440607428128629'), + array('LASER', '6771656738314582216'), + array('MAESTRO', '6759744069209'), + array('MAESTRO', '5020507657408074712'), + array('MAESTRO', '6759744069209'), + array('MAESTRO', '6759744069209'), + array('MASTERCARD', '5555555555554444'), + array('MASTERCARD', '5105105105105100'), + array('VISA', '4111111111111111'), + array('VISA', '4012888888881881'), + array('VISA', '4222222222222'), + array(array('AMEX', 'VISA'), '4111111111111111'), + array(array('AMEX', 'VISA'), '378282246310005'), + array(array('JCB', 'MASTERCARD'), '5105105105105100'), + array(array('VISA', 'MASTERCARD'), '5105105105105100'), + ); + } + + public function getInvalidNumbers() + { + return array( + array('VISA', '42424242424242424242', CardScheme::INVALID_FORMAT_ERROR), + array('AMEX', '357298508610146', CardScheme::INVALID_FORMAT_ERROR), + array('DINERS', '31569309025904', CardScheme::INVALID_FORMAT_ERROR), + array('DINERS', '37088894118515', CardScheme::INVALID_FORMAT_ERROR), + array('INSTAPAYMENT', '6313440808445746', CardScheme::INVALID_FORMAT_ERROR), + array('CHINA_UNIONPAY', '622888888888888', CardScheme::INVALID_FORMAT_ERROR), + array('CHINA_UNIONPAY', '62288888888888888888', CardScheme::INVALID_FORMAT_ERROR), + array('AMEX', '30569309025904', CardScheme::INVALID_FORMAT_ERROR), // DINERS number + array('AMEX', 'invalid', CardScheme::NOT_NUMERIC_ERROR), // A string + array('AMEX', 0, CardScheme::INVALID_FORMAT_ERROR), // a lone number + array('AMEX', '0', CardScheme::INVALID_FORMAT_ERROR), // a lone number + array('AMEX', '000000000000', CardScheme::INVALID_FORMAT_ERROR), // a lone number + array('DINERS', '3056930', CardScheme::INVALID_FORMAT_ERROR), // only first part of the number + array('DISCOVER', '1117', CardScheme::INVALID_FORMAT_ERROR), // only last 4 digits + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/ChoiceValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/ChoiceValidatorTest.php new file mode 100644 index 0000000..579d6aa --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/ChoiceValidatorTest.php @@ -0,0 +1,287 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Choice; +use Symfony\Component\Validator\Constraints\ChoiceValidator; +use Symfony\Component\Validator\Validation; + +function choice_callback() +{ + return array('foo', 'bar'); +} + +class ChoiceValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new ChoiceValidator(); + } + + public static function staticCallback() + { + return array('foo', 'bar'); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectArrayIfMultipleIsTrue() + { + $constraint = new Choice(array( + 'choices' => array('foo', 'bar'), + 'multiple' => true, + )); + + $this->validator->validate('asdf', $constraint); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Choice(array('choices' => array('foo', 'bar')))); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testChoicesOrCallbackExpected() + { + $this->validator->validate('foobar', new Choice()); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testValidCallbackExpected() + { + $this->validator->validate('foobar', new Choice(array('callback' => 'abcd'))); + } + + public function testValidChoiceArray() + { + $constraint = new Choice(array('choices' => array('foo', 'bar'))); + + $this->validator->validate('bar', $constraint); + + $this->assertNoViolation(); + } + + public function testValidChoiceCallbackFunction() + { + $constraint = new Choice(array('callback' => __NAMESPACE__.'\choice_callback')); + + $this->validator->validate('bar', $constraint); + + $this->assertNoViolation(); + } + + public function testValidChoiceCallbackClosure() + { + $constraint = new Choice(array('callback' => function () { + return array('foo', 'bar'); + })); + + $this->validator->validate('bar', $constraint); + + $this->assertNoViolation(); + } + + public function testValidChoiceCallbackStaticMethod() + { + $constraint = new Choice(array('callback' => array(__CLASS__, 'staticCallback'))); + + $this->validator->validate('bar', $constraint); + + $this->assertNoViolation(); + } + + public function testValidChoiceCallbackContextMethod() + { + // search $this for "staticCallback" + $this->setObject($this); + + $constraint = new Choice(array('callback' => 'staticCallback')); + + $this->validator->validate('bar', $constraint); + + $this->assertNoViolation(); + } + + public function testMultipleChoices() + { + $constraint = new Choice(array( + 'choices' => array('foo', 'bar', 'baz'), + 'multiple' => true, + )); + + $this->validator->validate(array('baz', 'bar'), $constraint); + + $this->assertNoViolation(); + } + + public function testInvalidChoice() + { + $constraint = new Choice(array( + 'choices' => array('foo', 'bar'), + 'message' => 'myMessage', + )); + + $this->validator->validate('baz', $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"baz"') + ->setCode(Choice::NO_SUCH_CHOICE_ERROR) + ->assertRaised(); + } + + public function testInvalidChoiceMultiple() + { + $constraint = new Choice(array( + 'choices' => array('foo', 'bar'), + 'multipleMessage' => 'myMessage', + 'multiple' => true, + )); + + $this->validator->validate(array('foo', 'baz'), $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"baz"') + ->setInvalidValue('baz') + ->setCode(Choice::NO_SUCH_CHOICE_ERROR) + ->assertRaised(); + } + + public function testTooFewChoices() + { + $constraint = new Choice(array( + 'choices' => array('foo', 'bar', 'moo', 'maa'), + 'multiple' => true, + 'min' => 2, + 'minMessage' => 'myMessage', + )); + + $value = array('foo'); + + $this->setValue($value); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ limit }}', 2) + ->setInvalidValue($value) + ->setPlural(2) + ->setCode(Choice::TOO_FEW_ERROR) + ->assertRaised(); + } + + public function testTooManyChoices() + { + $constraint = new Choice(array( + 'choices' => array('foo', 'bar', 'moo', 'maa'), + 'multiple' => true, + 'max' => 2, + 'maxMessage' => 'myMessage', + )); + + $value = array('foo', 'bar', 'moo'); + + $this->setValue($value); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ limit }}', 2) + ->setInvalidValue($value) + ->setPlural(2) + ->setCode(Choice::TOO_MANY_ERROR) + ->assertRaised(); + } + + public function testNonStrict() + { + $constraint = new Choice(array( + 'choices' => array(1, 2), + 'strict' => false, + )); + + $this->validator->validate('2', $constraint); + $this->validator->validate(2, $constraint); + + $this->assertNoViolation(); + } + + public function testStrictAllowsExactValue() + { + $constraint = new Choice(array( + 'choices' => array(1, 2), + 'strict' => true, + )); + + $this->validator->validate(2, $constraint); + + $this->assertNoViolation(); + } + + public function testStrictDisallowsDifferentType() + { + $constraint = new Choice(array( + 'choices' => array(1, 2), + 'strict' => true, + 'message' => 'myMessage', + )); + + $this->validator->validate('2', $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"2"') + ->setCode(Choice::NO_SUCH_CHOICE_ERROR) + ->assertRaised(); + } + + public function testNonStrictWithMultipleChoices() + { + $constraint = new Choice(array( + 'choices' => array(1, 2, 3), + 'multiple' => true, + 'strict' => false, + )); + + $this->validator->validate(array('2', 3), $constraint); + + $this->assertNoViolation(); + } + + public function testStrictWithMultipleChoices() + { + $constraint = new Choice(array( + 'choices' => array(1, 2, 3), + 'multiple' => true, + 'strict' => true, + 'multipleMessage' => 'myMessage', + )); + + $this->validator->validate(array(2, '3'), $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"3"') + ->setInvalidValue('3') + ->setCode(Choice::NO_SUCH_CHOICE_ERROR) + ->assertRaised(); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/CollectionTest.php b/core/vendor/symfony/validator/Tests/Constraints/CollectionTest.php new file mode 100644 index 0000000..79f50b0 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/CollectionTest.php @@ -0,0 +1,112 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Collection; +use Symfony\Component\Validator\Constraints\Email; +use Symfony\Component\Validator\Constraints\Optional; +use Symfony\Component\Validator\Constraints\Required; +use Symfony\Component\Validator\Constraints\Valid; + +/** + * @author Bernhard Schussek + */ +class CollectionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testRejectInvalidFieldsOption() + { + new Collection(array( + 'fields' => 'foo', + )); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testRejectNonConstraints() + { + new Collection(array( + 'foo' => 'bar', + )); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testRejectValidConstraint() + { + new Collection(array( + 'foo' => new Valid(), + )); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testRejectValidConstraintWithinOptional() + { + new Collection(array( + 'foo' => new Optional(new Valid()), + )); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testRejectValidConstraintWithinRequired() + { + new Collection(array( + 'foo' => new Required(new Valid()), + )); + } + + public function testAcceptOptionalConstraintAsOneElementArray() + { + $collection1 = new Collection(array( + 'fields' => array( + 'alternate_email' => array( + new Optional(new Email()), + ), + ), + )); + + $collection2 = new Collection(array( + 'fields' => array( + 'alternate_email' => new Optional(new Email()), + ), + )); + + $this->assertEquals($collection1, $collection2); + } + + public function testAcceptRequiredConstraintAsOneElementArray() + { + $collection1 = new Collection(array( + 'fields' => array( + 'alternate_email' => array( + new Required(new Email()), + ), + ), + )); + + $collection2 = new Collection(array( + 'fields' => array( + 'alternate_email' => new Required(new Email()), + ), + )); + + $this->assertEquals($collection1, $collection2); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/CollectionValidatorArrayObjectTest.php b/core/vendor/symfony/validator/Tests/Constraints/CollectionValidatorArrayObjectTest.php new file mode 100644 index 0000000..a3c4b33 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/CollectionValidatorArrayObjectTest.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +class CollectionValidatorArrayObjectTest extends CollectionValidatorTest +{ + public function prepareTestData(array $contents) + { + return new \ArrayObject($contents); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/CollectionValidatorArrayTest.php b/core/vendor/symfony/validator/Tests/Constraints/CollectionValidatorArrayTest.php new file mode 100644 index 0000000..7517d0c --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/CollectionValidatorArrayTest.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +class CollectionValidatorArrayTest extends CollectionValidatorTest +{ + public function prepareTestData(array $contents) + { + return $contents; + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/CollectionValidatorCustomArrayObjectTest.php b/core/vendor/symfony/validator/Tests/Constraints/CollectionValidatorCustomArrayObjectTest.php new file mode 100644 index 0000000..3d4c296 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/CollectionValidatorCustomArrayObjectTest.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Tests\Fixtures\CustomArrayObject; + +class CollectionValidatorCustomArrayObjectTest extends CollectionValidatorTest +{ + public function prepareTestData(array $contents) + { + return new CustomArrayObject($contents); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/CollectionValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/CollectionValidatorTest.php new file mode 100644 index 0000000..0376814 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/CollectionValidatorTest.php @@ -0,0 +1,389 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Collection; +use Symfony\Component\Validator\Constraints\CollectionValidator; +use Symfony\Component\Validator\Constraints\NotNull; +use Symfony\Component\Validator\Constraints\Optional; +use Symfony\Component\Validator\Constraints\Range; +use Symfony\Component\Validator\Constraints\Required; +use Symfony\Component\Validator\Validation; + +abstract class CollectionValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new CollectionValidator(); + } + + abstract protected function prepareTestData(array $contents); + + public function testNullIsValid() + { + $this->validator->validate(null, new Collection(array('fields' => array( + 'foo' => new Range(array('min' => 4)), + )))); + + $this->assertNoViolation(); + } + + public function testFieldsAsDefaultOption() + { + $constraint = new Range(array('min' => 4)); + + $data = $this->prepareTestData(array('foo' => 'foobar')); + + $this->expectValidateValueAt(0, '[foo]', $data['foo'], array($constraint)); + + $this->validator->validate($data, new Collection(array( + 'foo' => $constraint, + ))); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testThrowsExceptionIfNotTraversable() + { + $this->validator->validate('foobar', new Collection(array('fields' => array( + 'foo' => new Range(array('min' => 4)), + )))); + } + + public function testWalkSingleConstraint() + { + $constraint = new Range(array('min' => 4)); + + $array = array( + 'foo' => 3, + 'bar' => 5, + ); + + $i = 0; + + foreach ($array as $key => $value) { + $this->expectValidateValueAt($i++, '['.$key.']', $value, array($constraint)); + } + + $data = $this->prepareTestData($array); + + $this->validator->validate($data, new Collection(array( + 'fields' => array( + 'foo' => $constraint, + 'bar' => $constraint, + ), + ))); + + $this->assertNoViolation(); + } + + public function testWalkMultipleConstraints() + { + $constraints = array( + new Range(array('min' => 4)), + new NotNull(), + ); + + $array = array( + 'foo' => 3, + 'bar' => 5, + ); + + $i = 0; + + foreach ($array as $key => $value) { + $this->expectValidateValueAt($i++, '['.$key.']', $value, $constraints); + } + + $data = $this->prepareTestData($array); + + $this->validator->validate($data, new Collection(array( + 'fields' => array( + 'foo' => $constraints, + 'bar' => $constraints, + ), + ))); + + $this->assertNoViolation(); + } + + public function testExtraFieldsDisallowed() + { + $constraint = new Range(array('min' => 4)); + + $data = $this->prepareTestData(array( + 'foo' => 5, + 'baz' => 6, + )); + + $this->expectValidateValueAt(0, '[foo]', $data['foo'], array($constraint)); + + $this->validator->validate($data, new Collection(array( + 'fields' => array( + 'foo' => $constraint, + ), + 'extraFieldsMessage' => 'myMessage', + ))); + + $this->buildViolation('myMessage') + ->setParameter('{{ field }}', '"baz"') + ->atPath('property.path[baz]') + ->setInvalidValue(6) + ->setCode(Collection::NO_SUCH_FIELD_ERROR) + ->assertRaised(); + } + + // bug fix + public function testNullNotConsideredExtraField() + { + $data = $this->prepareTestData(array( + 'foo' => null, + )); + + $constraint = new Range(array('min' => 4)); + + $this->expectValidateValueAt(0, '[foo]', $data['foo'], array($constraint)); + + $this->validator->validate($data, new Collection(array( + 'fields' => array( + 'foo' => $constraint, + ), + ))); + + $this->assertNoViolation(); + } + + public function testExtraFieldsAllowed() + { + $data = $this->prepareTestData(array( + 'foo' => 5, + 'bar' => 6, + )); + + $constraint = new Range(array('min' => 4)); + + $this->expectValidateValueAt(0, '[foo]', $data['foo'], array($constraint)); + + $this->validator->validate($data, new Collection(array( + 'fields' => array( + 'foo' => $constraint, + ), + 'allowExtraFields' => true, + ))); + + $this->assertNoViolation(); + } + + public function testMissingFieldsDisallowed() + { + $data = $this->prepareTestData(array()); + + $constraint = new Range(array('min' => 4)); + + $this->validator->validate($data, new Collection(array( + 'fields' => array( + 'foo' => $constraint, + ), + 'missingFieldsMessage' => 'myMessage', + ))); + + $this->buildViolation('myMessage') + ->setParameter('{{ field }}', '"foo"') + ->atPath('property.path[foo]') + ->setInvalidValue(null) + ->setCode(Collection::MISSING_FIELD_ERROR) + ->assertRaised(); + } + + public function testMissingFieldsAllowed() + { + $data = $this->prepareTestData(array()); + + $constraint = new Range(array('min' => 4)); + + $this->validator->validate($data, new Collection(array( + 'fields' => array( + 'foo' => $constraint, + ), + 'allowMissingFields' => true, + ))); + + $this->assertNoViolation(); + } + + public function testOptionalFieldPresent() + { + $data = $this->prepareTestData(array( + 'foo' => null, + )); + + $this->validator->validate($data, new Collection(array( + 'foo' => new Optional(), + ))); + + $this->assertNoViolation(); + } + + public function testOptionalFieldNotPresent() + { + $data = $this->prepareTestData(array()); + + $this->validator->validate($data, new Collection(array( + 'foo' => new Optional(), + ))); + + $this->assertNoViolation(); + } + + public function testOptionalFieldSingleConstraint() + { + $array = array( + 'foo' => 5, + ); + + $constraint = new Range(array('min' => 4)); + + $this->expectValidateValueAt(0, '[foo]', $array['foo'], array($constraint)); + + $data = $this->prepareTestData($array); + + $this->validator->validate($data, new Collection(array( + 'foo' => new Optional($constraint), + ))); + + $this->assertNoViolation(); + } + + public function testOptionalFieldMultipleConstraints() + { + $array = array( + 'foo' => 5, + ); + + $constraints = array( + new NotNull(), + new Range(array('min' => 4)), + ); + + $this->expectValidateValueAt(0, '[foo]', $array['foo'], $constraints); + + $data = $this->prepareTestData($array); + + $this->validator->validate($data, new Collection(array( + 'foo' => new Optional($constraints), + ))); + + $this->assertNoViolation(); + } + + public function testRequiredFieldPresent() + { + $data = $this->prepareTestData(array( + 'foo' => null, + )); + + $this->validator->validate($data, new Collection(array( + 'foo' => new Required(), + ))); + + $this->assertNoViolation(); + } + + public function testRequiredFieldNotPresent() + { + $data = $this->prepareTestData(array()); + + $this->validator->validate($data, new Collection(array( + 'fields' => array( + 'foo' => new Required(), + ), + 'missingFieldsMessage' => 'myMessage', + ))); + + $this->buildViolation('myMessage') + ->setParameter('{{ field }}', '"foo"') + ->atPath('property.path[foo]') + ->setInvalidValue(null) + ->setCode(Collection::MISSING_FIELD_ERROR) + ->assertRaised(); + } + + public function testRequiredFieldSingleConstraint() + { + $array = array( + 'foo' => 5, + ); + + $constraint = new Range(array('min' => 4)); + + $this->expectValidateValueAt(0, '[foo]', $array['foo'], array($constraint)); + + $data = $this->prepareTestData($array); + + $this->validator->validate($data, new Collection(array( + 'foo' => new Required($constraint), + ))); + + $this->assertNoViolation(); + } + + public function testRequiredFieldMultipleConstraints() + { + $array = array( + 'foo' => 5, + ); + + $constraints = array( + new NotNull(), + new Range(array('min' => 4)), + ); + + $this->expectValidateValueAt(0, '[foo]', $array['foo'], $constraints); + + $data = $this->prepareTestData($array); + + $this->validator->validate($data, new Collection(array( + 'foo' => new Required($constraints), + ))); + + $this->assertNoViolation(); + } + + public function testObjectShouldBeLeftUnchanged() + { + $value = new \ArrayObject(array( + 'foo' => 3, + )); + + $constraint = new Range(array('min' => 2)); + + $this->expectValidateValueAt(0, '[foo]', $value['foo'], array($constraint)); + + $this->validator->validate($value, new Collection(array( + 'fields' => array( + 'foo' => $constraint, + ), + ))); + + $this->assertEquals(array( + 'foo' => 3, + ), (array) $value); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/CompositeTest.php b/core/vendor/symfony/validator/Tests/Constraints/CompositeTest.php new file mode 100644 index 0000000..21cb461 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/CompositeTest.php @@ -0,0 +1,137 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Composite; +use Symfony\Component\Validator\Constraints\NotBlank; +use Symfony\Component\Validator\Constraints\NotNull; +use Symfony\Component\Validator\Constraints\Valid; + +class ConcreteComposite extends Composite +{ + public $constraints; + + protected function getCompositeOption() + { + return 'constraints'; + } + + public function getDefaultOption() + { + return 'constraints'; + } +} + +/** + * @since 2.6 + * @author Bernhard Schussek + */ +class CompositeTest extends \PHPUnit_Framework_TestCase +{ + public function testMergeNestedGroupsIfNoExplicitParentGroup() + { + $constraint = new ConcreteComposite(array( + new NotNull(array('groups' => 'Default')), + new NotBlank(array('groups' => array('Default', 'Strict'))), + )); + + $this->assertEquals(array('Default', 'Strict'), $constraint->groups); + $this->assertEquals(array('Default'), $constraint->constraints[0]->groups); + $this->assertEquals(array('Default', 'Strict'), $constraint->constraints[1]->groups); + } + + public function testSetImplicitNestedGroupsIfExplicitParentGroup() + { + $constraint = new ConcreteComposite(array( + 'constraints' => array( + new NotNull(), + new NotBlank(), + ), + 'groups' => array('Default', 'Strict'), + )); + + $this->assertEquals(array('Default', 'Strict'), $constraint->groups); + $this->assertEquals(array('Default', 'Strict'), $constraint->constraints[0]->groups); + $this->assertEquals(array('Default', 'Strict'), $constraint->constraints[1]->groups); + } + + public function testExplicitNestedGroupsMustBeSubsetOfExplicitParentGroups() + { + $constraint = new ConcreteComposite(array( + 'constraints' => array( + new NotNull(array('groups' => 'Default')), + new NotBlank(array('groups' => 'Strict')), + ), + 'groups' => array('Default', 'Strict'), + )); + + $this->assertEquals(array('Default', 'Strict'), $constraint->groups); + $this->assertEquals(array('Default'), $constraint->constraints[0]->groups); + $this->assertEquals(array('Strict'), $constraint->constraints[1]->groups); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testFailIfExplicitNestedGroupsNotSubsetOfExplicitParentGroups() + { + new ConcreteComposite(array( + 'constraints' => array( + new NotNull(array('groups' => array('Default', 'Foobar'))), + ), + 'groups' => array('Default', 'Strict'), + )); + } + + public function testImplicitGroupNamesAreForwarded() + { + $constraint = new ConcreteComposite(array( + new NotNull(array('groups' => 'Default')), + new NotBlank(array('groups' => 'Strict')), + )); + + $constraint->addImplicitGroupName('ImplicitGroup'); + + $this->assertEquals(array('Default', 'Strict', 'ImplicitGroup'), $constraint->groups); + $this->assertEquals(array('Default', 'ImplicitGroup'), $constraint->constraints[0]->groups); + $this->assertEquals(array('Strict'), $constraint->constraints[1]->groups); + } + + public function testSingleConstraintsAccepted() + { + $nestedConstraint = new NotNull(); + $constraint = new ConcreteComposite($nestedConstraint); + + $this->assertEquals(array($nestedConstraint), $constraint->constraints); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testFailIfNoConstraint() + { + new ConcreteComposite(array( + new NotNull(array('groups' => 'Default')), + 'NotBlank', + )); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testValidCantBeNested() + { + new ConcreteComposite(array( + new Valid(), + )); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/CountValidatorArrayTest.php b/core/vendor/symfony/validator/Tests/Constraints/CountValidatorArrayTest.php new file mode 100644 index 0000000..5f562e7 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/CountValidatorArrayTest.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +/** + * @author Bernhard Schussek + */ +class CountValidatorArrayTest extends CountValidatorTest +{ + protected function createCollection(array $content) + { + return $content; + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/CountValidatorCountableTest.php b/core/vendor/symfony/validator/Tests/Constraints/CountValidatorCountableTest.php new file mode 100644 index 0000000..7d46967 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/CountValidatorCountableTest.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Tests\Fixtures\Countable; + +/** + * @author Bernhard Schussek + */ +class CountValidatorCountableTest extends CountValidatorTest +{ + protected function createCollection(array $content) + { + return new Countable($content); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/CountValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/CountValidatorTest.php new file mode 100644 index 0000000..6713166 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/CountValidatorTest.php @@ -0,0 +1,203 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Count; +use Symfony\Component\Validator\Constraints\CountValidator; +use Symfony\Component\Validator\Validation; + +/** + * @author Bernhard Schussek + */ +abstract class CountValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new CountValidator(); + } + + abstract protected function createCollection(array $content); + + public function testNullIsValid() + { + $this->validator->validate(null, new Count(6)); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsCountableType() + { + $this->validator->validate(new \stdClass(), new Count(5)); + } + + public function getThreeOrLessElements() + { + return array( + array($this->createCollection(array(1))), + array($this->createCollection(array(1, 2))), + array($this->createCollection(array(1, 2, 3))), + array($this->createCollection(array('a' => 1, 'b' => 2, 'c' => 3))), + ); + } + + public function getFourElements() + { + return array( + array($this->createCollection(array(1, 2, 3, 4))), + array($this->createCollection(array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4))), + ); + } + + public function getFiveOrMoreElements() + { + return array( + array($this->createCollection(array(1, 2, 3, 4, 5))), + array($this->createCollection(array(1, 2, 3, 4, 5, 6))), + array($this->createCollection(array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5))), + ); + } + + /** + * @dataProvider getThreeOrLessElements + */ + public function testValidValuesMax($value) + { + $constraint = new Count(array('max' => 3)); + $this->validator->validate($value, $constraint); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getFiveOrMoreElements + */ + public function testValidValuesMin($value) + { + $constraint = new Count(array('min' => 5)); + $this->validator->validate($value, $constraint); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getFourElements + */ + public function testValidValuesExact($value) + { + $constraint = new Count(4); + $this->validator->validate($value, $constraint); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getFiveOrMoreElements + */ + public function testTooManyValues($value) + { + $constraint = new Count(array( + 'max' => 4, + 'maxMessage' => 'myMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ count }}', count($value)) + ->setParameter('{{ limit }}', 4) + ->setInvalidValue($value) + ->setPlural(4) + ->setCode(Count::TOO_MANY_ERROR) + ->assertRaised(); + } + + /** + * @dataProvider getThreeOrLessElements + */ + public function testTooFewValues($value) + { + $constraint = new Count(array( + 'min' => 4, + 'minMessage' => 'myMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ count }}', count($value)) + ->setParameter('{{ limit }}', 4) + ->setInvalidValue($value) + ->setPlural(4) + ->setCode(Count::TOO_FEW_ERROR) + ->assertRaised(); + } + + /** + * @dataProvider getFiveOrMoreElements + */ + public function testTooManyValuesExact($value) + { + $constraint = new Count(array( + 'min' => 4, + 'max' => 4, + 'exactMessage' => 'myMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ count }}', count($value)) + ->setParameter('{{ limit }}', 4) + ->setInvalidValue($value) + ->setPlural(4) + ->setCode(Count::TOO_MANY_ERROR) + ->assertRaised(); + } + + /** + * @dataProvider getThreeOrLessElements + */ + public function testTooFewValuesExact($value) + { + $constraint = new Count(array( + 'min' => 4, + 'max' => 4, + 'exactMessage' => 'myMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ count }}', count($value)) + ->setParameter('{{ limit }}', 4) + ->setInvalidValue($value) + ->setPlural(4) + ->setCode(Count::TOO_FEW_ERROR) + ->assertRaised(); + } + + public function testDefaultOption() + { + $constraint = new Count(5); + + $this->assertEquals(5, $constraint->min); + $this->assertEquals(5, $constraint->max); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/CountryValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/CountryValidatorTest.php new file mode 100644 index 0000000..b133511 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/CountryValidatorTest.php @@ -0,0 +1,116 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Intl\Util\IntlTestHelper; +use Symfony\Component\Validator\Constraints\Country; +use Symfony\Component\Validator\Constraints\CountryValidator; +use Symfony\Component\Validator\Validation; + +class CountryValidatorTest extends AbstractConstraintValidatorTest +{ + protected function setUp() + { + IntlTestHelper::requireFullIntl($this); + + parent::setUp(); + } + + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new CountryValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Country()); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $this->validator->validate('', new Country()); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsStringCompatibleType() + { + $this->validator->validate(new \stdClass(), new Country()); + } + + /** + * @dataProvider getValidCountries + */ + public function testValidCountries($country) + { + $this->validator->validate($country, new Country()); + + $this->assertNoViolation(); + } + + public function getValidCountries() + { + return array( + array('GB'), + array('AT'), + array('MY'), + ); + } + + /** + * @dataProvider getInvalidCountries + */ + public function testInvalidCountries($country) + { + $constraint = new Country(array( + 'message' => 'myMessage', + )); + + $this->validator->validate($country, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$country.'"') + ->assertRaised(); + } + + public function getInvalidCountries() + { + return array( + array('foobar'), + array('EN'), + ); + } + + public function testValidateUsingCountrySpecificLocale() + { + // in order to test with "en_GB" + IntlTestHelper::requireFullIntl($this); + + \Locale::setDefault('en_GB'); + + $existingCountry = 'GB'; + + $this->validator->validate($existingCountry, new Country()); + + $this->assertNoViolation(); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/CurrencyValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/CurrencyValidatorTest.php new file mode 100644 index 0000000..e5bb060 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/CurrencyValidatorTest.php @@ -0,0 +1,116 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Intl\Util\IntlTestHelper; +use Symfony\Component\Validator\Constraints\Currency; +use Symfony\Component\Validator\Constraints\CurrencyValidator; +use Symfony\Component\Validator\Validation; + +class CurrencyValidatorTest extends AbstractConstraintValidatorTest +{ + protected function setUp() + { + IntlTestHelper::requireFullIntl($this); + + parent::setUp(); + } + + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new CurrencyValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Currency()); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $this->validator->validate('', new Currency()); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsStringCompatibleType() + { + $this->validator->validate(new \stdClass(), new Currency()); + } + + /** + * @dataProvider getValidCurrencies + */ + public function testValidCurrencies($currency) + { + $this->validator->validate($currency, new Currency()); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getValidCurrencies + **/ + public function testValidCurrenciesWithCountrySpecificLocale($currency) + { + \Locale::setDefault('en_GB'); + + $this->validator->validate($currency, new Currency()); + + $this->assertNoViolation(); + } + + public function getValidCurrencies() + { + return array( + array('EUR'), + array('USD'), + array('SIT'), + array('AUD'), + array('CAD'), + ); + } + + /** + * @dataProvider getInvalidCurrencies + */ + public function testInvalidCurrencies($currency) + { + $constraint = new Currency(array( + 'message' => 'myMessage', + )); + + $this->validator->validate($currency, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$currency.'"') + ->assertRaised(); + } + + public function getInvalidCurrencies() + { + return array( + array('EN'), + array('foobar'), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/DateTimeValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/DateTimeValidatorTest.php new file mode 100644 index 0000000..25d88aa --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/DateTimeValidatorTest.php @@ -0,0 +1,110 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\DateTime; +use Symfony\Component\Validator\Constraints\DateTimeValidator; +use Symfony\Component\Validator\Validation; + +class DateTimeValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new DateTimeValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new DateTime()); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $this->validator->validate('', new DateTime()); + + $this->assertNoViolation(); + } + + public function testDateTimeClassIsValid() + { + $this->validator->validate(new \DateTime(), new DateTime()); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsStringCompatibleType() + { + $this->validator->validate(new \stdClass(), new DateTime()); + } + + /** + * @dataProvider getValidDateTimes + */ + public function testValidDateTimes($dateTime) + { + $this->validator->validate($dateTime, new DateTime()); + + $this->assertNoViolation(); + } + + public function getValidDateTimes() + { + return array( + array('2010-01-01 01:02:03'), + array('1955-12-12 00:00:00'), + array('2030-05-31 23:59:59'), + ); + } + + /** + * @dataProvider getInvalidDateTimes + */ + public function testInvalidDateTimes($dateTime, $code) + { + $constraint = new DateTime(array( + 'message' => 'myMessage', + )); + + $this->validator->validate($dateTime, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$dateTime.'"') + ->setCode($code) + ->assertRaised(); + } + + public function getInvalidDateTimes() + { + return array( + array('foobar', DateTime::INVALID_FORMAT_ERROR), + array('2010-01-01', DateTime::INVALID_FORMAT_ERROR), + array('00:00:00', DateTime::INVALID_FORMAT_ERROR), + array('2010-01-01 00:00', DateTime::INVALID_FORMAT_ERROR), + array('2010-13-01 00:00:00', DateTime::INVALID_DATE_ERROR), + array('2010-04-32 00:00:00', DateTime::INVALID_DATE_ERROR), + array('2010-02-29 00:00:00', DateTime::INVALID_DATE_ERROR), + array('2010-01-01 24:00:00', DateTime::INVALID_TIME_ERROR), + array('2010-01-01 00:60:00', DateTime::INVALID_TIME_ERROR), + array('2010-01-01 00:00:60', DateTime::INVALID_TIME_ERROR), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/DateValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/DateValidatorTest.php new file mode 100644 index 0000000..21f0a2d --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/DateValidatorTest.php @@ -0,0 +1,106 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Date; +use Symfony\Component\Validator\Constraints\DateValidator; +use Symfony\Component\Validator\Validation; + +class DateValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new DateValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Date()); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $this->validator->validate('', new Date()); + + $this->assertNoViolation(); + } + + public function testDateTimeClassIsValid() + { + $this->validator->validate(new \DateTime(), new Date()); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsStringCompatibleType() + { + $this->validator->validate(new \stdClass(), new Date()); + } + + /** + * @dataProvider getValidDates + */ + public function testValidDates($date) + { + $this->validator->validate($date, new Date()); + + $this->assertNoViolation(); + } + + public function getValidDates() + { + return array( + array('2010-01-01'), + array('1955-12-12'), + array('2030-05-31'), + ); + } + + /** + * @dataProvider getInvalidDates + */ + public function testInvalidDates($date, $code) + { + $constraint = new Date(array( + 'message' => 'myMessage', + )); + + $this->validator->validate($date, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$date.'"') + ->setCode($code) + ->assertRaised(); + } + + public function getInvalidDates() + { + return array( + array('foobar', Date::INVALID_FORMAT_ERROR), + array('foobar 2010-13-01', Date::INVALID_FORMAT_ERROR), + array('2010-13-01 foobar', Date::INVALID_FORMAT_ERROR), + array('2010-13-01', Date::INVALID_DATE_ERROR), + array('2010-04-32', Date::INVALID_DATE_ERROR), + array('2010-02-29', Date::INVALID_DATE_ERROR), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/EmailValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/EmailValidatorTest.php new file mode 100644 index 0000000..0361333 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/EmailValidatorTest.php @@ -0,0 +1,105 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Email; +use Symfony\Component\Validator\Constraints\EmailValidator; +use Symfony\Component\Validator\Validation; + +class EmailValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new EmailValidator(false); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Email()); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $this->validator->validate('', new Email()); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsStringCompatibleType() + { + $this->validator->validate(new \stdClass(), new Email()); + } + + /** + * @dataProvider getValidEmails + */ + public function testValidEmails($email) + { + $this->validator->validate($email, new Email()); + + $this->assertNoViolation(); + } + + public function getValidEmails() + { + return array( + array('fabien@symfony.com'), + array('example@example.co.uk'), + array('fabien_potencier@example.fr'), + ); + } + + /** + * @dataProvider getInvalidEmails + */ + public function testInvalidEmails($email) + { + $constraint = new Email(array( + 'message' => 'myMessage', + )); + + $this->validator->validate($email, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$email.'"') + ->setCode(Email::INVALID_FORMAT_ERROR) + ->assertRaised(); + } + + public function getInvalidEmails() + { + return array( + array('example'), + array('example@'), + array('example@localhost'), + ); + } + + public function testStrict() + { + $constraint = new Email(array('strict' => true)); + + $this->validator->validate('example@localhost', $constraint); + + $this->assertNoViolation(); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/EqualToValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/EqualToValidatorTest.php new file mode 100644 index 0000000..c20db15 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/EqualToValidatorTest.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\EqualTo; +use Symfony\Component\Validator\Constraints\EqualToValidator; +use Symfony\Component\Validator\Validation; + +/** + * @author Daniel Holmes + */ +class EqualToValidatorTest extends AbstractComparisonValidatorTestCase +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new EqualToValidator(); + } + + protected function createConstraint(array $options) + { + return new EqualTo($options); + } + + /** + * {@inheritdoc} + */ + public function provideValidComparisons() + { + return array( + array(3, 3), + array(3, '3'), + array('a', 'a'), + array(new \DateTime('2000-01-01'), new \DateTime('2000-01-01')), + array(new \DateTime('2000-01-01'), '2000-01-01'), + array(new \DateTime('2000-01-01 UTC'), '2000-01-01 UTC'), + array(new ComparisonTest_Class(5), new ComparisonTest_Class(5)), + array(null, 1), + ); + } + + /** + * {@inheritdoc} + */ + public function provideInvalidComparisons() + { + return array( + array(1, '1', 2, '2', 'integer'), + array('22', '"22"', '333', '"333"', 'string'), + array(new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array(new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array(new \DateTime('2001-01-01 UTC'), 'Jan 1, 2001, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array(new ComparisonTest_Class(4), '4', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/ExpressionValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/ExpressionValidatorTest.php new file mode 100644 index 0000000..3d4ef75 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/ExpressionValidatorTest.php @@ -0,0 +1,214 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\PropertyAccess\PropertyAccess; +use Symfony\Component\Validator\Constraints\Expression; +use Symfony\Component\Validator\Constraints\ExpressionValidator; +use Symfony\Component\Validator\Tests\Fixtures\Entity; +use Symfony\Component\Validator\Validation; + +class ExpressionValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new ExpressionValidator(PropertyAccess::createPropertyAccessor()); + } + + public function testExpressionIsEvaluatedWithNullValue() + { + $constraint = new Expression(array( + 'expression' => 'false', + 'message' => 'myMessage', + )); + + $this->validator->validate(null, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', 'null') + ->assertRaised(); + } + + public function testExpressionIsEvaluatedWithEmptyStringValue() + { + $constraint = new Expression(array( + 'expression' => 'false', + 'message' => 'myMessage', + )); + + $this->validator->validate('', $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '""') + ->assertRaised(); + } + + public function testSucceedingExpressionAtObjectLevel() + { + $constraint = new Expression('this.data == 1'); + + $object = new Entity(); + $object->data = '1'; + + $this->setObject($object); + + $this->validator->validate($object, $constraint); + + $this->assertNoViolation(); + } + + public function testFailingExpressionAtObjectLevel() + { + $constraint = new Expression(array( + 'expression' => 'this.data == 1', + 'message' => 'myMessage', + )); + + $object = new Entity(); + $object->data = '2'; + + $this->setObject($object); + + $this->validator->validate($object, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', 'object') + ->assertRaised(); + } + + public function testSucceedingExpressionAtPropertyLevel() + { + $constraint = new Expression('value == this.data'); + + $object = new Entity(); + $object->data = '1'; + + $this->setRoot($object); + $this->setPropertyPath('data'); + $this->setProperty($object, 'data'); + + $this->validator->validate('1', $constraint); + + $this->assertNoViolation(); + } + + public function testFailingExpressionAtPropertyLevel() + { + $constraint = new Expression(array( + 'expression' => 'value == this.data', + 'message' => 'myMessage', + )); + + $object = new Entity(); + $object->data = '1'; + + $this->setRoot($object); + $this->setPropertyPath('data'); + $this->setProperty($object, 'data'); + + $this->validator->validate('2', $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"2"') + ->atPath('data') + ->assertRaised(); + } + + public function testSucceedingExpressionAtNestedPropertyLevel() + { + $constraint = new Expression('value == this.data'); + + $object = new Entity(); + $object->data = '1'; + + $root = new Entity(); + $root->reference = $object; + + $this->setRoot($root); + $this->setPropertyPath('reference.data'); + $this->setProperty($object, 'data'); + + $this->validator->validate('1', $constraint); + + $this->assertNoViolation(); + } + + public function testFailingExpressionAtNestedPropertyLevel() + { + $constraint = new Expression(array( + 'expression' => 'value == this.data', + 'message' => 'myMessage', + )); + + $object = new Entity(); + $object->data = '1'; + + $root = new Entity(); + $root->reference = $object; + + $this->setRoot($root); + $this->setPropertyPath('reference.data'); + $this->setProperty($object, 'data'); + + $this->validator->validate('2', $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"2"') + ->atPath('reference.data') + ->assertRaised(); + } + + /** + * When validatePropertyValue() is called with a class name + * https://github.com/symfony/symfony/pull/11498 + */ + public function testSucceedingExpressionAtPropertyLevelWithoutRoot() + { + $constraint = new Expression('value == "1"'); + + $this->setRoot('1'); + $this->setPropertyPath(''); + $this->setProperty(null, 'property'); + + $this->validator->validate('1', $constraint); + + $this->assertNoViolation(); + } + + /** + * When validatePropertyValue() is called with a class name + * https://github.com/symfony/symfony/pull/11498 + */ + public function testFailingExpressionAtPropertyLevelWithoutRoot() + { + $constraint = new Expression(array( + 'expression' => 'value == "1"', + 'message' => 'myMessage', + )); + + $this->setRoot('2'); + $this->setPropertyPath(''); + $this->setProperty(null, 'property'); + + $this->validator->validate('2', $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"2"') + ->atPath('') + ->assertRaised(); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/FalseValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/FalseValidatorTest.php new file mode 100644 index 0000000..479888e --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/FalseValidatorTest.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\False; +use Symfony\Component\Validator\Constraints\FalseValidator; +use Symfony\Component\Validator\Validation; + +class FalseValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new FalseValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new False()); + + $this->assertNoViolation(); + } + + public function testFalseIsValid() + { + $this->validator->validate(false, new False()); + + $this->assertNoViolation(); + } + + public function testTrueIsInvalid() + { + $constraint = new False(array( + 'message' => 'myMessage', + )); + + $this->validator->validate(true, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', 'true') + ->assertRaised(); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/FileTest.php b/core/vendor/symfony/validator/Tests/Constraints/FileTest.php new file mode 100644 index 0000000..2ee4681 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/FileTest.php @@ -0,0 +1,107 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\File; + +class FileTest extends \PHPUnit_Framework_TestCase +{ + /** + * @param mixed $maxSize + * @param int bytes + * @param bool $bytes + * @dataProvider provideValidSizes + */ + public function testMaxSize($maxSize, $bytes, $binaryFormat) + { + $file = new File(array('maxSize' => $maxSize)); + + $this->assertSame($bytes, $file->maxSize); + $this->assertSame($binaryFormat, $file->binaryFormat); + } + + /** + * @param mixed $maxSize + * @param int $bytes + * @dataProvider provideInValidSizes + * @expectedException Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testInvalideMaxSize($maxSize) + { + $file = new File(array('maxSize' => $maxSize)); + } + + /** + * @return array + */ + public function provideValidSizes() + { + return array( + array('500', 500, false), + array(12300, 12300, false), + array('1ki', 1024, true), + array('1KI', 1024, true), + array('2k', 2000, false), + array('2K', 2000, false), + array('1mi', 1048576, true), + array('1MI', 1048576, true), + array('3m', 3000000, false), + array('3M', 3000000, false), + ); + } + + /** + * @return array + */ + public function provideInvalidSizes() + { + return array( + array('+100'), + array('foo'), + array('1Ko'), + array('1kio'), + array('1G'), + array('1Gi'), + ); + } + + /** + * @param mixed $maxSize + * @param bool $guessedFormat + * @param bool $binaryFormat + * @dataProvider provideFormats + */ + public function testBinaryFormat($maxSize, $guessedFormat, $binaryFormat) + { + $file = new File(array('maxSize' => $maxSize, 'binaryFormat' => $guessedFormat)); + + $this->assertSame($binaryFormat, $file->binaryFormat); + } + + /** + * @return array + */ + public function provideFormats() + { + return array( + array(100, null, false), + array(100, true, true), + array(100, false, false), + array('100K', null, false), + array('100K', true, true), + array('100K', false, false), + array('100Ki', null, true), + array('100Ki', true, true), + array('100Ki', false, false), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/FileValidatorObjectTest.php b/core/vendor/symfony/validator/Tests/Constraints/FileValidatorObjectTest.php new file mode 100644 index 0000000..f35f93b --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/FileValidatorObjectTest.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\HttpFoundation\File\File; + +class FileValidatorObjectTest extends FileValidatorTest +{ + protected function getFile($filename) + { + return new File($filename); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/FileValidatorPathTest.php b/core/vendor/symfony/validator/Tests/Constraints/FileValidatorPathTest.php new file mode 100644 index 0000000..11b8d4c --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/FileValidatorPathTest.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\File; + +class FileValidatorPathTest extends FileValidatorTest +{ + protected function getFile($filename) + { + return $filename; + } + + public function testFileNotFound() + { + $constraint = new File(array( + 'notFoundMessage' => 'myMessage', + )); + + $this->validator->validate('foobar', $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ file }}', '"foobar"') + ->setCode(File::NOT_FOUND_ERROR) + ->assertRaised(); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/FileValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/FileValidatorTest.php new file mode 100644 index 0000000..176b49f --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/FileValidatorTest.php @@ -0,0 +1,477 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\HttpFoundation\File\UploadedFile; +use Symfony\Component\Validator\Constraints\File; +use Symfony\Component\Validator\Constraints\FileValidator; +use Symfony\Component\Validator\Validation; + +abstract class FileValidatorTest extends AbstractConstraintValidatorTest +{ + protected $path; + + protected $file; + + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new FileValidator(); + } + + protected function setUp() + { + parent::setUp(); + + $this->path = sys_get_temp_dir().DIRECTORY_SEPARATOR.'FileValidatorTest'; + $this->file = fopen($this->path, 'w'); + fwrite($this->file, ' ', 1); + } + + protected function tearDown() + { + parent::tearDown(); + + if (is_resource($this->file)) { + fclose($this->file); + } + + if (file_exists($this->path)) { + unlink($this->path); + } + + $this->path = null; + $this->file = null; + } + + public function testNullIsValid() + { + $this->validator->validate(null, new File()); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $this->validator->validate('', new File()); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsStringCompatibleTypeOrFile() + { + $this->validator->validate(new \stdClass(), new File()); + } + + public function testValidFile() + { + $this->validator->validate($this->path, new File()); + + $this->assertNoViolation(); + } + + public function testValidUploadedfile() + { + $file = new UploadedFile($this->path, 'originalName', null, null, null, true); + $this->validator->validate($file, new File()); + + $this->assertNoViolation(); + } + + public function provideMaxSizeExceededTests() + { + // We have various interesting limit - size combinations to test. + // Assume a limit of 1000 bytes (1 kB). Then the following table + // lists the violation messages for different file sizes: + // -----------+-------------------------------------------------------- + // Size | Violation Message + // -----------+-------------------------------------------------------- + // 1000 bytes | No violation + // 1001 bytes | "Size of 1001 bytes exceeded limit of 1000 bytes" + // 1004 bytes | "Size of 1004 bytes exceeded limit of 1000 bytes" + // | NOT: "Size of 1 kB exceeded limit of 1 kB" + // 1005 bytes | "Size of 1.01 kB exceeded limit of 1 kB" + // -----------+-------------------------------------------------------- + + // As you see, we have two interesting borders: + + // 1000/1001 - The border as of which a violation occurs + // 1004/1005 - The border as of which the message can be rounded to kB + + // Analogous for kB/MB. + + // Prior to Symfony 2.5, violation messages are always displayed in the + // same unit used to specify the limit. + + // As of Symfony 2.5, the above logic is implemented. + return array( + // limit in bytes + array(1001, 1000, '1001', '1000', 'bytes'), + array(1004, 1000, '1004', '1000', 'bytes'), + array(1005, 1000, '1.01', '1', 'kB'), + + array(1000001, 1000000, '1000001', '1000000', 'bytes'), + array(1004999, 1000000, '1005', '1000', 'kB'), + array(1005000, 1000000, '1.01', '1', 'MB'), + + // limit in kB + array(1001, '1k', '1001', '1000', 'bytes'), + array(1004, '1k', '1004', '1000', 'bytes'), + array(1005, '1k', '1.01', '1', 'kB'), + + array(1000001, '1000k', '1000001', '1000000', 'bytes'), + array(1004999, '1000k', '1005', '1000', 'kB'), + array(1005000, '1000k', '1.01', '1', 'MB'), + + // limit in MB + array(1000001, '1M', '1000001', '1000000', 'bytes'), + array(1004999, '1M', '1005', '1000', 'kB'), + array(1005000, '1M', '1.01', '1', 'MB'), + + // limit in KiB + array(1025, '1Ki', '1025', '1024', 'bytes'), + array(1029, '1Ki', '1029', '1024', 'bytes'), + array(1030, '1Ki', '1.01', '1', 'KiB'), + + array(1048577, '1024Ki', '1048577', '1048576', 'bytes'), + array(1053818, '1024Ki', '1029.12', '1024', 'KiB'), + array(1053819, '1024Ki', '1.01', '1', 'MiB'), + + // limit in MiB + array(1048577, '1Mi', '1048577', '1048576', 'bytes'), + array(1053818, '1Mi', '1029.12', '1024', 'KiB'), + array(1053819, '1Mi', '1.01', '1', 'MiB'), + ); + } + + /** + * @dataProvider provideMaxSizeExceededTests + */ + public function testMaxSizeExceeded($bytesWritten, $limit, $sizeAsString, $limitAsString, $suffix) + { + fseek($this->file, $bytesWritten - 1, SEEK_SET); + fwrite($this->file, '0'); + fclose($this->file); + + $constraint = new File(array( + 'maxSize' => $limit, + 'maxSizeMessage' => 'myMessage', + )); + + $this->validator->validate($this->getFile($this->path), $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ limit }}', $limitAsString) + ->setParameter('{{ size }}', $sizeAsString) + ->setParameter('{{ suffix }}', $suffix) + ->setParameter('{{ file }}', '"'.$this->path.'"') + ->setCode(File::TOO_LARGE_ERROR) + ->assertRaised(); + } + + public function provideMaxSizeNotExceededTests() + { + return array( + // limit in bytes + array(1000, 1000), + array(1000000, 1000000), + + // limit in kB + array(1000, '1k'), + array(1000000, '1000k'), + + // limit in MB + array(1000000, '1M'), + + // limit in KiB + array(1024, '1Ki'), + array(1048576, '1024Ki'), + + // limit in MiB + array(1048576, '1Mi'), + ); + } + + /** + * @dataProvider provideMaxSizeNotExceededTests + */ + public function testMaxSizeNotExceeded($bytesWritten, $limit) + { + fseek($this->file, $bytesWritten - 1, SEEK_SET); + fwrite($this->file, '0'); + fclose($this->file); + + $constraint = new File(array( + 'maxSize' => $limit, + 'maxSizeMessage' => 'myMessage', + )); + + $this->validator->validate($this->getFile($this->path), $constraint); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testInvalidMaxSize() + { + $constraint = new File(array( + 'maxSize' => '1abc', + )); + + $this->validator->validate($this->path, $constraint); + } + + public function provideBinaryFormatTests() + { + return array( + array(11, 10, null, '11', '10', 'bytes'), + array(11, 10, true, '11', '10', 'bytes'), + array(11, 10, false, '11', '10', 'bytes'), + + // round(size) == 1.01kB, limit == 1kB + array(ceil(1000*1.01), 1000, null, '1.01', '1', 'kB'), + array(ceil(1000*1.01), '1k', null, '1.01', '1', 'kB'), + array(ceil(1024*1.01), '1Ki', null, '1.01', '1', 'KiB'), + + array(ceil(1024*1.01), 1024, true, '1.01', '1', 'KiB'), + array(ceil(1024*1.01*1000), '1024k', true, '1010', '1000', 'KiB'), + array(ceil(1024*1.01), '1Ki', true, '1.01', '1', 'KiB'), + + array(ceil(1000*1.01), 1000, false, '1.01', '1', 'kB'), + array(ceil(1000*1.01), '1k', false, '1.01', '1', 'kB'), + array(ceil(1024*1.01*10), '10Ki', false, '10.34', '10.24', 'kB'), + ); + } + + /** + * @dataProvider provideBinaryFormatTests + */ + public function testBinaryFormat($bytesWritten, $limit, $binaryFormat, $sizeAsString, $limitAsString, $suffix) + { + fseek($this->file, $bytesWritten-1, SEEK_SET); + fwrite($this->file, '0'); + fclose($this->file); + + $constraint = new File(array( + 'maxSize' => $limit, + 'binaryFormat' => $binaryFormat, + 'maxSizeMessage' => 'myMessage', + )); + + $this->validator->validate($this->getFile($this->path), $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ limit }}', $limitAsString) + ->setParameter('{{ size }}', $sizeAsString) + ->setParameter('{{ suffix }}', $suffix) + ->setParameter('{{ file }}', '"'.$this->path.'"') + ->setCode(File::TOO_LARGE_ERROR) + ->assertRaised(); + } + + public function testValidMimeType() + { + $file = $this + ->getMockBuilder('Symfony\Component\HttpFoundation\File\File') + ->setConstructorArgs(array(__DIR__.'/Fixtures/foo')) + ->getMock(); + $file + ->expects($this->once()) + ->method('getPathname') + ->will($this->returnValue($this->path)); + $file + ->expects($this->once()) + ->method('getMimeType') + ->will($this->returnValue('image/jpg')); + + $constraint = new File(array( + 'mimeTypes' => array('image/png', 'image/jpg'), + )); + + $this->validator->validate($file, $constraint); + + $this->assertNoViolation(); + } + + public function testValidWildcardMimeType() + { + $file = $this + ->getMockBuilder('Symfony\Component\HttpFoundation\File\File') + ->setConstructorArgs(array(__DIR__.'/Fixtures/foo')) + ->getMock(); + $file + ->expects($this->once()) + ->method('getPathname') + ->will($this->returnValue($this->path)); + $file + ->expects($this->once()) + ->method('getMimeType') + ->will($this->returnValue('image/jpg')); + + $constraint = new File(array( + 'mimeTypes' => array('image/*'), + )); + + $this->validator->validate($file, $constraint); + + $this->assertNoViolation(); + } + + public function testInvalidMimeType() + { + $file = $this + ->getMockBuilder('Symfony\Component\HttpFoundation\File\File') + ->setConstructorArgs(array(__DIR__.'/Fixtures/foo')) + ->getMock(); + $file + ->expects($this->once()) + ->method('getPathname') + ->will($this->returnValue($this->path)); + $file + ->expects($this->once()) + ->method('getMimeType') + ->will($this->returnValue('application/pdf')); + + $constraint = new File(array( + 'mimeTypes' => array('image/png', 'image/jpg'), + 'mimeTypesMessage' => 'myMessage', + )); + + $this->validator->validate($file, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ type }}', '"application/pdf"') + ->setParameter('{{ types }}', '"image/png", "image/jpg"') + ->setParameter('{{ file }}', '"'.$this->path.'"') + ->setCode(File::INVALID_MIME_TYPE_ERROR) + ->assertRaised(); + } + + public function testInvalidWildcardMimeType() + { + $file = $this + ->getMockBuilder('Symfony\Component\HttpFoundation\File\File') + ->setConstructorArgs(array(__DIR__.'/Fixtures/foo')) + ->getMock(); + $file + ->expects($this->once()) + ->method('getPathname') + ->will($this->returnValue($this->path)); + $file + ->expects($this->once()) + ->method('getMimeType') + ->will($this->returnValue('application/pdf')); + + $constraint = new File(array( + 'mimeTypes' => array('image/*', 'image/jpg'), + 'mimeTypesMessage' => 'myMessage', + )); + + $this->validator->validate($file, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ type }}', '"application/pdf"') + ->setParameter('{{ types }}', '"image/*", "image/jpg"') + ->setParameter('{{ file }}', '"'.$this->path.'"') + ->setCode(File::INVALID_MIME_TYPE_ERROR) + ->assertRaised(); + } + + public function testDisallowEmpty() + { + ftruncate($this->file, 0); + + $constraint = new File(array( + 'disallowEmptyMessage' => 'myMessage', + )); + + $this->validator->validate($this->getFile($this->path), $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ file }}', '"'.$this->path.'"') + ->setCode(File::EMPTY_ERROR) + ->assertRaised(); + } + + /** + * @dataProvider uploadedFileErrorProvider + */ + public function testUploadedFileError($error, $message, array $params = array(), $maxSize = null) + { + $file = new UploadedFile('/path/to/file', 'originalName', 'mime', 0, $error); + + $constraint = new File(array( + $message => 'myMessage', + 'maxSize' => $maxSize, + )); + + $this->validator->validate($file, $constraint); + + $this->buildViolation('myMessage') + ->setParameters($params) + ->setCode($error) + ->assertRaised(); + } + + public function uploadedFileErrorProvider() + { + $tests = array( + array(UPLOAD_ERR_FORM_SIZE, 'uploadFormSizeErrorMessage'), + array(UPLOAD_ERR_PARTIAL, 'uploadPartialErrorMessage'), + array(UPLOAD_ERR_NO_FILE, 'uploadNoFileErrorMessage'), + array(UPLOAD_ERR_NO_TMP_DIR, 'uploadNoTmpDirErrorMessage'), + array(UPLOAD_ERR_CANT_WRITE, 'uploadCantWriteErrorMessage'), + array(UPLOAD_ERR_EXTENSION, 'uploadExtensionErrorMessage'), + ); + + if (class_exists('Symfony\Component\HttpFoundation\File\UploadedFile')) { + // when no maxSize is specified on constraint, it should use the ini value + $tests[] = array(UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', array( + '{{ limit }}' => UploadedFile::getMaxFilesize() / 1048576, + '{{ suffix }}' => 'MiB', + )); + + // it should use the smaller limitation (maxSize option in this case) + $tests[] = array(UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', array( + '{{ limit }}' => 1, + '{{ suffix }}' => 'bytes', + ), '1'); + + // it correctly parses the maxSize option and not only uses simple string comparison + // 1000M should be bigger than the ini value + $tests[] = array(UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', array( + '{{ limit }}' => UploadedFile::getMaxFilesize() / 1048576, + '{{ suffix }}' => 'MiB', + ), '1000M'); + + // it correctly parses the maxSize option and not only uses simple string comparison + // 1000M should be bigger than the ini value + $tests[] = array(UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', array( + '{{ limit }}' => '0.1', + '{{ suffix }}' => 'MB', + ), '100K'); + } + + return $tests; + } + + abstract protected function getFile($filename); +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/Fixtures/foo b/core/vendor/symfony/validator/Tests/Constraints/Fixtures/foo new file mode 100644 index 0000000..e69de29 diff --git a/core/vendor/symfony/validator/Tests/Constraints/Fixtures/test.gif b/core/vendor/symfony/validator/Tests/Constraints/Fixtures/test.gif new file mode 100644 index 0000000..6b44fc7 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/Fixtures/test.gif @@ -0,0 +1 @@ +GIF89a÷ÿÿÿ,; \ No newline at end of file diff --git a/core/vendor/symfony/validator/Tests/Constraints/Fixtures/test_4by3.gif b/core/vendor/symfony/validator/Tests/Constraints/Fixtures/test_4by3.gif new file mode 100644 index 0000000..64dd3ff --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/Fixtures/test_4by3.gif @@ -0,0 +1 @@ +GIF89a€ÿÿÿÿÿÿ!þCreated with GIMP,„V; \ No newline at end of file diff --git a/core/vendor/symfony/validator/Tests/Constraints/Fixtures/test_landscape.gif b/core/vendor/symfony/validator/Tests/Constraints/Fixtures/test_landscape.gif new file mode 100644 index 0000000..8701235 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/Fixtures/test_landscape.gif @@ -0,0 +1,3 @@ +GIF89a€ÿÿÿÿÿÿ!ù +,L +; \ No newline at end of file diff --git a/core/vendor/symfony/validator/Tests/Constraints/Fixtures/test_portrait.gif b/core/vendor/symfony/validator/Tests/Constraints/Fixtures/test_portrait.gif new file mode 100644 index 0000000..cc480ca --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/Fixtures/test_portrait.gif @@ -0,0 +1,3 @@ +GIF89a€ÿÿÿÿÿÿ!ù +,L +; \ No newline at end of file diff --git a/core/vendor/symfony/validator/Tests/Constraints/GreaterThanOrEqualValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/GreaterThanOrEqualValidatorTest.php new file mode 100644 index 0000000..41708f6 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/GreaterThanOrEqualValidatorTest.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\GreaterThanOrEqual; +use Symfony\Component\Validator\Constraints\GreaterThanOrEqualValidator; +use Symfony\Component\Validator\Validation; + +/** + * @author Daniel Holmes + */ +class GreaterThanOrEqualValidatorTest extends AbstractComparisonValidatorTestCase +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new GreaterThanOrEqualValidator(); + } + + protected function createConstraint(array $options) + { + return new GreaterThanOrEqual($options); + } + + /** + * {@inheritdoc} + */ + public function provideValidComparisons() + { + return array( + array(3, 2), + array(1, 1), + array(new \DateTime('2010/01/01'), new \DateTime('2000/01/01')), + array(new \DateTime('2000/01/01'), new \DateTime('2000/01/01')), + array(new \DateTime('2010/01/01'), '2000/01/01'), + array(new \DateTime('2000/01/01'), '2000/01/01'), + array(new \DateTime('2010/01/01 UTC'), '2000/01/01 UTC'), + array(new \DateTime('2000/01/01 UTC'), '2000/01/01 UTC'), + array('a', 'a'), + array('z', 'a'), + array(null, 1), + ); + } + + /** + * {@inheritdoc} + */ + public function provideInvalidComparisons() + { + return array( + array(1, '1', 2, '2', 'integer'), + array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2005/01/01'), 'Jan 1, 2005, 12:00 AM', 'DateTime'), + array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', '2005/01/01', 'Jan 1, 2005, 12:00 AM', 'DateTime'), + array(new \DateTime('2000/01/01 UTC'), 'Jan 1, 2000, 12:00 AM', '2005/01/01 UTC', 'Jan 1, 2005, 12:00 AM', 'DateTime'), + array('b', '"b"', 'c', '"c"', 'string'), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/GreaterThanValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/GreaterThanValidatorTest.php new file mode 100644 index 0000000..85a2b1d --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/GreaterThanValidatorTest.php @@ -0,0 +1,74 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\GreaterThan; +use Symfony\Component\Validator\Constraints\GreaterThanValidator; +use Symfony\Component\Validator\Validation; + +/** + * @author Daniel Holmes + */ +class GreaterThanValidatorTest extends AbstractComparisonValidatorTestCase +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new GreaterThanValidator(); + } + + protected function createConstraint(array $options) + { + return new GreaterThan($options); + } + + /** + * {@inheritdoc} + */ + public function provideValidComparisons() + { + return array( + array(2, 1), + array(new \DateTime('2005/01/01'), new \DateTime('2001/01/01')), + array(new \DateTime('2005/01/01'), '2001/01/01'), + array(new \DateTime('2005/01/01 UTC'), '2001/01/01 UTC'), + array(new ComparisonTest_Class(5), new ComparisonTest_Class(4)), + array('333', '22'), + array(null, 1), + ); + } + + /** + * {@inheritdoc} + */ + public function provideInvalidComparisons() + { + return array( + array(1, '1', 2, '2', 'integer'), + array(2, '2', 2, '2', 'integer'), + array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2005/01/01'), 'Jan 1, 2005, 12:00 AM', 'DateTime'), + array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', '2005/01/01', 'Jan 1, 2005, 12:00 AM', 'DateTime'), + array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', '2000/01/01', 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array(new \DateTime('2000/01/01 UTC'), 'Jan 1, 2000, 12:00 AM', '2005/01/01 UTC', 'Jan 1, 2005, 12:00 AM', 'DateTime'), + array(new \DateTime('2000/01/01 UTC'), 'Jan 1, 2000, 12:00 AM', '2000/01/01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array(new ComparisonTest_Class(4), '4', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), + array(new ComparisonTest_Class(5), '5', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), + array('22', '"22"', '333', '"333"', 'string'), + array('22', '"22"', '22', '"22"', 'string'), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/GroupSequenceTest.php b/core/vendor/symfony/validator/Tests/Constraints/GroupSequenceTest.php new file mode 100644 index 0000000..30f0245 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/GroupSequenceTest.php @@ -0,0 +1,107 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\GroupSequence; + +/** + * @author Bernhard Schussek + */ +class GroupSequenceTest extends \PHPUnit_Framework_TestCase +{ + public function testCreate() + { + $sequence = new GroupSequence(array('Group 1', 'Group 2')); + + $this->assertSame(array('Group 1', 'Group 2'), $sequence->groups); + } + + public function testCreateDoctrineStyle() + { + $sequence = new GroupSequence(array('value' => array('Group 1', 'Group 2'))); + + $this->assertSame(array('Group 1', 'Group 2'), $sequence->groups); + } + + /** + * @group legacy + */ + public function testLegacyIterate() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + $sequence = new GroupSequence(array('Group 1', 'Group 2')); + + $this->assertSame(array('Group 1', 'Group 2'), iterator_to_array($sequence)); + } + + /** + * @group legacy + */ + public function testLegacyCount() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + $sequence = new GroupSequence(array('Group 1', 'Group 2')); + + $this->assertCount(2, $sequence); + } + + /** + * @group legacy + */ + public function testLegacyArrayAccess() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + $sequence = new GroupSequence(array('Group 1', 'Group 2')); + + $this->assertSame('Group 1', $sequence[0]); + $this->assertSame('Group 2', $sequence[1]); + $this->assertTrue(isset($sequence[0])); + $this->assertFalse(isset($sequence[2])); + unset($sequence[0]); + $this->assertFalse(isset($sequence[0])); + $sequence[] = 'Group 3'; + $this->assertTrue(isset($sequence[2])); + $this->assertSame('Group 3', $sequence[2]); + $sequence[0] = 'Group 1'; + $this->assertTrue(isset($sequence[0])); + $this->assertSame('Group 1', $sequence[0]); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\OutOfBoundsException + * @group legacy + */ + public function testLegacyGetExpectsExistingKey() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + $sequence = new GroupSequence(array('Group 1', 'Group 2')); + + $sequence[2]; + } + + /** + * @group legacy + */ + public function testLegacyUnsetIgnoresNonExistingKeys() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + $sequence = new GroupSequence(array('Group 1', 'Group 2')); + + // should not fail + unset($sequence[2]); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/IbanValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/IbanValidatorTest.php new file mode 100644 index 0000000..ab9839a --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/IbanValidatorTest.php @@ -0,0 +1,193 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Iban; +use Symfony\Component\Validator\Constraints\IbanValidator; +use Symfony\Component\Validator\Validation; + +class IbanValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new IbanValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Iban()); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $this->validator->validate('', new Iban()); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getValidIbans + */ + public function testValidIbans($iban) + { + $this->validator->validate($iban, new Iban()); + + $this->assertNoViolation(); + } + + public function getValidIbans() + { + return array( + array('CH9300762011623852957'), // Switzerland without spaces + array('CH93 0076 2011 6238 5295 7'), // Switzerland with multiple spaces + + //Country list + //http://www.rbs.co.uk/corporate/international/g0/guide-to-international-business/regulatory-information/iban/iban-example.ashx + + array('AL47 2121 1009 0000 0002 3569 8741'), //Albania + array('AD12 0001 2030 2003 5910 0100'), //Andorra + array('AT61 1904 3002 3457 3201'), //Austria + array('AZ21 NABZ 0000 0000 1370 1000 1944'), //Azerbaijan + array('BH67 BMAG 0000 1299 1234 56'), //Bahrain + array('BE62 5100 0754 7061'), //Belgium + array('BA39 1290 0794 0102 8494'), //Bosnia and Herzegovina + array('BG80 BNBG 9661 1020 3456 78'), //Bulgaria + array('HR12 1001 0051 8630 0016 0'), //Croatia + array('CY17 0020 0128 0000 0012 0052 7600'), //Cyprus + array('CZ65 0800 0000 1920 0014 5399'), //Czech Republic + array('DK50 0040 0440 1162 43'), //Denmark + array('EE38 2200 2210 2014 5685'), //Estonia + array('FO97 5432 0388 8999 44'), //Faroe Islands + array('FI21 1234 5600 0007 85'), //Finland + array('FR14 2004 1010 0505 0001 3M02 606'), //France + array('GE29 NB00 0000 0101 9049 17'), //Georgia + array('DE89 3704 0044 0532 0130 00'), //Germany + array('GI75 NWBK 0000 0000 7099 453'), //Gibraltar + array('GR16 0110 1250 0000 0001 2300 695'), //Greece + array('GL56 0444 9876 5432 10'), //Greenland + array('HU42 1177 3016 1111 1018 0000 0000'), //Hungary + array('IS14 0159 2600 7654 5510 7303 39'), //Iceland + array('IE29 AIBK 9311 5212 3456 78'), //Ireland + array('IL62 0108 0000 0009 9999 999'), //Israel + array('IT40 S054 2811 1010 0000 0123 456'), //Italy + array('LV80 BANK 0000 4351 9500 1'), //Latvia + array('LB62 0999 0000 0001 0019 0122 9114'), //Lebanon + array('LI21 0881 0000 2324 013A A'), //Liechtenstein + array('LT12 1000 0111 0100 1000'), //Lithuania + array('LU28 0019 4006 4475 0000'), //Luxembourg + array('MK072 5012 0000 0589 84'), //Macedonia + array('MT84 MALT 0110 0001 2345 MTLC AST0 01S'), //Malta + array('MU17 BOMM 0101 1010 3030 0200 000M UR'), //Mauritius + array('MD24 AG00 0225 1000 1310 4168'), //Moldova + array('MC93 2005 2222 1001 1223 3M44 555'), //Monaco + array('ME25 5050 0001 2345 6789 51'), //Montenegro + array('NL39 RABO 0300 0652 64'), //Netherlands + array('NO93 8601 1117 947'), //Norway + array('PK36 SCBL 0000 0011 2345 6702'), //Pakistan + array('PL60 1020 1026 0000 0422 7020 1111'), //Poland + array('PT50 0002 0123 1234 5678 9015 4'), //Portugal + array('RO49 AAAA 1B31 0075 9384 0000'), //Romania + array('SM86 U032 2509 8000 0000 0270 100'), //San Marino + array('SA03 8000 0000 6080 1016 7519'), //Saudi Arabia + array('RS35 2600 0560 1001 6113 79'), //Serbia + array('SK31 1200 0000 1987 4263 7541'), //Slovak Republic + array('SI56 1910 0000 0123 438'), //Slovenia + array('ES80 2310 0001 1800 0001 2345'), //Spain + array('SE35 5000 0000 0549 1000 0003'), //Sweden + array('CH93 0076 2011 6238 5295 7'), //Switzerland + array('TN59 1000 6035 1835 9847 8831'), //Tunisia + array('TR33 0006 1005 1978 6457 8413 26'), //Turkey + array('AE07 0331 2345 6789 0123 456'), //UAE + array('GB 12 CPBK 0892 9965 0449 91'), //United Kingdom + + //Extended country list + //http://www.nordea.com/Our+services/International+products+and+services/Cash+Management/IBAN+countries/908462.html + array('AO06000600000100037131174'), //Angola + array('AZ21NABZ00000000137010001944'), //Azerbaijan + array('BH29BMAG1299123456BH00'), //Bahrain + array('BJ11B00610100400271101192591'), //Benin + array('VG96VPVG0000012345678901'), //British Virgin Islands + array('BF1030134020015400945000643'), //Burkina Faso + array('BI43201011067444'), //Burundi + array('CM2110003001000500000605306'), //Cameroon + array('CV64000300004547069110176'), //Cape Verde + array('FR7630007000110009970004942'), //Central African Republic + array('CG5230011000202151234567890'), //Congo + array('CR0515202001026284066'), //Costa Rica + array('DO28BAGR00000001212453611324'), //Dominican Republic + array('GT82TRAJ01020000001210029690'), //Guatemala + array('IR580540105180021273113007'), //Iran + array('IL620108000000099999999'), //Israel + array('CI05A00060174100178530011852'), //Ivory Coast + array('KZ176010251000042993'), //Kazakhstan + array('KW74NBOK0000000000001000372151'), //Kuwait + array('LB30099900000001001925579115'), //Lebanon + array('MG4600005030010101914016056'), //Madagascar + array('ML03D00890170001002120000447'), //Mali + array('MR1300012000010000002037372'), //Mauritania + array('MU17BOMM0101101030300200000MUR'), //Mauritius + array('MZ59000100000011834194157'), //Mozambique + array('PS92PALS000000000400123456702'), //Palestinian Territory + array('PT50000200000163099310355'), //Sao Tome and Principe + array('SA0380000000608010167519'), //Saudi Arabia + array('SN12K00100152000025690007542'), //Senegal + array('TN5914207207100707129648'), //Tunisia + array('TR330006100519786457841326'), //Turkey + array('AE260211000000230064016'), //United Arab Emirates + ); + } + + /** + * @dataProvider getInvalidIbans + */ + public function testInvalidIbans($iban, $code) + { + $constraint = new Iban(array( + 'message' => 'myMessage', + )); + + $this->validator->validate($iban, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$iban.'"') + ->setCode($code) + ->assertRaised(); + } + + public function getInvalidIbans() + { + return array( + array('CH93 0076 2011 6238 5295', Iban::CHECKSUM_FAILED_ERROR), + array('CH930076201162385295', Iban::CHECKSUM_FAILED_ERROR), + array('GB29 RBOS 6016 1331 9268 19', Iban::CHECKSUM_FAILED_ERROR), + array('CH930072011623852957', Iban::CHECKSUM_FAILED_ERROR), + array('NL39 RASO 0300 0652 64', Iban::CHECKSUM_FAILED_ERROR), + array('NO93 8601117 947', Iban::CHECKSUM_FAILED_ERROR), + array('CY170020 128 0000 0012 0052 7600', Iban::CHECKSUM_FAILED_ERROR), + array('foo', Iban::TOO_SHORT_ERROR), + array('123', Iban::TOO_SHORT_ERROR), + array('0750447346', Iban::INVALID_COUNTRY_CODE_ERROR), + array('CH930076201162385295]', Iban::INVALID_CHARACTERS_ERROR), + + //Ibans with lower case values are invalid + array('Ae260211000000230064016', Iban::INVALID_CASE_ERROR), + array('ae260211000000230064016', Iban::INVALID_CASE_ERROR), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/IdenticalToValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/IdenticalToValidatorTest.php new file mode 100644 index 0000000..4b71062 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/IdenticalToValidatorTest.php @@ -0,0 +1,89 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\IdenticalTo; +use Symfony\Component\Validator\Constraints\IdenticalToValidator; +use Symfony\Component\Validator\Validation; + +/** + * @author Daniel Holmes + */ +class IdenticalToValidatorTest extends AbstractComparisonValidatorTestCase +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new IdenticalToValidator(); + } + + protected function createConstraint(array $options) + { + return new IdenticalTo($options); + } + + public function provideAllValidComparisons() + { + $this->setDefaultTimezone('UTC'); + + // Don't call addPhp5Dot5Comparisons() automatically, as it does + // not take care of identical objects + $comparisons = $this->provideValidComparisons(); + + $this->restoreDefaultTimezone(); + + return $comparisons; + } + + /** + * {@inheritdoc} + */ + public function provideValidComparisons() + { + $date = new \DateTime('2000-01-01'); + $object = new ComparisonTest_Class(2); + + $comparisons = array( + array(3, 3), + array('a', 'a'), + array($date, $date), + array($object, $object), + array(null, 1), + ); + + if (version_compare(PHP_VERSION, '>=', '5.5')) { + $immutableDate = new \DateTimeImmutable('2000-01-01'); + $comparisons[] = array($immutableDate, $immutableDate); + } + + return $comparisons; + } + + /** + * {@inheritdoc} + */ + public function provideInvalidComparisons() + { + return array( + array(1, '1', 2, '2', 'integer'), + array(2, '2', '2', '"2"', 'string'), + array('22', '"22"', '333', '"333"', 'string'), + array(new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', 'DateTime'), + array(new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', new \DateTime('1999-01-01'), 'Jan 1, 1999, 12:00 AM', 'DateTime'), + array(new ComparisonTest_Class(4), '4', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/ImageValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/ImageValidatorTest.php new file mode 100644 index 0000000..18f9c1b --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/ImageValidatorTest.php @@ -0,0 +1,329 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Image; +use Symfony\Component\Validator\Constraints\ImageValidator; +use Symfony\Component\Validator\Validation; + +class ImageValidatorTest extends AbstractConstraintValidatorTest +{ + protected $context; + + /** + * @var ImageValidator + */ + protected $validator; + + protected $path; + protected $image; + protected $imageLandscape; + protected $imagePortrait; + protected $image4By3; + + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new ImageValidator(); + } + + protected function setUp() + { + parent::setUp(); + + $this->image = __DIR__.'/Fixtures/test.gif'; + $this->imageLandscape = __DIR__.'/Fixtures/test_landscape.gif'; + $this->imagePortrait = __DIR__.'/Fixtures/test_portrait.gif'; + $this->image4By3 = __DIR__.'/Fixtures/test_4by3.gif'; + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Image()); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $this->validator->validate('', new Image()); + + $this->assertNoViolation(); + } + + public function testValidImage() + { + $this->validator->validate($this->image, new Image()); + + $this->assertNoViolation(); + } + + public function testFileNotFound() + { + // Check that the logic from FileValidator still works + $constraint = new Image(array( + 'notFoundMessage' => 'myMessage', + )); + + $this->validator->validate('foobar', $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ file }}', '"foobar"') + ->setCode(Image::NOT_FOUND_ERROR) + ->assertRaised(); + } + + public function testValidSize() + { + $constraint = new Image(array( + 'minWidth' => 1, + 'maxWidth' => 2, + 'minHeight' => 1, + 'maxHeight' => 2, + )); + + $this->validator->validate($this->image, $constraint); + + $this->assertNoViolation(); + } + + public function testWidthTooSmall() + { + $constraint = new Image(array( + 'minWidth' => 3, + 'minWidthMessage' => 'myMessage', + )); + + $this->validator->validate($this->image, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ width }}', '2') + ->setParameter('{{ min_width }}', '3') + ->setCode(Image::TOO_NARROW_ERROR) + ->assertRaised(); + } + + public function testWidthTooBig() + { + $constraint = new Image(array( + 'maxWidth' => 1, + 'maxWidthMessage' => 'myMessage', + )); + + $this->validator->validate($this->image, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ width }}', '2') + ->setParameter('{{ max_width }}', '1') + ->setCode(Image::TOO_WIDE_ERROR) + ->assertRaised(); + } + + public function testHeightTooSmall() + { + $constraint = new Image(array( + 'minHeight' => 3, + 'minHeightMessage' => 'myMessage', + )); + + $this->validator->validate($this->image, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ height }}', '2') + ->setParameter('{{ min_height }}', '3') + ->setCode(Image::TOO_LOW_ERROR) + ->assertRaised(); + } + + public function testHeightTooBig() + { + $constraint = new Image(array( + 'maxHeight' => 1, + 'maxHeightMessage' => 'myMessage', + )); + + $this->validator->validate($this->image, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ height }}', '2') + ->setParameter('{{ max_height }}', '1') + ->setCode(Image::TOO_HIGH_ERROR) + ->assertRaised(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testInvalidMinWidth() + { + $constraint = new Image(array( + 'minWidth' => '1abc', + )); + + $this->validator->validate($this->image, $constraint); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testInvalidMaxWidth() + { + $constraint = new Image(array( + 'maxWidth' => '1abc', + )); + + $this->validator->validate($this->image, $constraint); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testInvalidMinHeight() + { + $constraint = new Image(array( + 'minHeight' => '1abc', + )); + + $this->validator->validate($this->image, $constraint); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testInvalidMaxHeight() + { + $constraint = new Image(array( + 'maxHeight' => '1abc', + )); + + $this->validator->validate($this->image, $constraint); + } + + public function testRatioTooSmall() + { + $constraint = new Image(array( + 'minRatio' => 2, + 'minRatioMessage' => 'myMessage', + )); + + $this->validator->validate($this->image, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ ratio }}', 1) + ->setParameter('{{ min_ratio }}', 2) + ->setCode(Image::RATIO_TOO_SMALL_ERROR) + ->assertRaised(); + } + + public function testRatioTooBig() + { + $constraint = new Image(array( + 'maxRatio' => 0.5, + 'maxRatioMessage' => 'myMessage', + )); + + $this->validator->validate($this->image, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ ratio }}', 1) + ->setParameter('{{ max_ratio }}', 0.5) + ->setCode(Image::RATIO_TOO_BIG_ERROR) + ->assertRaised(); + } + + public function testMaxRatioUsesTwoDecimalsOnly() + { + $constraint = new Image(array( + 'maxRatio' => 1.33, + )); + + $this->validator->validate($this->image4By3, $constraint); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testInvalidMinRatio() + { + $constraint = new Image(array( + 'minRatio' => '1abc', + )); + + $this->validator->validate($this->image, $constraint); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testInvalidMaxRatio() + { + $constraint = new Image(array( + 'maxRatio' => '1abc', + )); + + $this->validator->validate($this->image, $constraint); + } + + public function testSquareNotAllowed() + { + $constraint = new Image(array( + 'allowSquare' => false, + 'allowSquareMessage' => 'myMessage', + )); + + $this->validator->validate($this->image, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ width }}', 2) + ->setParameter('{{ height }}', 2) + ->setCode(Image::SQUARE_NOT_ALLOWED_ERROR) + ->assertRaised(); + } + + public function testLandscapeNotAllowed() + { + $constraint = new Image(array( + 'allowLandscape' => false, + 'allowLandscapeMessage' => 'myMessage', + )); + + $this->validator->validate($this->imageLandscape, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ width }}', 2) + ->setParameter('{{ height }}', 1) + ->setCode(Image::LANDSCAPE_NOT_ALLOWED_ERROR) + ->assertRaised(); + } + + public function testPortraitNotAllowed() + { + $constraint = new Image(array( + 'allowPortrait' => false, + 'allowPortraitMessage' => 'myMessage', + )); + + $this->validator->validate($this->imagePortrait, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ width }}', 1) + ->setParameter('{{ height }}', 2) + ->setCode(Image::PORTRAIT_NOT_ALLOWED_ERROR) + ->assertRaised(); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/IpValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/IpValidatorTest.php new file mode 100644 index 0000000..fc40e61 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/IpValidatorTest.php @@ -0,0 +1,444 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Ip; +use Symfony\Component\Validator\Constraints\IpValidator; +use Symfony\Component\Validator\Validation; + +class IpValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new IpValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Ip()); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $this->validator->validate('', new Ip()); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsStringCompatibleType() + { + $this->validator->validate(new \stdClass(), new Ip()); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testInvalidValidatorVersion() + { + new Ip(array( + 'version' => 666, + )); + } + + /** + * @dataProvider getValidIpsV4 + */ + public function testValidIpsV4($ip) + { + $this->validator->validate($ip, new Ip(array( + 'version' => Ip::V4, + ))); + + $this->assertNoViolation(); + } + + public function getValidIpsV4() + { + return array( + array('0.0.0.0'), + array('10.0.0.0'), + array('123.45.67.178'), + array('172.16.0.0'), + array('192.168.1.0'), + array('224.0.0.1'), + array('255.255.255.255'), + array('127.0.0.0'), + ); + } + + /** + * @dataProvider getValidIpsV6 + */ + public function testValidIpsV6($ip) + { + $this->validator->validate($ip, new Ip(array( + 'version' => Ip::V6, + ))); + + $this->assertNoViolation(); + } + + public function getValidIpsV6() + { + return array( + array('2001:0db8:85a3:0000:0000:8a2e:0370:7334'), + array('2001:0DB8:85A3:0000:0000:8A2E:0370:7334'), + array('2001:0Db8:85a3:0000:0000:8A2e:0370:7334'), + array('fdfe:dcba:9876:ffff:fdc6:c46b:bb8f:7d4c'), + array('fdc6:c46b:bb8f:7d4c:fdc6:c46b:bb8f:7d4c'), + array('fdc6:c46b:bb8f:7d4c:0000:8a2e:0370:7334'), + array('fe80:0000:0000:0000:0202:b3ff:fe1e:8329'), + array('fe80:0:0:0:202:b3ff:fe1e:8329'), + array('fe80::202:b3ff:fe1e:8329'), + array('0:0:0:0:0:0:0:0'), + array('::'), + array('0::'), + array('::0'), + array('0::0'), + // IPv4 mapped to IPv6 + array('2001:0db8:85a3:0000:0000:8a2e:0.0.0.0'), + array('::0.0.0.0'), + array('::255.255.255.255'), + array('::123.45.67.178'), + ); + } + + /** + * @dataProvider getValidIpsAll + */ + public function testValidIpsAll($ip) + { + $this->validator->validate($ip, new Ip(array( + 'version' => Ip::ALL, + ))); + + $this->assertNoViolation(); + } + + public function getValidIpsAll() + { + return array_merge($this->getValidIpsV4(), $this->getValidIpsV6()); + } + + /** + * @dataProvider getInvalidIpsV4 + */ + public function testInvalidIpsV4($ip) + { + $constraint = new Ip(array( + 'version' => Ip::V4, + 'message' => 'myMessage', + )); + + $this->validator->validate($ip, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$ip.'"') + ->assertRaised(); + } + + public function getInvalidIpsV4() + { + return array( + array('0'), + array('0.0'), + array('0.0.0'), + array('256.0.0.0'), + array('0.256.0.0'), + array('0.0.256.0'), + array('0.0.0.256'), + array('-1.0.0.0'), + array('foobar'), + ); + } + + /** + * @dataProvider getInvalidPrivateIpsV4 + */ + public function testInvalidPrivateIpsV4($ip) + { + $constraint = new Ip(array( + 'version' => Ip::V4_NO_PRIV, + 'message' => 'myMessage', + )); + + $this->validator->validate($ip, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$ip.'"') + ->assertRaised(); + } + + public function getInvalidPrivateIpsV4() + { + return array( + array('10.0.0.0'), + array('172.16.0.0'), + array('192.168.1.0'), + ); + } + + /** + * @dataProvider getInvalidReservedIpsV4 + */ + public function testInvalidReservedIpsV4($ip) + { + $constraint = new Ip(array( + 'version' => Ip::V4_NO_RES, + 'message' => 'myMessage', + )); + + $this->validator->validate($ip, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$ip.'"') + ->assertRaised(); + } + + public function getInvalidReservedIpsV4() + { + return array( + array('0.0.0.0'), + array('224.0.0.1'), + array('255.255.255.255'), + ); + } + + /** + * @dataProvider getInvalidPublicIpsV4 + */ + public function testInvalidPublicIpsV4($ip) + { + $constraint = new Ip(array( + 'version' => Ip::V4_ONLY_PUBLIC, + 'message' => 'myMessage', + )); + + $this->validator->validate($ip, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$ip.'"') + ->assertRaised(); + } + + public function getInvalidPublicIpsV4() + { + return array_merge($this->getInvalidPrivateIpsV4(), $this->getInvalidReservedIpsV4()); + } + + /** + * @dataProvider getInvalidIpsV6 + */ + public function testInvalidIpsV6($ip) + { + $constraint = new Ip(array( + 'version' => Ip::V6, + 'message' => 'myMessage', + )); + + $this->validator->validate($ip, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$ip.'"') + ->assertRaised(); + } + + public function getInvalidIpsV6() + { + return array( + array('z001:0db8:85a3:0000:0000:8a2e:0370:7334'), + array('fe80'), + array('fe80:8329'), + array('fe80:::202:b3ff:fe1e:8329'), + array('fe80::202:b3ff::fe1e:8329'), + // IPv4 mapped to IPv6 + array('2001:0db8:85a3:0000:0000:8a2e:0370:0.0.0.0'), + array('::0.0'), + array('::0.0.0'), + array('::256.0.0.0'), + array('::0.256.0.0'), + array('::0.0.256.0'), + array('::0.0.0.256'), + ); + } + + /** + * @dataProvider getInvalidPrivateIpsV6 + */ + public function testInvalidPrivateIpsV6($ip) + { + $constraint = new Ip(array( + 'version' => Ip::V6_NO_PRIV, + 'message' => 'myMessage', + )); + + $this->validator->validate($ip, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$ip.'"') + ->assertRaised(); + } + + public function getInvalidPrivateIpsV6() + { + return array( + array('fdfe:dcba:9876:ffff:fdc6:c46b:bb8f:7d4c'), + array('fdc6:c46b:bb8f:7d4c:fdc6:c46b:bb8f:7d4c'), + array('fdc6:c46b:bb8f:7d4c:0000:8a2e:0370:7334'), + ); + } + + /** + * @dataProvider getInvalidReservedIpsV6 + */ + public function testInvalidReservedIpsV6($ip) + { + $constraint = new Ip(array( + 'version' => Ip::V6_NO_RES, + 'message' => 'myMessage', + )); + + $this->validator->validate($ip, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$ip.'"') + ->assertRaised(); + } + + public function getInvalidReservedIpsV6() + { + // Quoting after official filter documentation: + // "FILTER_FLAG_NO_RES_RANGE = This flag does not apply to IPv6 addresses." + // Full description: http://php.net/manual/en/filter.filters.flags.php + return $this->getInvalidIpsV6(); + } + + /** + * @dataProvider getInvalidPublicIpsV6 + */ + public function testInvalidPublicIpsV6($ip) + { + $constraint = new Ip(array( + 'version' => Ip::V6_ONLY_PUBLIC, + 'message' => 'myMessage', + )); + + $this->validator->validate($ip, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$ip.'"') + ->assertRaised(); + } + + public function getInvalidPublicIpsV6() + { + return array_merge($this->getInvalidPrivateIpsV6(), $this->getInvalidReservedIpsV6()); + } + + /** + * @dataProvider getInvalidIpsAll + */ + public function testInvalidIpsAll($ip) + { + $constraint = new Ip(array( + 'version' => Ip::ALL, + 'message' => 'myMessage', + )); + + $this->validator->validate($ip, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$ip.'"') + ->assertRaised(); + } + + public function getInvalidIpsAll() + { + return array_merge($this->getInvalidIpsV4(), $this->getInvalidIpsV6()); + } + + /** + * @dataProvider getInvalidPrivateIpsAll + */ + public function testInvalidPrivateIpsAll($ip) + { + $constraint = new Ip(array( + 'version' => Ip::ALL_NO_PRIV, + 'message' => 'myMessage', + )); + + $this->validator->validate($ip, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$ip.'"') + ->assertRaised(); + } + + public function getInvalidPrivateIpsAll() + { + return array_merge($this->getInvalidPrivateIpsV4(), $this->getInvalidPrivateIpsV6()); + } + + /** + * @dataProvider getInvalidReservedIpsAll + */ + public function testInvalidReservedIpsAll($ip) + { + $constraint = new Ip(array( + 'version' => Ip::ALL_NO_RES, + 'message' => 'myMessage', + )); + + $this->validator->validate($ip, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$ip.'"') + ->assertRaised(); + } + + public function getInvalidReservedIpsAll() + { + return array_merge($this->getInvalidReservedIpsV4(), $this->getInvalidReservedIpsV6()); + } + + /** + * @dataProvider getInvalidPublicIpsAll + */ + public function testInvalidPublicIpsAll($ip) + { + $constraint = new Ip(array( + 'version' => Ip::ALL_ONLY_PUBLIC, + 'message' => 'myMessage', + )); + + $this->validator->validate($ip, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$ip.'"') + ->assertRaised(); + } + + public function getInvalidPublicIpsAll() + { + return array_merge($this->getInvalidPublicIpsV4(), $this->getInvalidPublicIpsV6()); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/IsbnValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/IsbnValidatorTest.php new file mode 100644 index 0000000..e73b89d --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/IsbnValidatorTest.php @@ -0,0 +1,271 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Isbn; +use Symfony\Component\Validator\Constraints\IsbnValidator; +use Symfony\Component\Validator\Validation; + +/** + * @see https://en.wikipedia.org/wiki/Isbn + */ +class IsbnValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new IsbnValidator(); + } + + public function getValidIsbn10() + { + return array( + array('2723442284'), + array('2723442276'), + array('2723455041'), + array('2070546810'), + array('2711858839'), + array('2756406767'), + array('2870971648'), + array('226623854X'), + array('2851806424'), + array('0321812700'), + array('0-45122-5244'), + array('0-4712-92311'), + array('0-9752298-0-X'), + ); + } + + public function getInvalidIsbn10() + { + return array( + array('27234422841', Isbn::TOO_LONG_ERROR), + array('272344228', Isbn::TOO_SHORT_ERROR), + array('0-4712-9231', Isbn::TOO_SHORT_ERROR), + array('1234567890', Isbn::CHECKSUM_FAILED_ERROR), + array('0987656789', Isbn::CHECKSUM_FAILED_ERROR), + array('7-35622-5444', Isbn::CHECKSUM_FAILED_ERROR), + array('0-4X19-92611', Isbn::CHECKSUM_FAILED_ERROR), + array('0_45122_5244', Isbn::INVALID_CHARACTERS_ERROR), + array('2870#971#648', Isbn::INVALID_CHARACTERS_ERROR), + array('0-9752298-0-x', Isbn::INVALID_CHARACTERS_ERROR), + array('1A34567890', Isbn::INVALID_CHARACTERS_ERROR), + // chr(1) evaluates to 0 + // 2070546810 is valid + array('2'.chr(1).'70546810', Isbn::INVALID_CHARACTERS_ERROR), + ); + } + + public function getValidIsbn13() + { + return array( + array('978-2723442282'), + array('978-2723442275'), + array('978-2723455046'), + array('978-2070546817'), + array('978-2711858835'), + array('978-2756406763'), + array('978-2870971642'), + array('978-2266238540'), + array('978-2851806420'), + array('978-0321812704'), + array('978-0451225245'), + array('978-0471292319'), + ); + } + + public function getInvalidIsbn13() + { + return array( + array('978-27234422821', Isbn::TOO_LONG_ERROR), + array('978-272344228', Isbn::TOO_SHORT_ERROR), + array('978-2723442-82', Isbn::TOO_SHORT_ERROR), + array('978-2723442281', Isbn::CHECKSUM_FAILED_ERROR), + array('978-0321513774', Isbn::CHECKSUM_FAILED_ERROR), + array('979-0431225385', Isbn::CHECKSUM_FAILED_ERROR), + array('980-0474292319', Isbn::CHECKSUM_FAILED_ERROR), + array('0-4X19-92619812', Isbn::INVALID_CHARACTERS_ERROR), + array('978_2723442282', Isbn::INVALID_CHARACTERS_ERROR), + array('978#2723442282', Isbn::INVALID_CHARACTERS_ERROR), + array('978-272C442282', Isbn::INVALID_CHARACTERS_ERROR), + // chr(1) evaluates to 0 + // 978-2070546817 is valid + array('978-2'.chr(1).'70546817', Isbn::INVALID_CHARACTERS_ERROR), + ); + } + + public function getValidIsbn() + { + return array_merge( + $this->getValidIsbn10(), + $this->getValidIsbn13() + ); + } + + public function getInvalidIsbn() + { + return array_merge( + $this->getInvalidIsbn10(), + $this->getInvalidIsbn13() + ); + } + + public function testNullIsValid() + { + $constraint = new Isbn(true); + + $this->validator->validate(null, $constraint); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $constraint = new Isbn(true); + + $this->validator->validate('', $constraint); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsStringCompatibleType() + { + $constraint = new Isbn(true); + + $this->validator->validate(new \stdClass(), $constraint); + } + + /** + * @dataProvider getValidIsbn10 + */ + public function testValidIsbn10($isbn) + { + $constraint = new Isbn(array( + 'type' => 'isbn10', + )); + + $this->validator->validate($isbn, $constraint); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getInvalidIsbn10 + */ + public function testInvalidIsbn10($isbn, $code) + { + $constraint = new Isbn(array( + 'type' => 'isbn10', + 'isbn10Message' => 'myMessage', + )); + + $this->validator->validate($isbn, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$isbn.'"') + ->setCode($code) + ->assertRaised(); + } + + /** + * @dataProvider getValidIsbn13 + */ + public function testValidIsbn13($isbn) + { + $constraint = new Isbn(array('type' => 'isbn13')); + + $this->validator->validate($isbn, $constraint); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getInvalidIsbn13 + */ + public function testInvalidIsbn13($isbn, $code) + { + $constraint = new Isbn(array( + 'type' => 'isbn13', + 'isbn13Message' => 'myMessage', + )); + + $this->validator->validate($isbn, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$isbn.'"') + ->setCode($code) + ->assertRaised(); + } + + /** + * @dataProvider getValidIsbn + */ + public function testValidIsbnAny($isbn) + { + $constraint = new Isbn(); + + $this->validator->validate($isbn, $constraint); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getInvalidIsbn10 + */ + public function testInvalidIsbnAnyIsbn10($isbn, $code) + { + $constraint = new Isbn(array( + 'bothIsbnMessage' => 'myMessage', + )); + + $this->validator->validate($isbn, $constraint); + + // Too long for an ISBN-10, but not long enough for an ISBN-13 + if (Isbn::TOO_LONG_ERROR === $code) { + $code = Isbn::TYPE_NOT_RECOGNIZED_ERROR; + } + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$isbn.'"') + ->setCode($code) + ->assertRaised(); + } + + /** + * @dataProvider getInvalidIsbn13 + */ + public function testInvalidIsbnAnyIsbn13($isbn, $code) + { + $constraint = new Isbn(array( + 'bothIsbnMessage' => 'myMessage', + )); + + $this->validator->validate($isbn, $constraint); + + // Too short for an ISBN-13, but not short enough for an ISBN-10 + if (Isbn::TOO_SHORT_ERROR === $code) { + $code = Isbn::TYPE_NOT_RECOGNIZED_ERROR; + } + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$isbn.'"') + ->setCode($code) + ->assertRaised(); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/IssnValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/IssnValidatorTest.php new file mode 100644 index 0000000..a6d3994 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/IssnValidatorTest.php @@ -0,0 +1,187 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Issn; +use Symfony\Component\Validator\Constraints\IssnValidator; +use Symfony\Component\Validator\Validation; + +/** + * @see https://en.wikipedia.org/wiki/Issn + */ +class IssnValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new IssnValidator(); + } + + public function getValidLowerCasedIssn() + { + return array( + array('2162-321x'), + array('2160-200x'), + array('1537-453x'), + array('1937-710x'), + array('0002-922x'), + array('1553-345x'), + array('1553-619x'), + ); + } + + public function getValidNonHyphenatedIssn() + { + return array( + array('2162321X'), + array('01896016'), + array('15744647'), + array('14350645'), + array('07174055'), + array('20905076'), + array('14401592'), + ); + } + + public function getFullValidIssn() + { + return array( + array('1550-7416'), + array('1539-8560'), + array('2156-5376'), + array('1119-023X'), + array('1684-5315'), + array('1996-0786'), + array('1684-5374'), + array('1996-0794'), + ); + } + + public function getValidIssn() + { + return array_merge( + $this->getValidLowerCasedIssn(), + $this->getValidNonHyphenatedIssn(), + $this->getFullValidIssn() + ); + } + + public function getInvalidIssn() + { + return array( + array(0, Issn::TOO_SHORT_ERROR), + array('1539', Issn::TOO_SHORT_ERROR), + array('2156-537A', Issn::INVALID_CHARACTERS_ERROR), + array('1119-0231', Issn::CHECKSUM_FAILED_ERROR), + array('1684-5312', Issn::CHECKSUM_FAILED_ERROR), + array('1996-0783', Issn::CHECKSUM_FAILED_ERROR), + array('1684-537X', Issn::CHECKSUM_FAILED_ERROR), + array('1996-0795', Issn::CHECKSUM_FAILED_ERROR), + ); + } + + public function testNullIsValid() + { + $constraint = new Issn(); + + $this->validator->validate(null, $constraint); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $constraint = new Issn(); + + $this->validator->validate('', $constraint); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsStringCompatibleType() + { + $constraint = new Issn(); + $this->validator->validate(new \stdClass(), $constraint); + } + + /** + * @dataProvider getValidLowerCasedIssn + */ + public function testCaseSensitiveIssns($issn) + { + $constraint = new Issn(array( + 'caseSensitive' => true, + 'message' => 'myMessage', + )); + + $this->validator->validate($issn, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$issn.'"') + ->setCode(Issn::INVALID_CASE_ERROR) + ->assertRaised(); + } + + /** + * @dataProvider getValidNonHyphenatedIssn + */ + public function testRequireHyphenIssns($issn) + { + $constraint = new Issn(array( + 'requireHyphen' => true, + 'message' => 'myMessage', + )); + + $this->validator->validate($issn, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$issn.'"') + ->setCode(Issn::MISSING_HYPHEN_ERROR) + ->assertRaised(); + } + + /** + * @dataProvider getValidIssn + */ + public function testValidIssn($issn) + { + $constraint = new Issn(); + + $this->validator->validate($issn, $constraint); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getInvalidIssn + */ + public function testInvalidIssn($issn, $code) + { + $constraint = new Issn(array( + 'message' => 'myMessage', + )); + + $this->validator->validate($issn, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$issn.'"') + ->setCode($code) + ->assertRaised(); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/LanguageValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/LanguageValidatorTest.php new file mode 100644 index 0000000..6f7c390 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/LanguageValidatorTest.php @@ -0,0 +1,114 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Intl\Util\IntlTestHelper; +use Symfony\Component\Validator\Constraints\Language; +use Symfony\Component\Validator\Constraints\LanguageValidator; +use Symfony\Component\Validator\Validation; + +class LanguageValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new LanguageValidator(); + } + + protected function setUp() + { + IntlTestHelper::requireFullIntl($this); + + parent::setUp(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Language()); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $this->validator->validate('', new Language()); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsStringCompatibleType() + { + $this->validator->validate(new \stdClass(), new Language()); + } + + /** + * @dataProvider getValidLanguages + */ + public function testValidLanguages($language) + { + $this->validator->validate($language, new Language()); + + $this->assertNoViolation(); + } + + public function getValidLanguages() + { + return array( + array('en'), + array('en_US'), + array('my'), + ); + } + + /** + * @dataProvider getInvalidLanguages + */ + public function testInvalidLanguages($language) + { + $constraint = new Language(array( + 'message' => 'myMessage', + )); + + $this->validator->validate($language, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$language.'"') + ->assertRaised(); + } + + public function getInvalidLanguages() + { + return array( + array('EN'), + array('foobar'), + ); + } + + public function testValidateUsingCountrySpecificLocale() + { + \Locale::setDefault('fr_FR'); + $existingLanguage = 'en'; + + $this->validator->validate($existingLanguage, new Language(array( + 'message' => 'aMessage', + ))); + + $this->assertNoViolation(); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/LengthValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/LengthValidatorTest.php new file mode 100644 index 0000000..24b6306 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/LengthValidatorTest.php @@ -0,0 +1,255 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Length; +use Symfony\Component\Validator\Constraints\LengthValidator; +use Symfony\Component\Validator\Validation; + +class LengthValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new LengthValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Length(6)); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $this->validator->validate('', new Length(6)); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsStringCompatibleType() + { + $this->validator->validate(new \stdClass(), new Length(5)); + } + + public function getThreeOrLessCharacters() + { + return array( + array(12), + array('12'), + array('üü'), + array('éé'), + array(123), + array('123'), + array('üüü'), + array('ééé'), + ); + } + + public function getFourCharacters() + { + return array( + array(1234), + array('1234'), + array('üüüü'), + array('éééé'), + ); + } + + public function getFiveOrMoreCharacters() + { + return array( + array(12345), + array('12345'), + array('üüüüü'), + array('ééééé'), + array(123456), + array('123456'), + array('üüüüüü'), + array('éééééé'), + ); + } + + public function getOneCharset() + { + if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) { + $this->markTestSkipped('Mbstring or iconv is required for this test.'); + } + + return array( + array('é', 'utf8', true), + array("\xE9", 'CP1252', true), + array("\xE9", 'XXX', false), + array("\xE9", 'utf8', false), + ); + } + + /** + * @dataProvider getFiveOrMoreCharacters + */ + public function testValidValuesMin($value) + { + $constraint = new Length(array('min' => 5)); + $this->validator->validate($value, $constraint); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getThreeOrLessCharacters + */ + public function testValidValuesMax($value) + { + $constraint = new Length(array('max' => 3)); + $this->validator->validate($value, $constraint); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getFourCharacters + */ + public function testValidValuesExact($value) + { + $constraint = new Length(4); + $this->validator->validate($value, $constraint); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getThreeOrLessCharacters + */ + public function testInvalidValuesMin($value) + { + $constraint = new Length(array( + 'min' => 4, + 'minMessage' => 'myMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$value.'"') + ->setParameter('{{ limit }}', 4) + ->setInvalidValue($value) + ->setPlural(4) + ->setCode(Length::TOO_SHORT_ERROR) + ->assertRaised(); + } + + /** + * @dataProvider getFiveOrMoreCharacters + */ + public function testInvalidValuesMax($value) + { + $constraint = new Length(array( + 'max' => 4, + 'maxMessage' => 'myMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$value.'"') + ->setParameter('{{ limit }}', 4) + ->setInvalidValue($value) + ->setPlural(4) + ->setCode(Length::TOO_LONG_ERROR) + ->assertRaised(); + } + + /** + * @dataProvider getThreeOrLessCharacters + */ + public function testInvalidValuesExactLessThanFour($value) + { + $constraint = new Length(array( + 'min' => 4, + 'max' => 4, + 'exactMessage' => 'myMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$value.'"') + ->setParameter('{{ limit }}', 4) + ->setInvalidValue($value) + ->setPlural(4) + ->setCode(Length::TOO_SHORT_ERROR) + ->assertRaised(); + } + + /** + * @dataProvider getFiveOrMoreCharacters + */ + public function testInvalidValuesExactMoreThanFour($value) + { + $constraint = new Length(array( + 'min' => 4, + 'max' => 4, + 'exactMessage' => 'myMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$value.'"') + ->setParameter('{{ limit }}', 4) + ->setInvalidValue($value) + ->setPlural(4) + ->setCode(Length::TOO_LONG_ERROR) + ->assertRaised(); + } + + /** + * @dataProvider getOneCharset + */ + public function testOneCharset($value, $charset, $isValid) + { + $constraint = new Length(array( + 'min' => 1, + 'max' => 1, + 'charset' => $charset, + 'charsetMessage' => 'myMessage', + )); + + $this->validator->validate($value, $constraint); + + if ($isValid) { + $this->assertNoViolation(); + } else { + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$value.'"') + ->setParameter('{{ charset }}', $charset) + ->setInvalidValue($value) + ->assertRaised(); + } + } + + public function testConstraintGetDefaultOption() + { + $constraint = new Length(5); + + $this->assertEquals(5, $constraint->min); + $this->assertEquals(5, $constraint->max); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/LessThanOrEqualValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/LessThanOrEqualValidatorTest.php new file mode 100644 index 0000000..7518135 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/LessThanOrEqualValidatorTest.php @@ -0,0 +1,74 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\LessThanOrEqual; +use Symfony\Component\Validator\Constraints\LessThanOrEqualValidator; +use Symfony\Component\Validator\Validation; + +/** + * @author Daniel Holmes + */ +class LessThanOrEqualValidatorTest extends AbstractComparisonValidatorTestCase +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new LessThanOrEqualValidator(); + } + + protected function createConstraint(array $options) + { + return new LessThanOrEqual($options); + } + + /** + * {@inheritdoc} + */ + public function provideValidComparisons() + { + return array( + array(1, 2), + array(1, 1), + array(new \DateTime('2000-01-01'), new \DateTime('2000-01-01')), + array(new \DateTime('2000-01-01'), new \DateTime('2020-01-01')), + array(new \DateTime('2000-01-01'), '2000-01-01'), + array(new \DateTime('2000-01-01'), '2020-01-01'), + array(new \DateTime('2000-01-01 UTC'), '2000-01-01 UTC'), + array(new \DateTime('2000-01-01 UTC'), '2020-01-01 UTC'), + array(new ComparisonTest_Class(4), new ComparisonTest_Class(5)), + array(new ComparisonTest_Class(5), new ComparisonTest_Class(5)), + array('a', 'a'), + array('a', 'z'), + array(null, 1), + ); + } + + /** + * {@inheritdoc} + */ + public function provideInvalidComparisons() + { + return array( + array(2, '2', 1, '1', 'integer'), + array(new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array(new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array(new \DateTime('2010-01-01 UTC'), 'Jan 1, 2010, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array(new ComparisonTest_Class(5), '5', new ComparisonTest_Class(4), '4', __NAMESPACE__.'\ComparisonTest_Class'), + array('c', '"c"', 'b', '"b"', 'string'), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/LessThanValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/LessThanValidatorTest.php new file mode 100644 index 0000000..d555870 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/LessThanValidatorTest.php @@ -0,0 +1,73 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\LessThan; +use Symfony\Component\Validator\Constraints\LessThanValidator; +use Symfony\Component\Validator\Validation; + +/** + * @author Daniel Holmes + */ +class LessThanValidatorTest extends AbstractComparisonValidatorTestCase +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new LessThanValidator(); + } + + protected function createConstraint(array $options) + { + return new LessThan($options); + } + + /** + * {@inheritdoc} + */ + public function provideValidComparisons() + { + return array( + array(1, 2), + array(new \DateTime('2000-01-01'), new \DateTime('2010-01-01')), + array(new \DateTime('2000-01-01'), '2010-01-01'), + array(new \DateTime('2000-01-01 UTC'), '2010-01-01 UTC'), + array(new ComparisonTest_Class(4), new ComparisonTest_Class(5)), + array('22', '333'), + array(null, 1), + ); + } + + /** + * {@inheritdoc} + */ + public function provideInvalidComparisons() + { + return array( + array(3, '3', 2, '2', 'integer'), + array(2, '2', 2, '2', 'integer'), + array(new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array(new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array(new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array(new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array(new \DateTime('2010-01-01 UTC'), 'Jan 1, 2010, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array(new \DateTime('2000-01-01 UTC'), 'Jan 1, 2000, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array(new ComparisonTest_Class(5), '5', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), + array(new ComparisonTest_Class(6), '6', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), + array('333', '"333"', '22', '"22"', 'string'), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/LocaleValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/LocaleValidatorTest.php new file mode 100644 index 0000000..e5e2f30 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/LocaleValidatorTest.php @@ -0,0 +1,104 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Intl\Util\IntlTestHelper; +use Symfony\Component\Validator\Constraints\Locale; +use Symfony\Component\Validator\Constraints\LocaleValidator; +use Symfony\Component\Validator\Validation; + +class LocaleValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new LocaleValidator(); + } + + protected function setUp() + { + IntlTestHelper::requireIntl($this); + + parent::setUp(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Locale()); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $this->validator->validate('', new Locale()); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsStringCompatibleType() + { + $this->validator->validate(new \stdClass(), new Locale()); + } + + /** + * @dataProvider getValidLocales + */ + public function testValidLocales($locale) + { + $this->validator->validate($locale, new Locale()); + + $this->assertNoViolation(); + } + + public function getValidLocales() + { + return array( + array('en'), + array('en_US'), + array('pt'), + array('pt_PT'), + array('zh_Hans'), + ); + } + + /** + * @dataProvider getInvalidLocales + */ + public function testInvalidLocales($locale) + { + $constraint = new Locale(array( + 'message' => 'myMessage', + )); + + $this->validator->validate($locale, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$locale.'"') + ->assertRaised(); + } + + public function getInvalidLocales() + { + return array( + array('EN'), + array('foobar'), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/LuhnValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/LuhnValidatorTest.php new file mode 100644 index 0000000..b0e88c3 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/LuhnValidatorTest.php @@ -0,0 +1,127 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Luhn; +use Symfony\Component\Validator\Constraints\LuhnValidator; +use Symfony\Component\Validator\Validation; + +class LuhnValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new LuhnValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Luhn()); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $this->validator->validate('', new Luhn()); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getValidNumbers + */ + public function testValidNumbers($number) + { + $this->validator->validate($number, new Luhn()); + + $this->assertNoViolation(); + } + + public function getValidNumbers() + { + return array( + array('42424242424242424242'), + array('378282246310005'), + array('371449635398431'), + array('378734493671000'), + array('5610591081018250'), + array('30569309025904'), + array('38520000023237'), + array('6011111111111117'), + array('6011000990139424'), + array('3530111333300000'), + array('3566002020360505'), + array('5555555555554444'), + array('5105105105105100'), + array('4111111111111111'), + array('4012888888881881'), + array('4222222222222'), + array('5019717010103742'), + array('6331101999990016'), + ); + } + + /** + * @dataProvider getInvalidNumbers + */ + public function testInvalidNumbers($number, $code) + { + $constraint = new Luhn(array( + 'message' => 'myMessage', + )); + + $this->validator->validate($number, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$number.'"') + ->setCode($code) + ->assertRaised(); + } + + public function getInvalidNumbers() + { + return array( + array('1234567812345678', Luhn::CHECKSUM_FAILED_ERROR), + array('4222222222222222', Luhn::CHECKSUM_FAILED_ERROR), + array('0000000000000000', Luhn::CHECKSUM_FAILED_ERROR), + array('000000!000000000', Luhn::INVALID_CHARACTERS_ERROR), + array('42-22222222222222', Luhn::INVALID_CHARACTERS_ERROR), + ); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + * @dataProvider getInvalidTypes + */ + public function testInvalidTypes($number) + { + $constraint = new Luhn(); + + $this->validator->validate($number, $constraint); + } + + public function getInvalidTypes() + { + return array( + array(0), + array(123), + array(42424242424242424242), + array(378282246310005), + array(371449635398431), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/NotBlankValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/NotBlankValidatorTest.php new file mode 100644 index 0000000..c248246 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/NotBlankValidatorTest.php @@ -0,0 +1,102 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\NotBlank; +use Symfony\Component\Validator\Constraints\NotBlankValidator; +use Symfony\Component\Validator\Validation; + +class NotBlankValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new NotBlankValidator(); + } + + /** + * @dataProvider getValidValues + */ + public function testValidValues($value) + { + $this->validator->validate($value, new NotBlank()); + + $this->assertNoViolation(); + } + + public function getValidValues() + { + return array( + array('foobar'), + array(0), + array(0.0), + array('0'), + array(1234), + ); + } + + public function testNullIsInvalid() + { + $constraint = new NotBlank(array( + 'message' => 'myMessage', + )); + + $this->validator->validate(null, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', 'null') + ->assertRaised(); + } + + public function testBlankIsInvalid() + { + $constraint = new NotBlank(array( + 'message' => 'myMessage', + )); + + $this->validator->validate('', $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '""') + ->assertRaised(); + } + + public function testFalseIsInvalid() + { + $constraint = new NotBlank(array( + 'message' => 'myMessage', + )); + + $this->validator->validate(false, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', 'false') + ->assertRaised(); + } + + public function testEmptyArrayIsInvalid() + { + $constraint = new NotBlank(array( + 'message' => 'myMessage', + )); + + $this->validator->validate(array(), $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', 'array') + ->assertRaised(); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/NotEqualToValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/NotEqualToValidatorTest.php new file mode 100644 index 0000000..bc2c348 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/NotEqualToValidatorTest.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\NotEqualTo; +use Symfony\Component\Validator\Constraints\NotEqualToValidator; +use Symfony\Component\Validator\Validation; + +/** + * @author Daniel Holmes + */ +class NotEqualToValidatorTest extends AbstractComparisonValidatorTestCase +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new NotEqualToValidator(); + } + + protected function createConstraint(array $options) + { + return new NotEqualTo($options); + } + + /** + * {@inheritdoc} + */ + public function provideValidComparisons() + { + return array( + array(1, 2), + array('22', '333'), + array(new \DateTime('2001-01-01'), new \DateTime('2000-01-01')), + array(new \DateTime('2001-01-01'), '2000-01-01'), + array(new \DateTime('2001-01-01 UTC'), '2000-01-01 UTC'), + array(new ComparisonTest_Class(6), new ComparisonTest_Class(5)), + array(null, 1), + ); + } + + /** + * {@inheritdoc} + */ + public function provideInvalidComparisons() + { + return array( + array(3, '3', 3, '3', 'integer'), + array('2', '"2"', 2, '2', 'integer'), + array('a', '"a"', 'a', '"a"', 'string'), + array(new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array(new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array(new \DateTime('2000-01-01 UTC'), 'Jan 1, 2000, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array(new ComparisonTest_Class(5), '5', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/NotIdenticalToValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/NotIdenticalToValidatorTest.php new file mode 100644 index 0000000..1fbd806 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/NotIdenticalToValidatorTest.php @@ -0,0 +1,92 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\NotIdenticalTo; +use Symfony\Component\Validator\Constraints\NotIdenticalToValidator; +use Symfony\Component\Validator\Validation; + +/** + * @author Daniel Holmes + */ +class NotIdenticalToValidatorTest extends AbstractComparisonValidatorTestCase +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new NotIdenticalToValidator(); + } + + protected function createConstraint(array $options) + { + return new NotIdenticalTo($options); + } + + /** + * {@inheritdoc} + */ + public function provideValidComparisons() + { + return array( + array(1, 2), + array('2', 2), + array('22', '333'), + array(new \DateTime('2001-01-01'), new \DateTime('2000-01-01')), + array(new \DateTime('2000-01-01'), new \DateTime('2000-01-01')), + array(new \DateTime('2001-01-01'), '2000-01-01'), + array(new \DateTime('2000-01-01'), '2000-01-01'), + array(new \DateTime('2001-01-01'), '2000-01-01'), + array(new \DateTime('2000-01-01 UTC'), '2000-01-01 UTC'), + array(null, 1), + ); + } + + public function provideAllInvalidComparisons() + { + $this->setDefaultTimezone('UTC'); + + // Don't call addPhp5Dot5Comparisons() automatically, as it does + // not take care of identical objects + $comparisons = $this->provideInvalidComparisons(); + + $this->restoreDefaultTimezone(); + + return $comparisons; + } + + /** + * {@inheritdoc} + */ + public function provideInvalidComparisons() + { + $date = new \DateTime('2000-01-01'); + $object = new ComparisonTest_Class(2); + + $comparisons = array( + array(3, '3', 3, '3', 'integer'), + array('a', '"a"', 'a', '"a"', 'string'), + array($date, 'Jan 1, 2000, 12:00 AM', $date, 'Jan 1, 2000, 12:00 AM', 'DateTime'), + array($object, '2', $object, '2', __NAMESPACE__.'\ComparisonTest_Class'), + ); + + if (version_compare(PHP_VERSION, '>=', '5.5')) { + $immutableDate = new \DateTimeImmutable('2000-01-01'); + $comparisons[] = array($immutableDate, 'Jan 1, 2000, 12:00 AM', $immutableDate, 'Jan 1, 2000, 12:00 AM', 'DateTime'); + } + + return $comparisons; + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/NotNullValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/NotNullValidatorTest.php new file mode 100644 index 0000000..d338f31 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/NotNullValidatorTest.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\NotNull; +use Symfony\Component\Validator\Constraints\NotNullValidator; +use Symfony\Component\Validator\Validation; + +class NotNullValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new NotNullValidator(); + } + + /** + * @dataProvider getValidValues + */ + public function testValidValues($value) + { + $this->validator->validate($value, new NotNull()); + + $this->assertNoViolation(); + } + + public function getValidValues() + { + return array( + array(0), + array(false), + array(true), + array(''), + ); + } + + public function testNullIsInvalid() + { + $constraint = new NotNull(array( + 'message' => 'myMessage', + )); + + $this->validator->validate(null, $constraint); + + $this->buildViolation('myMessage')->assertRaised(); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/NullValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/NullValidatorTest.php new file mode 100644 index 0000000..85df90a --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/NullValidatorTest.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Null; +use Symfony\Component\Validator\Constraints\NullValidator; +use Symfony\Component\Validator\Validation; + +class NullValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new NullValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Null()); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getInvalidValues + */ + public function testInvalidValues($value, $valueAsString) + { + $constraint = new Null(array( + 'message' => 'myMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', $valueAsString) + ->assertRaised(); + } + + public function getInvalidValues() + { + return array( + array(0, '0'), + array(false, 'false'), + array(true, 'true'), + array('', '""'), + array('foo bar', '"foo bar"'), + array(new \DateTime(), 'object'), + array(new \stdClass(), 'object'), + array(array(), 'array'), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/RangeValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/RangeValidatorTest.php new file mode 100644 index 0000000..9b7056b --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/RangeValidatorTest.php @@ -0,0 +1,403 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Intl\Util\IntlTestHelper; +use Symfony\Component\Validator\Constraints\Range; +use Symfony\Component\Validator\Constraints\RangeValidator; +use Symfony\Component\Validator\Validation; + +class RangeValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new RangeValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Range(array('min' => 10, 'max' => 20))); + + $this->assertNoViolation(); + } + + public function getTenToTwenty() + { + return array( + array(10.00001), + array(19.99999), + array('10.00001'), + array('19.99999'), + array(10), + array(20), + array(10.0), + array(20.0), + ); + } + + public function getLessThanTen() + { + return array( + array(9.99999, '9.99999'), + array('9.99999', '"9.99999"'), + array(5, '5'), + array(1.0, '1.0'), + ); + } + + public function getMoreThanTwenty() + { + return array( + array(20.000001, '20.000001'), + array('20.000001', '"20.000001"'), + array(21, '21'), + array(30.0, '30.0'), + ); + } + + /** + * @dataProvider getTenToTwenty + */ + public function testValidValuesMin($value) + { + $constraint = new Range(array('min' => 10)); + $this->validator->validate($value, $constraint); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getTenToTwenty + */ + public function testValidValuesMax($value) + { + $constraint = new Range(array('max' => 20)); + $this->validator->validate($value, $constraint); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getTenToTwenty + */ + public function testValidValuesMinMax($value) + { + $constraint = new Range(array('min' => 10, 'max' => 20)); + $this->validator->validate($value, $constraint); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getLessThanTen + */ + public function testInvalidValuesMin($value, $formattedValue) + { + $constraint = new Range(array( + 'min' => 10, + 'minMessage' => 'myMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', $formattedValue) + ->setParameter('{{ limit }}', 10) + ->setCode(Range::BELOW_RANGE_ERROR) + ->assertRaised(); + } + + /** + * @dataProvider getMoreThanTwenty + */ + public function testInvalidValuesMax($value, $formattedValue) + { + $constraint = new Range(array( + 'max' => 20, + 'maxMessage' => 'myMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', $formattedValue) + ->setParameter('{{ limit }}', 20) + ->setCode(Range::BEYOND_RANGE_ERROR) + ->assertRaised(); + } + + /** + * @dataProvider getMoreThanTwenty + */ + public function testInvalidValuesCombinedMax($value, $formattedValue) + { + $constraint = new Range(array( + 'min' => 10, + 'max' => 20, + 'minMessage' => 'myMinMessage', + 'maxMessage' => 'myMaxMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMaxMessage') + ->setParameter('{{ value }}', $formattedValue) + ->setParameter('{{ limit }}', 20) + ->setCode(Range::BEYOND_RANGE_ERROR) + ->assertRaised(); + } + + /** + * @dataProvider getLessThanTen + */ + public function testInvalidValuesCombinedMin($value, $formattedValue) + { + $constraint = new Range(array( + 'min' => 10, + 'max' => 20, + 'minMessage' => 'myMinMessage', + 'maxMessage' => 'myMaxMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMinMessage') + ->setParameter('{{ value }}', $formattedValue) + ->setParameter('{{ limit }}', 10) + ->setCode(Range::BELOW_RANGE_ERROR) + ->assertRaised(); + } + + public function getTenthToTwentiethMarch2014() + { + // The provider runs before setUp(), so we need to manually fix + // the default timezone + $this->setDefaultTimezone('UTC'); + + $tests = array( + array(new \DateTime('March 10, 2014')), + array(new \DateTime('March 15, 2014')), + array(new \DateTime('March 20, 2014')), + ); + + if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { + $tests[] = array(new \DateTimeImmutable('March 10, 2014')); + $tests[] = array(new \DateTimeImmutable('March 15, 2014')); + $tests[] = array(new \DateTimeImmutable('March 20, 2014')); + } + + $this->restoreDefaultTimezone(); + + return $tests; + } + + public function getSoonerThanTenthMarch2014() + { + // The provider runs before setUp(), so we need to manually fix + // the default timezone + $this->setDefaultTimezone('UTC'); + + $tests = array( + array(new \DateTime('March 20, 2013'), 'Mar 20, 2013, 12:00 AM'), + array(new \DateTime('March 9, 2014'), 'Mar 9, 2014, 12:00 AM'), + ); + + if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { + $tests[] = array(new \DateTimeImmutable('March 20, 2013'), 'Mar 20, 2013, 12:00 AM'); + $tests[] = array(new \DateTimeImmutable('March 9, 2014'), 'Mar 9, 2014, 12:00 AM'); + } + + $this->restoreDefaultTimezone(); + + return $tests; + } + + public function getLaterThanTwentiethMarch2014() + { + // The provider runs before setUp(), so we need to manually fix + // the default timezone + $this->setDefaultTimezone('UTC'); + + $tests = array( + array(new \DateTime('March 21, 2014'), 'Mar 21, 2014, 12:00 AM'), + array(new \DateTime('March 9, 2015'), 'Mar 9, 2015, 12:00 AM'), + ); + + if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { + $tests[] = array(new \DateTimeImmutable('March 21, 2014'), 'Mar 21, 2014, 12:00 AM'); + $tests[] = array(new \DateTimeImmutable('March 9, 2015'), 'Mar 9, 2015, 12:00 AM'); + } + + $this->restoreDefaultTimezone(); + + return $tests; + } + + /** + * @dataProvider getTenthToTwentiethMarch2014 + */ + public function testValidDatesMin($value) + { + $constraint = new Range(array('min' => 'March 10, 2014')); + $this->validator->validate($value, $constraint); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getTenthToTwentiethMarch2014 + */ + public function testValidDatesMax($value) + { + $constraint = new Range(array('max' => 'March 20, 2014')); + $this->validator->validate($value, $constraint); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getTenthToTwentiethMarch2014 + */ + public function testValidDatesMinMax($value) + { + $constraint = new Range(array('min' => 'March 10, 2014', 'max' => 'March 20, 2014')); + $this->validator->validate($value, $constraint); + + $this->assertNoViolation(); + } + + /** + * @dataProvider getSoonerThanTenthMarch2014 + */ + public function testInvalidDatesMin($value, $dateTimeAsString) + { + // Conversion of dates to string differs between ICU versions + // Make sure we have the correct version loaded + IntlTestHelper::requireIntl($this); + + $constraint = new Range(array( + 'min' => 'March 10, 2014', + 'minMessage' => 'myMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', $dateTimeAsString) + ->setParameter('{{ limit }}', 'Mar 10, 2014, 12:00 AM') + ->setCode(Range::BELOW_RANGE_ERROR) + ->assertRaised(); + } + + /** + * @dataProvider getLaterThanTwentiethMarch2014 + */ + public function testInvalidDatesMax($value, $dateTimeAsString) + { + // Conversion of dates to string differs between ICU versions + // Make sure we have the correct version loaded + IntlTestHelper::requireIntl($this); + + $constraint = new Range(array( + 'max' => 'March 20, 2014', + 'maxMessage' => 'myMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', $dateTimeAsString) + ->setParameter('{{ limit }}', 'Mar 20, 2014, 12:00 AM') + ->setCode(Range::BEYOND_RANGE_ERROR) + ->assertRaised(); + } + + /** + * @dataProvider getLaterThanTwentiethMarch2014 + */ + public function testInvalidDatesCombinedMax($value, $dateTimeAsString) + { + // Conversion of dates to string differs between ICU versions + // Make sure we have the correct version loaded + IntlTestHelper::requireIntl($this); + + $constraint = new Range(array( + 'min' => 'March 10, 2014', + 'max' => 'March 20, 2014', + 'minMessage' => 'myMinMessage', + 'maxMessage' => 'myMaxMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMaxMessage') + ->setParameter('{{ value }}', $dateTimeAsString) + ->setParameter('{{ limit }}', 'Mar 20, 2014, 12:00 AM') + ->setCode(Range::BEYOND_RANGE_ERROR) + ->assertRaised(); + } + + /** + * @dataProvider getSoonerThanTenthMarch2014 + */ + public function testInvalidDatesCombinedMin($value, $dateTimeAsString) + { + // Conversion of dates to string differs between ICU versions + // Make sure we have the correct version loaded + IntlTestHelper::requireIntl($this); + + $constraint = new Range(array( + 'min' => 'March 10, 2014', + 'max' => 'March 20, 2014', + 'minMessage' => 'myMinMessage', + 'maxMessage' => 'myMaxMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMinMessage') + ->setParameter('{{ value }}', $dateTimeAsString) + ->setParameter('{{ limit }}', 'Mar 10, 2014, 12:00 AM') + ->setCode(Range::BELOW_RANGE_ERROR) + ->assertRaised(); + } + + public function getInvalidValues() + { + return array( + array(9.999999), + array(20.000001), + array('9.999999'), + array('20.000001'), + array(new \stdClass()), + ); + } + + public function testNonNumeric() + { + $this->validator->validate('abcd', new Range(array( + 'min' => 10, + 'max' => 20, + 'invalidMessage' => 'myMessage', + ))); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"abcd"') + ->setCode(Range::INVALID_VALUE_ERROR) + ->assertRaised(); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/RegexTest.php b/core/vendor/symfony/validator/Tests/Constraints/RegexTest.php new file mode 100644 index 0000000..ea37bb4 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/RegexTest.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Constraints; + +use Symfony\Component\Validator\Constraints\Regex; + +/** + * @author Bernhard Schussek + */ +class RegexTest extends \PHPUnit_Framework_TestCase +{ + public function testConstraintGetDefaultOption() + { + $constraint = new Regex('/^[0-9]+$/'); + + $this->assertSame('/^[0-9]+$/', $constraint->pattern); + } + + public function provideHtmlPatterns() + { + return array( + // HTML5 wraps the pattern in ^(?:pattern)$ + array('/^[0-9]+$/', '[0-9]+'), + array('/[0-9]+$/', '.*[0-9]+'), + array('/^[0-9]+/', '[0-9]+.*'), + array('/[0-9]+/', '.*[0-9]+.*'), + // We need a smart way to allow matching of patterns that contain + // ^ and $ at various sub-clauses of an or-clause + // .*(pattern).* seems to work correctly + array('/[0-9]$|[a-z]+/', '.*([0-9]$|[a-z]+).*'), + array('/[0-9]$|^[a-z]+/', '.*([0-9]$|^[a-z]+).*'), + array('/^[0-9]|[a-z]+$/', '.*(^[0-9]|[a-z]+$).*'), + // Unescape escaped delimiters + array('/^[0-9]+\/$/', '[0-9]+/'), + array('#^[0-9]+\#$#', '[0-9]+#'), + // Cannot be converted + array('/^[0-9]+$/i', null), + + // Inverse matches are simple, just wrap in + // ((?!pattern).)* + array('/^[0-9]+$/', '((?!^[0-9]+$).)*', false), + array('/[0-9]+$/', '((?![0-9]+$).)*', false), + array('/^[0-9]+/', '((?!^[0-9]+).)*', false), + array('/[0-9]+/', '((?![0-9]+).)*', false), + array('/[0-9]$|[a-z]+/', '((?![0-9]$|[a-z]+).)*', false), + array('/[0-9]$|^[a-z]+/', '((?![0-9]$|^[a-z]+).)*', false), + array('/^[0-9]|[a-z]+$/', '((?!^[0-9]|[a-z]+$).)*', false), + array('/^[0-9]+\/$/', '((?!^[0-9]+/$).)*', false), + array('#^[0-9]+\#$#', '((?!^[0-9]+#$).)*', false), + array('/^[0-9]+$/i', null, false), + ); + } + + /** + * @dataProvider provideHtmlPatterns + */ + public function testGetHtmlPattern($pattern, $htmlPattern, $match = true) + { + $constraint = new Regex(array( + 'pattern' => $pattern, + 'match' => $match, + )); + + $this->assertSame($pattern, $constraint->pattern); + $this->assertSame($htmlPattern, $constraint->getHtmlPattern()); + } + + public function testGetCustomHtmlPattern() + { + $constraint = new Regex(array( + 'pattern' => '((?![0-9]$|[a-z]+).)*', + 'htmlPattern' => 'foobar', + )); + + $this->assertSame('((?![0-9]$|[a-z]+).)*', $constraint->pattern); + $this->assertSame('foobar', $constraint->getHtmlPattern()); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/RegexValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/RegexValidatorTest.php new file mode 100644 index 0000000..61917e3 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/RegexValidatorTest.php @@ -0,0 +1,97 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Regex; +use Symfony\Component\Validator\Constraints\RegexValidator; +use Symfony\Component\Validator\Validation; + +class RegexValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new RegexValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Regex(array('pattern' => '/^[0-9]+$/'))); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $this->validator->validate('', new Regex(array('pattern' => '/^[0-9]+$/'))); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsStringCompatibleType() + { + $this->validator->validate(new \stdClass(), new Regex(array('pattern' => '/^[0-9]+$/'))); + } + + /** + * @dataProvider getValidValues + */ + public function testValidValues($value) + { + $constraint = new Regex(array('pattern' => '/^[0-9]+$/')); + $this->validator->validate($value, $constraint); + + $this->assertNoViolation(); + } + + public function getValidValues() + { + return array( + array(0), + array('0'), + array('090909'), + array(90909), + ); + } + + /** + * @dataProvider getInvalidValues + */ + public function testInvalidValues($value) + { + $constraint = new Regex(array( + 'pattern' => '/^[0-9]+$/', + 'message' => 'myMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$value.'"') + ->assertRaised(); + } + + public function getInvalidValues() + { + return array( + array('abcd'), + array('090foo'), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/TimeValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/TimeValidatorTest.php new file mode 100644 index 0000000..a6ca143 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/TimeValidatorTest.php @@ -0,0 +1,107 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Time; +use Symfony\Component\Validator\Constraints\TimeValidator; +use Symfony\Component\Validator\Validation; + +class TimeValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new TimeValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Time()); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $this->validator->validate('', new Time()); + + $this->assertNoViolation(); + } + + public function testDateTimeClassIsValid() + { + $this->validator->validate(new \DateTime(), new Time()); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsStringCompatibleType() + { + $this->validator->validate(new \stdClass(), new Time()); + } + + /** + * @dataProvider getValidTimes + */ + public function testValidTimes($time) + { + $this->validator->validate($time, new Time()); + + $this->assertNoViolation(); + } + + public function getValidTimes() + { + return array( + array('01:02:03'), + array('00:00:00'), + array('23:59:59'), + ); + } + + /** + * @dataProvider getInvalidTimes + */ + public function testInvalidTimes($time, $code) + { + $constraint = new Time(array( + 'message' => 'myMessage', + )); + + $this->validator->validate($time, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$time.'"') + ->setCode($code) + ->assertRaised(); + } + + public function getInvalidTimes() + { + return array( + array('foobar', Time::INVALID_FORMAT_ERROR), + array('foobar 12:34:56', Time::INVALID_FORMAT_ERROR), + array('12:34:56 foobar', Time::INVALID_FORMAT_ERROR), + array('00:00', Time::INVALID_FORMAT_ERROR), + array('24:00:00', Time::INVALID_TIME_ERROR), + array('00:60:00', Time::INVALID_TIME_ERROR), + array('00:00:60', Time::INVALID_TIME_ERROR), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/TrueValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/TrueValidatorTest.php new file mode 100644 index 0000000..2cdc703 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/TrueValidatorTest.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\True; +use Symfony\Component\Validator\Constraints\TrueValidator; +use Symfony\Component\Validator\Validation; + +class TrueValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new TrueValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new True()); + + $this->assertNoViolation(); + } + + public function testTrueIsValid() + { + $this->validator->validate(true, new True()); + + $this->assertNoViolation(); + } + + public function testFalseIsInvalid() + { + $constraint = new True(array( + 'message' => 'myMessage', + )); + + $this->validator->validate(false, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', 'false') + ->assertRaised(); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/TypeValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/TypeValidatorTest.php new file mode 100644 index 0000000..4836928 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/TypeValidatorTest.php @@ -0,0 +1,185 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Type; +use Symfony\Component\Validator\Constraints\TypeValidator; +use Symfony\Component\Validator\Validation; + +class TypeValidatorTest extends AbstractConstraintValidatorTest +{ + protected static $file; + + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new TypeValidator(); + } + + public function testNullIsValid() + { + $constraint = new Type(array('type' => 'integer')); + + $this->validator->validate(null, $constraint); + + $this->assertNoViolation(); + } + + public function testEmptyIsValidIfString() + { + $constraint = new Type(array('type' => 'string')); + + $this->validator->validate('', $constraint); + + $this->assertNoViolation(); + } + + public function testEmptyIsInvalidIfNoString() + { + $constraint = new Type(array( + 'type' => 'integer', + 'message' => 'myMessage', + )); + + $this->validator->validate('', $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '""') + ->setParameter('{{ type }}', 'integer') + ->assertRaised(); + } + + /** + * @dataProvider getValidValues + */ + public function testValidValues($value, $type) + { + $constraint = new Type(array('type' => $type)); + + $this->validator->validate($value, $constraint); + + $this->assertNoViolation(); + } + + public function getValidValues() + { + $object = new \stdClass(); + $file = $this->createFile(); + + return array( + array(true, 'Boolean'), + array(false, 'Boolean'), + array(true, 'boolean'), + array(false, 'boolean'), + array(true, 'bool'), + array(false, 'bool'), + array(0, 'numeric'), + array('0', 'numeric'), + array(1.5, 'numeric'), + array('1.5', 'numeric'), + array(0, 'integer'), + array(1.5, 'float'), + array('12345', 'string'), + array(array(), 'array'), + array($object, 'object'), + array($object, 'stdClass'), + array($file, 'resource'), + array('12345', 'digit'), + array('12a34', 'alnum'), + array('abcde', 'alpha'), + array("\n\r\t", 'cntrl'), + array('arf12', 'graph'), + array('abcde', 'lower'), + array('ABCDE', 'upper'), + array('arf12', 'print'), + array('*&$()', 'punct'), + array("\n\r\t", 'space'), + array('AB10BC99', 'xdigit'), + ); + } + + /** + * @dataProvider getInvalidValues + */ + public function testInvalidValues($value, $type, $valueAsString) + { + $constraint = new Type(array( + 'type' => $type, + 'message' => 'myMessage', + )); + + $this->validator->validate($value, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', $valueAsString) + ->setParameter('{{ type }}', $type) + ->assertRaised(); + } + + public function getInvalidValues() + { + $object = new \stdClass(); + $file = $this->createFile(); + + return array( + array('foobar', 'numeric', '"foobar"'), + array('foobar', 'boolean', '"foobar"'), + array('0', 'integer', '"0"'), + array('1.5', 'float', '"1.5"'), + array(12345, 'string', '12345'), + array($object, 'boolean', 'object'), + array($object, 'numeric', 'object'), + array($object, 'integer', 'object'), + array($object, 'float', 'object'), + array($object, 'string', 'object'), + array($object, 'resource', 'object'), + array($file, 'boolean', 'resource'), + array($file, 'numeric', 'resource'), + array($file, 'integer', 'resource'), + array($file, 'float', 'resource'), + array($file, 'string', 'resource'), + array($file, 'object', 'resource'), + array('12a34', 'digit', '"12a34"'), + array('1a#23', 'alnum', '"1a#23"'), + array('abcd1', 'alpha', '"abcd1"'), + array("\nabc", 'cntrl', "\"\nabc\""), + array("abc\n", 'graph', "\"abc\n\""), + array('abCDE', 'lower', '"abCDE"'), + array('ABcde', 'upper', '"ABcde"'), + array("\nabc", 'print', "\"\nabc\""), + array('abc&$!', 'punct', '"abc&$!"'), + array("\nabc", 'space', "\"\nabc\""), + array('AR1012', 'xdigit', '"AR1012"'), + ); + } + + protected function createFile() + { + if (!static::$file) { + static::$file = fopen(__FILE__, 'r'); + } + + return static::$file; + } + + public static function tearDownAfterClass() + { + if (static::$file) { + fclose(static::$file); + static::$file = null; + } + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/UrlValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/UrlValidatorTest.php new file mode 100644 index 0000000..3358c79 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/UrlValidatorTest.php @@ -0,0 +1,179 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Url; +use Symfony\Component\Validator\Constraints\UrlValidator; +use Symfony\Component\Validator\Validation; + +class UrlValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new UrlValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Url()); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $this->validator->validate('', new Url()); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsStringCompatibleType() + { + $this->validator->validate(new \stdClass(), new Url()); + } + + /** + * @dataProvider getValidUrls + */ + public function testValidUrls($url) + { + $this->validator->validate($url, new Url()); + + $this->assertNoViolation(); + } + + public function getValidUrls() + { + return array( + array('http://a.pl'), + array('http://www.google.com'), + array('http://www.google.com.'), + array('http://www.google.museum'), + array('https://google.com/'), + array('https://google.com:80/'), + array('http://www.example.coop/'), + array('http://www.test-example.com/'), + array('http://www.symfony.com/'), + array('http://symfony.fake/blog/'), + array('http://symfony.com/?'), + array('http://symfony.com/search?type=&q=url+validator'), + array('http://symfony.com/#'), + array('http://symfony.com/#?'), + array('http://www.symfony.com/doc/current/book/validation.html#supported-constraints'), + array('http://very.long.domain.name.com/'), + array('http://localhost/'), + array('http://127.0.0.1/'), + array('http://127.0.0.1:80/'), + array('http://[::1]/'), + array('http://[::1]:80/'), + array('http://[1:2:3::4:5:6:7]/'), + array('http://sãopaulo.com/'), + array('http://xn--sopaulo-xwa.com/'), + array('http://sãopaulo.com.br/'), + array('http://xn--sopaulo-xwa.com.br/'), + array('http://пример.иÑпытание/'), + array('http://xn--e1afmkfd.xn--80akhbyknj4f/'), + array('http://مثال.إختبار/'), + array('http://xn--mgbh0fb.xn--kgbechtv/'), + array('http://例å­.测试/'), + array('http://xn--fsqu00a.xn--0zwm56d/'), + array('http://例å­.測試/'), + array('http://xn--fsqu00a.xn--g6w251d/'), + array('http://例ãˆ.テスト/'), + array('http://xn--r8jz45g.xn--zckzah/'), + array('http://مثال.آزمایشی/'), + array('http://xn--mgbh0fb.xn--hgbk6aj7f53bba/'), + array('http://실례.테스트/'), + array('http://xn--9n2bp8q.xn--9t4b11yi5a/'), + array('http://العربية.idn.icann.org/'), + array('http://xn--ogb.idn.icann.org/'), + array('http://xn--e1afmkfd.xn--80akhbyknj4f.xn--e1afmkfd/'), + array('http://xn--espaa-rta.xn--ca-ol-fsay5a/'), + array('http://xn--d1abbgf6aiiy.xn--p1ai/'), + array('http://☎.com/'), + array('http://username:password@symfony.com'), + array('http://user-name@symfony.com'), + ); + } + + /** + * @dataProvider getInvalidUrls + */ + public function testInvalidUrls($url) + { + $constraint = new Url(array( + 'message' => 'myMessage', + )); + + $this->validator->validate($url, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$url.'"') + ->assertRaised(); + } + + public function getInvalidUrls() + { + return array( + array('google.com'), + array('://google.com'), + array('http ://google.com'), + array('http:/google.com'), + array('http://goog_le.com'), + array('http://google.com::aa'), + array('http://google.com:aa'), + array('http://symfony.com?'), + array('http://symfony.com#'), + array('ftp://google.fr'), + array('faked://google.fr'), + array('http://127.0.0.1:aa/'), + array('ftp://[::1]/'), + array('http://[::1'), + array('http://hello.☎/'), + array('http://:password@symfony.com'), + array('http://:password@@symfony.com'), + array('http://username:passwordsymfony.com'), + array('http://usern@me:password@symfony.com'), + ); + } + + /** + * @dataProvider getValidCustomUrls + */ + public function testCustomProtocolIsValid($url) + { + $constraint = new Url(array( + 'protocols' => array('ftp', 'file', 'git'), + )); + + $this->validator->validate($url, $constraint); + + $this->assertNoViolation(); + } + + public function getValidCustomUrls() + { + return array( + array('ftp://google.com'), + array('file://127.0.0.1'), + array('git://[::1]/'), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/UuidValidatorTest.php b/core/vendor/symfony/validator/Tests/Constraints/UuidValidatorTest.php new file mode 100644 index 0000000..0abda39 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/UuidValidatorTest.php @@ -0,0 +1,211 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Uuid; +use Symfony\Component\Validator\Constraints\UuidValidator; +use Symfony\Component\Validator\Validation; + +/** + * @author Colin O'Dell + */ +class UuidValidatorTest extends AbstractConstraintValidatorTest +{ + protected function getApiVersion() + { + return Validation::API_VERSION_2_5; + } + + protected function createValidator() + { + return new UuidValidator(); + } + + public function testNullIsValid() + { + $this->validator->validate(null, new Uuid()); + + $this->assertNoViolation(); + } + + public function testEmptyStringIsValid() + { + $this->validator->validate('', new Uuid()); + + $this->assertNoViolation(); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsStringCompatibleType() + { + $this->validator->validate(new \stdClass(), new Uuid()); + } + + /** + * @dataProvider getValidStrictUuids + */ + public function testValidStrictUuids($uuid, $versions = null) + { + $constraint = new Uuid(); + + if (null !== $versions) { + $constraint->versions = $versions; + } + + $this->validator->validate($uuid, $constraint); + + $this->assertNoViolation(); + } + + public function getValidStrictUuids() + { + return array( + array('216fff40-98d9-11e3-a5e2-0800200c9a66'), // Version 1 UUID in lowercase + array('216fff40-98d9-11e3-a5e2-0800200c9a66', array(Uuid::V1_MAC)), + array('216FFF40-98D9-11E3-A5E2-0800200C9A66'), // Version 1 UUID in UPPERCASE + array('456daefb-5aa6-41b5-8dbc-068b05a8b201'), // Version 4 UUID in lowercase + array('456daEFb-5AA6-41B5-8DBC-068B05A8B201'), // Version 4 UUID in mixed case + array('456daEFb-5AA6-41B5-8DBC-068B05A8B201', array(Uuid::V4_RANDOM)), + ); + } + + /** + * @dataProvider getInvalidStrictUuids + */ + public function testInvalidStrictUuids($uuid, $code, $versions = null) + { + $constraint = new Uuid(array( + 'message' => 'testMessage', + )); + + if (null !== $versions) { + $constraint->versions = $versions; + } + + $this->validator->validate($uuid, $constraint); + + $this->buildViolation('testMessage') + ->setParameter('{{ value }}', '"'.$uuid.'"') + ->setCode($code) + ->assertRaised(); + } + + public function getInvalidStrictUuids() + { + return array( + array('216fff40-98d9-11e3-a5e2_0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR), + array('216gff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR), + array('216Gff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR), + array('216fff40-98d9-11e3-a5e-20800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), + array('216f-ff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), + array('216fff40-98d9-11e3-a5e2-0800-200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), + array('216fff40-98d9-11e3-a5e2-0800200c-9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), + array('216fff40-98d9-11e3-a5e20800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), + array('216fff4098d911e3a5e20800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), + array('216fff40-98d9-11e3-a5e2-0800200c9a6', Uuid::TOO_SHORT_ERROR), + array('216fff40-98d9-11e3-a5e2-0800200c9a666', Uuid::TOO_LONG_ERROR), + array('216fff40-98d9-01e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), + array('216fff40-98d9-61e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), + array('216fff40-98d9-71e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), + array('216fff40-98d9-81e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), + array('216fff40-98d9-91e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), + array('216fff40-98d9-a1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), + array('216fff40-98d9-b1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), + array('216fff40-98d9-c1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), + array('216fff40-98d9-d1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), + array('216fff40-98d9-e1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), + array('216fff40-98d9-f1e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR), + array('216fff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR, array(Uuid::V2_DCE, Uuid::V3_MD5, Uuid::V4_RANDOM, Uuid::V5_SHA1)), + array('216fff40-98d9-21e3-a5e2-0800200c9a66', Uuid::INVALID_VERSION_ERROR, array(Uuid::V1_MAC, Uuid::V3_MD5, Uuid::V4_RANDOM, Uuid::V5_SHA1)), + array('216fff40-98d9-11e3-05e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), + array('216fff40-98d9-11e3-15e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), + array('216fff40-98d9-11e3-25e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), + array('216fff40-98d9-11e3-35e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), + array('216fff40-98d9-11e3-45e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), + array('216fff40-98d9-11e3-55e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), + array('216fff40-98d9-11e3-65e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), + array('216fff40-98d9-11e3-75e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), + array('216fff40-98d9-11e3-c5e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), + array('216fff40-98d9-11e3-d5e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), + array('216fff40-98d9-11e3-e5e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), + array('216fff40-98d9-11e3-f5e2-0800200c9a66', Uuid::INVALID_VARIANT_ERROR), + + // Non-standard UUID allowed by some other systems + array('{216fff40-98d9-11e3-a5e2-0800200c9a66}', Uuid::INVALID_CHARACTERS_ERROR), + array('[216fff40-98d9-11e3-a5e2-0800200c9a66]', Uuid::INVALID_CHARACTERS_ERROR), + ); + } + + /** + * @dataProvider getValidNonStrictUuids + */ + public function testValidNonStrictUuids($uuid) + { + $constraint = new Uuid(array( + 'strict' => false, + )); + + $this->validator->validate($uuid, $constraint); + + $this->assertNoViolation(); + } + + public function getValidNonStrictUuids() + { + return array( + array('216fff40-98d9-11e3-a5e2-0800200c9a66'), // Version 1 UUID in lowercase + array('216FFF40-98D9-11E3-A5E2-0800200C9A66'), // Version 1 UUID in UPPERCASE + array('456daefb-5aa6-41b5-8dbc-068b05a8b201'), // Version 4 UUID in lowercase + array('456DAEFb-5AA6-41B5-8DBC-068b05a8B201'), // Version 4 UUID in mixed case + + // Non-standard UUIDs allowed by some other systems + array('216f-ff40-98d9-11e3-a5e2-0800-200c-9a66'), // Non-standard dash positions (every 4 chars) + array('216fff40-98d911e3-a5e20800-200c9a66'), // Non-standard dash positions (every 8 chars) + array('216fff4098d911e3a5e20800200c9a66'), // No dashes at all + array('{216fff40-98d9-11e3-a5e2-0800200c9a66}'), // Wrapped with curly braces + array('[216fff40-98d9-11e3-a5e2-0800200c9a66]'), // Wrapped with squared braces + ); + } + + /** + * @dataProvider getInvalidNonStrictUuids + */ + public function testInvalidNonStrictUuids($uuid, $code) + { + $constraint = new Uuid(array( + 'strict' => false, + 'message' => 'myMessage', + )); + + $this->validator->validate($uuid, $constraint); + + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"'.$uuid.'"') + ->setCode($code) + ->assertRaised(); + } + + public function getInvalidNonStrictUuids() + { + return array( + array('216fff40-98d9-11e3-a5e2_0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR), + array('216gff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR), + array('216Gff40-98d9-11e3-a5e2-0800200c9a66', Uuid::INVALID_CHARACTERS_ERROR), + array('216fff40-98d9-11e3-a5e2_0800200c9a6', Uuid::INVALID_CHARACTERS_ERROR), + array('216fff40-98d9-11e3-a5e-20800200c9a66', Uuid::INVALID_HYPHEN_PLACEMENT_ERROR), + array('216fff40-98d9-11e3-a5e2-0800200c9a6', Uuid::TOO_SHORT_ERROR), + array('216fff40-98d9-11e3-a5e2-0800200c9a666', Uuid::TOO_LONG_ERROR), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Constraints/ValidTest.php b/core/vendor/symfony/validator/Tests/Constraints/ValidTest.php new file mode 100644 index 0000000..3de6ab3 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Constraints/ValidTest.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Valid; + +/** + * @author Bernhard Schussek + */ +class ValidTest extends \PHPUnit_Framework_TestCase +{ + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testRejectGroupsOption() + { + new Valid(array('groups' => 'foo')); + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/CallbackClass.php b/core/vendor/symfony/validator/Tests/Fixtures/CallbackClass.php new file mode 100644 index 0000000..0f6a2f4 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/CallbackClass.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\ExecutionContextInterface; + +/** + * @author Bernhard Schussek + */ +class CallbackClass +{ + public static function callback($object, ExecutionContextInterface $context) + { + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/ClassConstraint.php b/core/vendor/symfony/validator/Tests/Fixtures/ClassConstraint.php new file mode 100644 index 0000000..a4dc777 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/ClassConstraint.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Constraint; + +class ClassConstraint extends Constraint +{ + public function getTargets() + { + return self::CLASS_CONSTRAINT; + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/ConstraintA.php b/core/vendor/symfony/validator/Tests/Fixtures/ConstraintA.php new file mode 100644 index 0000000..8a196dc --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/ConstraintA.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Constraint; + +/** @Annotation */ +class ConstraintA extends Constraint +{ + public $property1; + public $property2; + + public function getDefaultOption() + { + return 'property2'; + } + + public function getTargets() + { + return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/ConstraintAValidator.php b/core/vendor/symfony/validator/Tests/Fixtures/ConstraintAValidator.php new file mode 100644 index 0000000..b3b85c8 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/ConstraintAValidator.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\ExecutionContextInterface; + +class ConstraintAValidator extends ConstraintValidator +{ + public static $passedContext; + + public function initialize(ExecutionContextInterface $context) + { + parent::initialize($context); + + self::$passedContext = $context; + } + + public function validate($value, Constraint $constraint) + { + if ('VALID' != $value) { + $this->context->addViolation('message', array('param' => 'value')); + + return; + } + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/ConstraintB.php b/core/vendor/symfony/validator/Tests/Fixtures/ConstraintB.php new file mode 100644 index 0000000..6258923 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/ConstraintB.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Constraint; + +/** @Annotation */ +class ConstraintB extends Constraint +{ + public function getTargets() + { + return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/ConstraintC.php b/core/vendor/symfony/validator/Tests/Fixtures/ConstraintC.php new file mode 100644 index 0000000..b0418b8 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/ConstraintC.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Constraint; + +/** @Annotation */ +class ConstraintC extends Constraint +{ + public $option1; + + public function getRequiredOptions() + { + return array('option1'); + } + + public function getTargets() + { + return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/ConstraintWithValue.php b/core/vendor/symfony/validator/Tests/Fixtures/ConstraintWithValue.php new file mode 100644 index 0000000..4ebd981 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/ConstraintWithValue.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Constraint; + +/** @Annotation */ +class ConstraintWithValue extends Constraint +{ + public $property; + public $value; + + public function getDefaultOption() + { + return 'property'; + } + + public function getTargets() + { + return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/ConstraintWithValueAsDefault.php b/core/vendor/symfony/validator/Tests/Fixtures/ConstraintWithValueAsDefault.php new file mode 100644 index 0000000..a975e07 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/ConstraintWithValueAsDefault.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Constraint; + +/** @Annotation */ +class ConstraintWithValueAsDefault extends Constraint +{ + public $property; + public $value; + + public function getDefaultOption() + { + return 'value'; + } + + public function getTargets() + { + return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/Countable.php b/core/vendor/symfony/validator/Tests/Fixtures/Countable.php new file mode 100644 index 0000000..282d78d --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/Countable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +class Countable implements \Countable +{ + private $content; + + public function __construct(array $content) + { + $this->content = $content; + } + + public function count() + { + return count($this->content); + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/CustomArrayObject.php b/core/vendor/symfony/validator/Tests/Fixtures/CustomArrayObject.php new file mode 100644 index 0000000..41eac96 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/CustomArrayObject.php @@ -0,0 +1,70 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +/** + * This class is a hand written simplified version of PHP native `ArrayObject` + * class, to show that it behaves differently than the PHP native implementation. + */ +class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, \Serializable +{ + private $array; + + public function __construct(array $array = null) + { + $this->array = $array ?: array(); + } + + public function offsetExists($offset) + { + return array_key_exists($offset, $this->array); + } + + public function offsetGet($offset) + { + return $this->array[$offset]; + } + + public function offsetSet($offset, $value) + { + if (null === $offset) { + $this->array[] = $value; + } else { + $this->array[$offset] = $value; + } + } + + public function offsetUnset($offset) + { + unset($this->array[$offset]); + } + + public function getIterator() + { + return new \ArrayIterator($this->array); + } + + public function count() + { + return count($this->array); + } + + public function serialize() + { + return serialize($this->array); + } + + public function unserialize($serialized) + { + $this->array = (array) unserialize((string) $serialized); + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/Entity.php b/core/vendor/symfony/validator/Tests/Fixtures/Entity.php new file mode 100644 index 0000000..2230d30 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/Entity.php @@ -0,0 +1,100 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Constraints as Assert; +use Symfony\Component\Validator\ExecutionContextInterface; + +/** + * @Symfony\Component\Validator\Tests\Fixtures\ConstraintA + * @Assert\GroupSequence({"Foo", "Entity"}) + * @Assert\Callback({"Symfony\Component\Validator\Tests\Fixtures\CallbackClass", "callback"}) + */ +class Entity extends EntityParent implements EntityInterface +{ + /** + * @Assert\NotNull + * @Assert\Range(min=3) + * @Assert\All({@Assert\NotNull, @Assert\Range(min=3)}), + * @Assert\All(constraints={@Assert\NotNull, @Assert\Range(min=3)}) + * @Assert\Collection(fields={ + * "foo" = {@Assert\NotNull, @Assert\Range(min=3)}, + * "bar" = @Assert\Range(min=5) + * }) + * @Assert\Choice(choices={"A", "B"}, message="Must be one of %choices%") + */ + public $firstName; + protected $lastName; + public $reference; + public $reference2; + private $internal; + public $data = 'Overridden data'; + public $initialized = false; + + public function __construct($internal = null) + { + $this->internal = $internal; + } + + public function getInternal() + { + return $this->internal.' from getter'; + } + + public function setLastName($lastName) + { + $this->lastName = $lastName; + } + + /** + * @Assert\NotNull + */ + public function getLastName() + { + return $this->lastName; + } + + /** + * @Assert\True + */ + public function isValid() + { + return 'valid'; + } + + /** + * @Assert\True + */ + public function hasPermissions() + { + return 'permissions'; + } + + public function getData() + { + return 'Overridden data'; + } + + /** + * @Assert\Callback + */ + public function validateMe(ExecutionContextInterface $context) + { + } + + /** + * @Assert\Callback + */ + public static function validateMeStatic($object, ExecutionContextInterface $context) + { + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/EntityInterface.php b/core/vendor/symfony/validator/Tests/Fixtures/EntityInterface.php new file mode 100644 index 0000000..2901f26 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/EntityInterface.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +interface EntityInterface +{ +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/EntityParent.php b/core/vendor/symfony/validator/Tests/Fixtures/EntityParent.php new file mode 100644 index 0000000..422bb28 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/EntityParent.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Constraints\NotNull; + +class EntityParent +{ + protected $firstName; + private $internal; + private $data = 'Data'; + + /** + * @NotNull + */ + protected $other; + + public function getData() + { + return 'Data'; + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/FailingConstraint.php b/core/vendor/symfony/validator/Tests/Fixtures/FailingConstraint.php new file mode 100644 index 0000000..03019fc --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/FailingConstraint.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Constraint; + +class FailingConstraint extends Constraint +{ + public $message = 'Failed'; + + public function getTargets() + { + return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT); + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/FailingConstraintValidator.php b/core/vendor/symfony/validator/Tests/Fixtures/FailingConstraintValidator.php new file mode 100644 index 0000000..a019dd6 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/FailingConstraintValidator.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; + +class FailingConstraintValidator extends ConstraintValidator +{ + public function validate($value, Constraint $constraint) + { + $this->context->addViolation($constraint->message, array()); + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/FakeClassMetadata.php b/core/vendor/symfony/validator/Tests/Fixtures/FakeClassMetadata.php new file mode 100644 index 0000000..8c76a21 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/FakeClassMetadata.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Mapping\ClassMetadata; + +class FakeClassMetadata extends ClassMetadata +{ + public function addCustomPropertyMetadata($propertyName, $metadata) + { + if (!isset($this->members[$propertyName])) { + $this->members[$propertyName] = array(); + } + + $this->members[$propertyName][] = $metadata; + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/FakeMetadataFactory.php b/core/vendor/symfony/validator/Tests/Fixtures/FakeMetadataFactory.php new file mode 100644 index 0000000..e3f0d9a --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/FakeMetadataFactory.php @@ -0,0 +1,72 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Exception\NoSuchMetadataException; +use Symfony\Component\Validator\MetadataFactoryInterface; +use Symfony\Component\Validator\MetadataInterface; + +class FakeMetadataFactory implements MetadataFactoryInterface +{ + protected $metadatas = array(); + + public function getMetadataFor($class) + { + $hash = null; + + if (is_object($class)) { + $hash = spl_object_hash($class); + $class = get_class($class); + } + + if (!is_string($class)) { + throw new NoSuchMetadataException(sprintf('No metadata for type %s', gettype($class))); + } + + if (!isset($this->metadatas[$class])) { + if (isset($this->metadatas[$hash])) { + return $this->metadatas[$hash]; + } + + throw new NoSuchMetadataException(sprintf('No metadata for "%s"', $class)); + } + + return $this->metadatas[$class]; + } + + public function hasMetadataFor($class) + { + $hash = null; + + if (is_object($class)) { + $hash = spl_object_hash($class); + $class = get_class($class); + } + + if (!is_string($class)) { + return false; + } + + return isset($this->metadatas[$class]) || isset($this->metadatas[$hash]); + } + + public function addMetadata($metadata) + { + $this->metadatas[$metadata->getClassName()] = $metadata; + } + + public function addMetadataForValue($value, MetadataInterface $metadata) + { + $key = is_object($value) ? spl_object_hash($value) : $value; + $this->metadatas[$key] = $metadata; + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/FilesLoader.php b/core/vendor/symfony/validator/Tests/Fixtures/FilesLoader.php new file mode 100644 index 0000000..59d8ee8 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/FilesLoader.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Mapping\Loader\FilesLoader as BaseFilesLoader; +use Symfony\Component\Validator\Mapping\Loader\LoaderInterface; + +abstract class FilesLoader extends BaseFilesLoader +{ + protected $timesCalled = 0; + protected $loader; + + public function __construct(array $paths, LoaderInterface $loader) + { + $this->loader = $loader; + parent::__construct($paths); + } + + protected function getFileLoaderInstance($file) + { + $this->timesCalled++; + + return $this->loader; + } + + public function getTimesCalled() + { + return $this->timesCalled; + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/GroupSequenceProviderEntity.php b/core/vendor/symfony/validator/Tests/Fixtures/GroupSequenceProviderEntity.php new file mode 100644 index 0000000..2b0beaf --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/GroupSequenceProviderEntity.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Constraints as Assert; +use Symfony\Component\Validator\GroupSequenceProviderInterface; + +/** + * @Assert\GroupSequenceProvider + */ +class GroupSequenceProviderEntity implements GroupSequenceProviderInterface +{ + public $firstName; + public $lastName; + + protected $sequence = array(); + + public function __construct($sequence) + { + $this->sequence = $sequence; + } + + public function getGroupSequence() + { + return $this->sequence; + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/InvalidConstraint.php b/core/vendor/symfony/validator/Tests/Fixtures/InvalidConstraint.php new file mode 100644 index 0000000..6a9eaa7 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/InvalidConstraint.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Constraint; + +class InvalidConstraint extends Constraint +{ +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/InvalidConstraintValidator.php b/core/vendor/symfony/validator/Tests/Fixtures/InvalidConstraintValidator.php new file mode 100644 index 0000000..bd9a5cf --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/InvalidConstraintValidator.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +class InvalidConstraintValidator +{ +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/LegacyClassMetadata.php b/core/vendor/symfony/validator/Tests/Fixtures/LegacyClassMetadata.php new file mode 100644 index 0000000..6a832a1 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/LegacyClassMetadata.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\ClassBasedInterface; +use Symfony\Component\Validator\MetadataInterface; +use Symfony\Component\Validator\PropertyMetadataContainerInterface; + +interface LegacyClassMetadata extends MetadataInterface, PropertyMetadataContainerInterface, ClassBasedInterface +{ +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/PropertyConstraint.php b/core/vendor/symfony/validator/Tests/Fixtures/PropertyConstraint.php new file mode 100644 index 0000000..fadb535 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/PropertyConstraint.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Constraint; + +class PropertyConstraint extends Constraint +{ + public function getTargets() + { + return self::PROPERTY_CONSTRAINT; + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/Reference.php b/core/vendor/symfony/validator/Tests/Fixtures/Reference.php new file mode 100644 index 0000000..af29735 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/Reference.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +class Reference +{ + public $value; + + private $privateValue; + + public function setPrivateValue($privateValue) + { + $this->privateValue = $privateValue; + } + + public function getPrivateValue() + { + return $this->privateValue; + } +} diff --git a/core/vendor/symfony/validator/Tests/Fixtures/StubGlobalExecutionContext.php b/core/vendor/symfony/validator/Tests/Fixtures/StubGlobalExecutionContext.php new file mode 100644 index 0000000..84c5a80 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Fixtures/StubGlobalExecutionContext.php @@ -0,0 +1,70 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\ConstraintViolationList; +use Symfony\Component\Validator\GlobalExecutionContextInterface; +use Symfony\Component\Validator\ValidationVisitorInterface; + +/** + * @since 2.5.3 + * + * @author Bernhard Schussek + * + * @deprecated since version 2.5, to be removed in 3.0 + */ +class StubGlobalExecutionContext implements GlobalExecutionContextInterface +{ + private $violations; + private $root; + private $visitor; + + public function __construct($root = null, ValidationVisitorInterface $visitor = null) + { + $this->violations = new ConstraintViolationList(); + $this->root = $root; + $this->visitor = $visitor; + } + + public function getViolations() + { + return $this->violations; + } + + public function setRoot($root) + { + $this->root = $root; + } + + public function getRoot() + { + return $this->root; + } + + public function setVisitor(ValidationVisitorInterface $visitor) + { + $this->visitor = $visitor; + } + + public function getVisitor() + { + return $this->visitor; + } + + public function getValidatorFactory() + { + } + + public function getMetadataFactory() + { + } +} diff --git a/core/vendor/symfony/validator/Tests/LegacyExecutionContextTest.php b/core/vendor/symfony/validator/Tests/LegacyExecutionContextTest.php new file mode 100644 index 0000000..4fec2aa --- /dev/null +++ b/core/vendor/symfony/validator/Tests/LegacyExecutionContextTest.php @@ -0,0 +1,336 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests; + +use Symfony\Component\Validator\Constraints\Collection; +use Symfony\Component\Validator\Constraints\All; +use Symfony\Component\Validator\ConstraintValidatorFactory; +use Symfony\Component\Validator\ConstraintViolation; +use Symfony\Component\Validator\ConstraintViolationList; +use Symfony\Component\Validator\ExecutionContext; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; +use Symfony\Component\Validator\ValidationVisitor; + +/** + * @group legacy + */ +class LegacyExecutionContextTest extends \PHPUnit_Framework_TestCase +{ + const TRANS_DOMAIN = 'trans_domain'; + + private $visitor; + private $violations; + private $metadata; + private $metadataFactory; + private $globalContext; + private $translator; + + /** + * @var ExecutionContext + */ + private $context; + + protected function setUp() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + $this->visitor = $this->getMockBuilder('Symfony\Component\Validator\ValidationVisitor') + ->disableOriginalConstructor() + ->getMock(); + $this->violations = new ConstraintViolationList(); + $this->metadata = $this->getMock('Symfony\Component\Validator\MetadataInterface'); + $this->metadataFactory = $this->getMock('Symfony\Component\Validator\MetadataFactoryInterface'); + $this->globalContext = $this->getMock('Symfony\Component\Validator\GlobalExecutionContextInterface'); + $this->globalContext->expects($this->any()) + ->method('getRoot') + ->will($this->returnValue('Root')); + $this->globalContext->expects($this->any()) + ->method('getViolations') + ->will($this->returnValue($this->violations)); + $this->globalContext->expects($this->any()) + ->method('getVisitor') + ->will($this->returnValue($this->visitor)); + $this->globalContext->expects($this->any()) + ->method('getMetadataFactory') + ->will($this->returnValue($this->metadataFactory)); + $this->translator = $this->getMock('Symfony\Component\Translation\TranslatorInterface'); + $this->context = new ExecutionContext($this->globalContext, $this->translator, self::TRANS_DOMAIN, $this->metadata, 'currentValue', 'Group', 'foo.bar'); + } + + protected function tearDown() + { + $this->globalContext = null; + $this->context = null; + } + + public function testInit() + { + $this->assertCount(0, $this->context->getViolations()); + $this->assertSame('Root', $this->context->getRoot()); + $this->assertSame('foo.bar', $this->context->getPropertyPath()); + $this->assertSame('Group', $this->context->getGroup()); + } + + public function testClone() + { + $clone = clone $this->context; + + // Cloning the context keeps the reference to the original violation + // list. This way we can efficiently duplicate context instances during + // the validation run and only modify the properties that need to be + // changed. + $this->assertSame($this->context->getViolations(), $clone->getViolations()); + } + + public function testAddViolation() + { + $this->translator->expects($this->once()) + ->method('trans') + ->with('Error', array('foo' => 'bar')) + ->will($this->returnValue('Translated error')); + + $this->context->addViolation('Error', array('foo' => 'bar'), 'invalid'); + + $this->assertEquals(new ConstraintViolationList(array( + new ConstraintViolation( + 'Translated error', + 'Error', + array('foo' => 'bar'), + 'Root', + 'foo.bar', + 'invalid' + ), + )), $this->context->getViolations()); + } + + public function testAddViolationUsesPreconfiguredValueIfNotPassed() + { + $this->translator->expects($this->once()) + ->method('trans') + ->with('Error', array()) + ->will($this->returnValue('Translated error')); + + $this->context->addViolation('Error'); + + $this->assertEquals(new ConstraintViolationList(array( + new ConstraintViolation( + 'Translated error', + 'Error', + array(), + 'Root', + 'foo.bar', + 'currentValue' + ), + )), $this->context->getViolations()); + } + + public function testAddViolationUsesPassedNullValue() + { + $this->translator->expects($this->once()) + ->method('trans') + ->with('Error', array('foo1' => 'bar1')) + ->will($this->returnValue('Translated error')); + $this->translator->expects($this->once()) + ->method('transChoice') + ->with('Choice error', 1, array('foo2' => 'bar2')) + ->will($this->returnValue('Translated choice error')); + + // passed null value should override preconfigured value "invalid" + $this->context->addViolation('Error', array('foo1' => 'bar1'), null); + $this->context->addViolation('Choice error', array('foo2' => 'bar2'), null, 1); + + $this->assertEquals(new ConstraintViolationList(array( + new ConstraintViolation( + 'Translated error', + 'Error', + array('foo1' => 'bar1'), + 'Root', + 'foo.bar', + null + ), + new ConstraintViolation( + 'Translated choice error', + 'Choice error', + array('foo2' => 'bar2'), + 'Root', + 'foo.bar', + null, + 1 + ), + )), $this->context->getViolations()); + } + + public function testAddViolationAt() + { + $this->translator->expects($this->once()) + ->method('trans') + ->with('Error', array('foo' => 'bar')) + ->will($this->returnValue('Translated error')); + + // override preconfigured property path + $this->context->addViolationAt('bam.baz', 'Error', array('foo' => 'bar'), 'invalid'); + + $this->assertEquals(new ConstraintViolationList(array( + new ConstraintViolation( + 'Translated error', + 'Error', + array('foo' => 'bar'), + 'Root', + 'foo.bar.bam.baz', + 'invalid' + ), + )), $this->context->getViolations()); + } + + public function testAddViolationAtUsesPreconfiguredValueIfNotPassed() + { + $this->translator->expects($this->once()) + ->method('trans') + ->with('Error', array()) + ->will($this->returnValue('Translated error')); + + $this->context->addViolationAt('bam.baz', 'Error'); + + $this->assertEquals(new ConstraintViolationList(array( + new ConstraintViolation( + 'Translated error', + 'Error', + array(), + 'Root', + 'foo.bar.bam.baz', + 'currentValue' + ), + )), $this->context->getViolations()); + } + + public function testAddViolationAtUsesPassedNullValue() + { + $this->translator->expects($this->once()) + ->method('trans') + ->with('Error', array('foo' => 'bar')) + ->will($this->returnValue('Translated error')); + $this->translator->expects($this->once()) + ->method('transChoice') + ->with('Choice error', 2, array('foo' => 'bar')) + ->will($this->returnValue('Translated choice error')); + + // passed null value should override preconfigured value "invalid" + $this->context->addViolationAt('bam.baz', 'Error', array('foo' => 'bar'), null); + $this->context->addViolationAt('bam.baz', 'Choice error', array('foo' => 'bar'), null, 2); + + $this->assertEquals(new ConstraintViolationList(array( + new ConstraintViolation( + 'Translated error', + 'Error', + array('foo' => 'bar'), + 'Root', + 'foo.bar.bam.baz', + null + ), + new ConstraintViolation( + 'Translated choice error', + 'Choice error', + array('foo' => 'bar'), + 'Root', + 'foo.bar.bam.baz', + null, + 2 + ), + )), $this->context->getViolations()); + } + + public function testAddViolationPluralTranslationError() + { + $this->translator->expects($this->once()) + ->method('transChoice') + ->with('foo') + ->will($this->throwException(new \InvalidArgumentException())); + $this->translator->expects($this->once()) + ->method('trans') + ->with('foo'); + + $this->context->addViolation('foo', array(), null, 2); + } + + public function testGetPropertyPath() + { + $this->assertEquals('foo.bar', $this->context->getPropertyPath()); + } + + public function testGetPropertyPathWithIndexPath() + { + $this->assertEquals('foo.bar[bam]', $this->context->getPropertyPath('[bam]')); + } + + public function testGetPropertyPathWithEmptyPath() + { + $this->assertEquals('foo.bar', $this->context->getPropertyPath('')); + } + + public function testGetPropertyPathWithEmptyCurrentPropertyPath() + { + $this->context = new ExecutionContext($this->globalContext, $this->translator, self::TRANS_DOMAIN, $this->metadata, 'currentValue', 'Group', ''); + + $this->assertEquals('bam.baz', $this->context->getPropertyPath('bam.baz')); + } + + public function testGetPropertyPathWithNestedCollectionsAndAllMixed() + { + $constraints = new Collection(array( + 'shelves' => new All(array('constraints' => array( + new Collection(array( + 'name' => new ConstraintA(), + 'books' => new All(array('constraints' => array( + new ConstraintA(), + ))), + )), + ))), + 'name' => new ConstraintA(), + )); + $data = array( + 'shelves' => array( + array( + 'name' => 'Research', + 'books' => array('foo', 'bar'), + ), + array( + 'name' => 'VALID', + 'books' => array('foozy', 'VALID', 'bazzy'), + ), + ), + 'name' => 'Library', + ); + $expectedViolationPaths = array( + '[shelves][0][name]', + '[shelves][0][books][0]', + '[shelves][0][books][1]', + '[shelves][1][books][0]', + '[shelves][1][books][2]', + '[name]', + ); + + $visitor = new ValidationVisitor('Root', $this->metadataFactory, new ConstraintValidatorFactory(), $this->translator); + $context = new ExecutionContext($visitor, $this->translator, self::TRANS_DOMAIN); + $context->validateValue($data, $constraints); + + foreach ($context->getViolations() as $violation) { + $violationPaths[] = $violation->getPropertyPath(); + } + + $this->assertEquals($expectedViolationPaths, $violationPaths); + } +} + +class ExecutionContextTest_TestClass +{ + public $myProperty; +} diff --git a/core/vendor/symfony/validator/Tests/LegacyValidatorTest.php b/core/vendor/symfony/validator/Tests/LegacyValidatorTest.php new file mode 100644 index 0000000..a38f1ab --- /dev/null +++ b/core/vendor/symfony/validator/Tests/LegacyValidatorTest.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests; + +use Symfony\Component\Translation\IdentityTranslator; +use Symfony\Component\Validator\Constraints\Valid; +use Symfony\Component\Validator\ConstraintValidatorFactory; +use Symfony\Component\Validator\MetadataFactoryInterface; +use Symfony\Component\Validator\Tests\Fixtures\Entity; +use Symfony\Component\Validator\Tests\Validator\AbstractLegacyApiTest; +use Symfony\Component\Validator\Validator as LegacyValidator; + +/** + * @group legacy + */ +class LegacyValidatorTest extends AbstractLegacyApiTest +{ + protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array()) + { + $translator = new IdentityTranslator(); + $translator->setLocale('en'); + + return new LegacyValidator($metadataFactory, new ConstraintValidatorFactory(), $translator, 'validators', $objectInitializers); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ValidatorException + */ + public function testValidateValueRejectsValid() + { + $this->validator->validateValue(new Entity(), new Valid()); + } +} diff --git a/core/vendor/symfony/validator/Tests/Mapping/Cache/DoctrineCacheTest.php b/core/vendor/symfony/validator/Tests/Mapping/Cache/DoctrineCacheTest.php new file mode 100644 index 0000000..a2de306 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/Cache/DoctrineCacheTest.php @@ -0,0 +1,84 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Mapping\Cache; + +use Doctrine\Common\Cache\ArrayCache; +use Symfony\Component\Validator\Mapping\Cache\DoctrineCache; + +class DoctrineCacheTest extends \PHPUnit_Framework_TestCase +{ + private $cache; + + public function testWrite() + { + $meta = $this->getMockBuilder('Symfony\\Component\\Validator\\Mapping\\ClassMetadata') + ->disableOriginalConstructor() + ->setMethods(array('getClassName')) + ->getMock(); + + $meta->expects($this->once()) + ->method('getClassName') + ->will($this->returnValue('bar')); + + $this->cache->write($meta); + + $this->assertInstanceOf( + 'Symfony\\Component\\Validator\\Mapping\\ClassMetadata', + $this->cache->read('bar'), + 'write() stores metadata' + ); + } + + public function testHas() + { + $meta = $this->getMockBuilder('Symfony\\Component\\Validator\\Mapping\\ClassMetadata') + ->disableOriginalConstructor() + ->setMethods(array('getClassName')) + ->getMock(); + + $meta->expects($this->once()) + ->method('getClassName') + ->will($this->returnValue('bar')); + + $this->assertFalse($this->cache->has('bar'), 'has() returns false when there is no entry'); + + $this->cache->write($meta); + $this->assertTrue($this->cache->has('bar'), 'has() returns true when the is an entry'); + } + + public function testRead() + { + $meta = $this->getMockBuilder('Symfony\\Component\\Validator\\Mapping\\ClassMetadata') + ->disableOriginalConstructor() + ->setMethods(array('getClassName')) + ->getMock(); + + $meta->expects($this->once()) + ->method('getClassName') + ->will($this->returnValue('bar')); + + $this->assertFalse($this->cache->read('bar'), 'read() returns false when there is no entry'); + + $this->cache->write($meta); + + $this->assertInstanceOf( + 'Symfony\\Component\\Validator\\Mapping\\ClassMetadata', + $this->cache->read('bar'), + 'read() returns metadata' + ); + } + + protected function setUp() + { + $this->cache = new DoctrineCache(new ArrayCache()); + } +} diff --git a/core/vendor/symfony/validator/Tests/Mapping/Cache/LegacyApcCacheTest.php b/core/vendor/symfony/validator/Tests/Mapping/Cache/LegacyApcCacheTest.php new file mode 100644 index 0000000..bb69cf5 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/Cache/LegacyApcCacheTest.php @@ -0,0 +1,83 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Mapping\Cache; + +use Symfony\Component\Validator\Mapping\Cache\ApcCache; + +/** + * @group legacy + */ +class LegacyApcCacheTest extends \PHPUnit_Framework_TestCase +{ + protected function setUp() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + if (!extension_loaded('apc') || !ini_get('apc.enable_cli')) { + $this->markTestSkipped('APC is not loaded.'); + } + } + + public function testWrite() + { + $meta = $this->getMockBuilder('Symfony\\Component\\Validator\\Mapping\\ClassMetadata') + ->disableOriginalConstructor() + ->setMethods(array('getClassName')) + ->getMock(); + + $meta->expects($this->once()) + ->method('getClassName') + ->will($this->returnValue('bar')); + + $cache = new ApcCache('foo'); + $cache->write($meta); + + $this->assertInstanceOf('Symfony\\Component\\Validator\\Mapping\\ClassMetadata', apc_fetch('foobar'), '->write() stores metadata in APC'); + } + + public function testHas() + { + $meta = $this->getMockBuilder('Symfony\\Component\\Validator\\Mapping\\ClassMetadata') + ->disableOriginalConstructor() + ->setMethods(array('getClassName')) + ->getMock(); + + $meta->expects($this->once()) + ->method('getClassName') + ->will($this->returnValue('bar')); + + apc_delete('foobar'); + + $cache = new ApcCache('foo'); + $this->assertFalse($cache->has('bar'), '->has() returns false when there is no entry'); + + $cache->write($meta); + $this->assertTrue($cache->has('bar'), '->has() returns true when the is an entry'); + } + + public function testRead() + { + $meta = $this->getMockBuilder('Symfony\\Component\\Validator\\Mapping\\ClassMetadata') + ->disableOriginalConstructor() + ->setMethods(array('getClassName')) + ->getMock(); + + $meta->expects($this->once()) + ->method('getClassName') + ->will($this->returnValue('bar')); + + $cache = new ApcCache('foo'); + $cache->write($meta); + + $this->assertInstanceOf('Symfony\\Component\\Validator\\Mapping\\ClassMetadata', $cache->read('bar'), '->read() returns metadata'); + } +} diff --git a/core/vendor/symfony/validator/Tests/Mapping/ClassMetadataTest.php b/core/vendor/symfony/validator/Tests/Mapping/ClassMetadataTest.php new file mode 100644 index 0000000..8634ac5 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/ClassMetadataTest.php @@ -0,0 +1,280 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Mapping; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\Valid; +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintB; +use Symfony\Component\Validator\Tests\Fixtures\PropertyConstraint; + +class ClassMetadataTest extends \PHPUnit_Framework_TestCase +{ + const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity'; + const PARENTCLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent'; + const PROVIDERCLASS = 'Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity'; + + protected $metadata; + + protected function setUp() + { + $this->metadata = new ClassMetadata(self::CLASSNAME); + } + + protected function tearDown() + { + $this->metadata = null; + } + + public function testAddConstraintDoesNotAcceptValid() + { + $this->setExpectedException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); + + $this->metadata->addConstraint(new Valid()); + } + + public function testAddConstraintRequiresClassConstraints() + { + $this->setExpectedException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); + + $this->metadata->addConstraint(new PropertyConstraint()); + } + + public function testAddPropertyConstraints() + { + $this->metadata->addPropertyConstraint('firstName', new ConstraintA()); + $this->metadata->addPropertyConstraint('lastName', new ConstraintB()); + + $this->assertEquals(array('firstName', 'lastName'), $this->metadata->getConstrainedProperties()); + } + + public function testAddMultiplePropertyConstraints() + { + $this->metadata->addPropertyConstraints('lastName', array(new ConstraintA(), new ConstraintB())); + + $constraints = array( + new ConstraintA(array('groups' => array('Default', 'Entity'))), + new ConstraintB(array('groups' => array('Default', 'Entity'))), + ); + + $properties = $this->metadata->getPropertyMetadata('lastName'); + + $this->assertCount(1, $properties); + $this->assertEquals('lastName', $properties[0]->getName()); + $this->assertEquals($constraints, $properties[0]->getConstraints()); + } + + public function testAddGetterConstraints() + { + $this->metadata->addGetterConstraint('lastName', new ConstraintA()); + $this->metadata->addGetterConstraint('lastName', new ConstraintB()); + + $constraints = array( + new ConstraintA(array('groups' => array('Default', 'Entity'))), + new ConstraintB(array('groups' => array('Default', 'Entity'))), + ); + + $properties = $this->metadata->getPropertyMetadata('lastName'); + + $this->assertCount(1, $properties); + $this->assertEquals('getLastName', $properties[0]->getName()); + $this->assertEquals($constraints, $properties[0]->getConstraints()); + } + + public function testAddMultipleGetterConstraints() + { + $this->metadata->addGetterConstraints('lastName', array(new ConstraintA(), new ConstraintB())); + + $constraints = array( + new ConstraintA(array('groups' => array('Default', 'Entity'))), + new ConstraintB(array('groups' => array('Default', 'Entity'))), + ); + + $properties = $this->metadata->getPropertyMetadata('lastName'); + + $this->assertCount(1, $properties); + $this->assertEquals('getLastName', $properties[0]->getName()); + $this->assertEquals($constraints, $properties[0]->getConstraints()); + } + + public function testMergeConstraintsMergesClassConstraints() + { + $parent = new ClassMetadata(self::PARENTCLASS); + $parent->addConstraint(new ConstraintA()); + + $this->metadata->mergeConstraints($parent); + $this->metadata->addConstraint(new ConstraintA()); + + $constraints = array( + new ConstraintA(array('groups' => array( + 'Default', + 'EntityParent', + 'Entity', + ))), + new ConstraintA(array('groups' => array( + 'Default', + 'Entity', + ))), + ); + + $this->assertEquals($constraints, $this->metadata->getConstraints()); + } + + public function testMergeConstraintsMergesMemberConstraints() + { + $parent = new ClassMetadata(self::PARENTCLASS); + $parent->addPropertyConstraint('firstName', new ConstraintA()); + + $this->metadata->mergeConstraints($parent); + $this->metadata->addPropertyConstraint('firstName', new ConstraintA()); + + $constraints = array( + new ConstraintA(array('groups' => array( + 'Default', + 'EntityParent', + 'Entity', + ))), + new ConstraintA(array('groups' => array( + 'Default', + 'Entity', + ))), + ); + + $members = $this->metadata->getPropertyMetadata('firstName'); + + $this->assertCount(1, $members); + $this->assertEquals(self::PARENTCLASS, $members[0]->getClassName()); + $this->assertEquals($constraints, $members[0]->getConstraints()); + } + + public function testMemberMetadatas() + { + $this->metadata->addPropertyConstraint('firstName', new ConstraintA()); + + $this->assertTrue($this->metadata->hasPropertyMetadata('firstName')); + $this->assertFalse($this->metadata->hasPropertyMetadata('non_existant_field')); + } + + public function testMergeConstraintsKeepsPrivateMembersSeparate() + { + $parent = new ClassMetadata(self::PARENTCLASS); + $parent->addPropertyConstraint('internal', new ConstraintA()); + + $this->metadata->mergeConstraints($parent); + $this->metadata->addPropertyConstraint('internal', new ConstraintA()); + + $parentConstraints = array( + new ConstraintA(array('groups' => array( + 'Default', + 'EntityParent', + 'Entity', + ))), + ); + $constraints = array( + new ConstraintA(array('groups' => array( + 'Default', + 'Entity', + ))), + ); + + $members = $this->metadata->getPropertyMetadata('internal'); + + $this->assertCount(2, $members); + $this->assertEquals(self::PARENTCLASS, $members[0]->getClassName()); + $this->assertEquals($parentConstraints, $members[0]->getConstraints()); + $this->assertEquals(self::CLASSNAME, $members[1]->getClassName()); + $this->assertEquals($constraints, $members[1]->getConstraints()); + } + + public function testGetReflectionClass() + { + $reflClass = new \ReflectionClass(self::CLASSNAME); + + $this->assertEquals($reflClass, $this->metadata->getReflectionClass()); + } + + public function testSerialize() + { + $this->metadata->addConstraint(new ConstraintA(array('property1' => 'A'))); + $this->metadata->addConstraint(new ConstraintB(array('groups' => 'TestGroup'))); + $this->metadata->addPropertyConstraint('firstName', new ConstraintA()); + $this->metadata->addGetterConstraint('lastName', new ConstraintB()); + + $metadata = unserialize(serialize($this->metadata)); + + $this->assertEquals($this->metadata, $metadata); + } + + public function testGroupSequencesWorkIfContainingDefaultGroup() + { + $this->metadata->setGroupSequence(array('Foo', $this->metadata->getDefaultGroup())); + } + + public function testGroupSequencesFailIfNotContainingDefaultGroup() + { + $this->setExpectedException('Symfony\Component\Validator\Exception\GroupDefinitionException'); + + $this->metadata->setGroupSequence(array('Foo', 'Bar')); + } + + public function testGroupSequencesFailIfContainingDefault() + { + $this->setExpectedException('Symfony\Component\Validator\Exception\GroupDefinitionException'); + + $this->metadata->setGroupSequence(array('Foo', $this->metadata->getDefaultGroup(), Constraint::DEFAULT_GROUP)); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\GroupDefinitionException + */ + public function testGroupSequenceFailsIfGroupSequenceProviderIsSet() + { + $metadata = new ClassMetadata(self::PROVIDERCLASS); + $metadata->setGroupSequenceProvider(true); + $metadata->setGroupSequence(array('GroupSequenceProviderEntity', 'Foo')); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\GroupDefinitionException + */ + public function testGroupSequenceProviderFailsIfGroupSequenceIsSet() + { + $metadata = new ClassMetadata(self::PROVIDERCLASS); + $metadata->setGroupSequence(array('GroupSequenceProviderEntity', 'Foo')); + $metadata->setGroupSequenceProvider(true); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\GroupDefinitionException + */ + public function testGroupSequenceProviderFailsIfDomainClassIsInvalid() + { + $metadata = new ClassMetadata('stdClass'); + $metadata->setGroupSequenceProvider(true); + } + + public function testGroupSequenceProvider() + { + $metadata = new ClassMetadata(self::PROVIDERCLASS); + $metadata->setGroupSequenceProvider(true); + $this->assertTrue($metadata->isGroupSequenceProvider()); + } + + /** + * https://github.com/symfony/symfony/issues/11604. + */ + public function testGetPropertyMetadataReturnsEmptyArrayWithoutConfiguredMetadata() + { + $this->assertCount(0, $this->metadata->getPropertyMetadata('foo'), '->getPropertyMetadata() returns an empty collection if no metadata is configured for the given property'); + } +} diff --git a/core/vendor/symfony/validator/Tests/Mapping/Factory/BlackHoleMetadataFactoryTest.php b/core/vendor/symfony/validator/Tests/Mapping/Factory/BlackHoleMetadataFactoryTest.php new file mode 100644 index 0000000..641bf91 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/Factory/BlackHoleMetadataFactoryTest.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Mapping\Factory; + +use Symfony\Component\Validator\Mapping\Factory\BlackHoleMetadataFactory; + +class BlackHoleMetadataFactoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @expectedException \LogicException + */ + public function testGetMetadataForThrowsALogicException() + { + $metadataFactory = new BlackHoleMetadataFactory(); + $metadataFactory->getMetadataFor('foo'); + } + + public function testHasMetadataForReturnsFalse() + { + $metadataFactory = new BlackHoleMetadataFactory(); + + $this->assertFalse($metadataFactory->hasMetadataFor('foo')); + } +} diff --git a/core/vendor/symfony/validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php b/core/vendor/symfony/validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php new file mode 100644 index 0000000..74ee912 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php @@ -0,0 +1,118 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Mapping\Factory; + +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory; +use Symfony\Component\Validator\Mapping\Loader\LoaderInterface; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; + +class LazyLoadingMetadataFactoryTest extends \PHPUnit_Framework_TestCase +{ + const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity'; + const PARENTCLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent'; + + public function testLoadClassMetadata() + { + $factory = new LazyLoadingMetadataFactory(new TestLoader()); + $metadata = $factory->getMetadataFor(self::PARENTCLASS); + + $constraints = array( + new ConstraintA(array('groups' => array('Default', 'EntityParent'))), + ); + + $this->assertEquals($constraints, $metadata->getConstraints()); + } + + public function testMergeParentConstraints() + { + $factory = new LazyLoadingMetadataFactory(new TestLoader()); + $metadata = $factory->getMetadataFor(self::CLASSNAME); + + $constraints = array( + new ConstraintA(array('groups' => array( + 'Default', + 'EntityParent', + 'Entity', + ))), + new ConstraintA(array('groups' => array( + 'Default', + 'EntityInterface', + 'Entity', + ))), + new ConstraintA(array('groups' => array( + 'Default', + 'Entity', + ))), + ); + + $this->assertEquals($constraints, $metadata->getConstraints()); + } + + public function testWriteMetadataToCache() + { + $cache = $this->getMock('Symfony\Component\Validator\Mapping\Cache\CacheInterface'); + $factory = new LazyLoadingMetadataFactory(new TestLoader(), $cache); + + $tester = $this; + $constraints = array( + new ConstraintA(array('groups' => array('Default', 'EntityParent'))), + ); + + $cache->expects($this->never()) + ->method('has'); + $cache->expects($this->once()) + ->method('read') + ->with($this->equalTo(self::PARENTCLASS)) + ->will($this->returnValue(false)); + $cache->expects($this->once()) + ->method('write') + ->will($this->returnCallback(function ($metadata) use ($tester, $constraints) { + $tester->assertEquals($constraints, $metadata->getConstraints()); + })); + + $metadata = $factory->getMetadataFor(self::PARENTCLASS); + + $this->assertEquals(self::PARENTCLASS, $metadata->getClassName()); + $this->assertEquals($constraints, $metadata->getConstraints()); + } + + public function testReadMetadataFromCache() + { + $loader = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); + $cache = $this->getMock('Symfony\Component\Validator\Mapping\Cache\CacheInterface'); + $factory = new LazyLoadingMetadataFactory($loader, $cache); + + $tester = $this; + $metadata = new ClassMetadata(self::PARENTCLASS); + $metadata->addConstraint(new ConstraintA()); + + $loader->expects($this->never()) + ->method('loadClassMetadata'); + + $cache->expects($this->never()) + ->method('has'); + $cache->expects($this->once()) + ->method('read') + ->will($this->returnValue($metadata)); + + $this->assertEquals($metadata, $factory->getMetadataFor(self::PARENTCLASS)); + } +} + +class TestLoader implements LoaderInterface +{ + public function loadClassMetadata(ClassMetadata $metadata) + { + $metadata->addConstraint(new ConstraintA()); + } +} diff --git a/core/vendor/symfony/validator/Tests/Mapping/GetterMetadataTest.php b/core/vendor/symfony/validator/Tests/Mapping/GetterMetadataTest.php new file mode 100644 index 0000000..0781599 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/GetterMetadataTest.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Mapping; + +use Symfony\Component\Validator\Mapping\GetterMetadata; +use Symfony\Component\Validator\Tests\Fixtures\Entity; + +class GetterMetadataTest extends \PHPUnit_Framework_TestCase +{ + const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity'; + + public function testInvalidPropertyName() + { + $this->setExpectedException('Symfony\Component\Validator\Exception\ValidatorException'); + + new GetterMetadata(self::CLASSNAME, 'foobar'); + } + + public function testGetPropertyValueFromPublicGetter() + { + // private getters don't work yet because ReflectionMethod::setAccessible() + // does not exist yet in a stable PHP release + + $entity = new Entity('foobar'); + $metadata = new GetterMetadata(self::CLASSNAME, 'internal'); + + $this->assertEquals('foobar from getter', $metadata->getPropertyValue($entity)); + } + + public function testGetPropertyValueFromOverriddenPublicGetter() + { + $entity = new Entity(); + $metadata = new GetterMetadata(self::CLASSNAME, 'data'); + + $this->assertEquals('Overridden data', $metadata->getPropertyValue($entity)); + } + + public function testGetPropertyValueFromIsser() + { + $entity = new Entity(); + $metadata = new GetterMetadata(self::CLASSNAME, 'valid'); + + $this->assertEquals('valid', $metadata->getPropertyValue($entity)); + } + + public function testGetPropertyValueFromHasser() + { + $entity = new Entity(); + $metadata = new GetterMetadata(self::CLASSNAME, 'permissions'); + + $this->assertEquals('permissions', $metadata->getPropertyValue($entity)); + } +} diff --git a/core/vendor/symfony/validator/Tests/Mapping/LegacyElementMetadataTest.php b/core/vendor/symfony/validator/Tests/Mapping/LegacyElementMetadataTest.php new file mode 100644 index 0000000..c77e6fe --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/LegacyElementMetadataTest.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Mapping; + +use Symfony\Component\Validator\Mapping\ElementMetadata; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintB; + +/** + * @group legacy + */ +class LegacyElementMetadataTest extends \PHPUnit_Framework_TestCase +{ + protected $metadata; + + protected function setUp() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + $this->metadata = new TestElementMetadata(); + } + + protected function tearDown() + { + $this->metadata = null; + } + + public function testAddConstraints() + { + $this->metadata->addConstraint($constraint1 = new ConstraintA()); + $this->metadata->addConstraint($constraint2 = new ConstraintA()); + + $this->assertEquals(array($constraint1, $constraint2), $this->metadata->getConstraints()); + } + + public function testMultipleConstraintsOfTheSameType() + { + $constraint1 = new ConstraintA(array('property1' => 'A')); + $constraint2 = new ConstraintA(array('property1' => 'B')); + + $this->metadata->addConstraint($constraint1); + $this->metadata->addConstraint($constraint2); + + $this->assertEquals(array($constraint1, $constraint2), $this->metadata->getConstraints()); + } + + public function testFindConstraintsByGroup() + { + $constraint1 = new ConstraintA(array('groups' => 'TestGroup')); + $constraint2 = new ConstraintB(); + + $this->metadata->addConstraint($constraint1); + $this->metadata->addConstraint($constraint2); + + $this->assertEquals(array($constraint1), $this->metadata->findConstraints('TestGroup')); + } + + public function testSerialize() + { + $this->metadata->addConstraint(new ConstraintA(array('property1' => 'A'))); + $this->metadata->addConstraint(new ConstraintB(array('groups' => 'TestGroup'))); + + $metadata = unserialize(serialize($this->metadata)); + + $this->assertEquals($this->metadata, $metadata); + } +} + +class TestElementMetadata extends ElementMetadata +{ +} diff --git a/core/vendor/symfony/validator/Tests/Mapping/Loader/AbstractStaticMethodLoader.php b/core/vendor/symfony/validator/Tests/Mapping/Loader/AbstractStaticMethodLoader.php new file mode 100644 index 0000000..08f219d --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/Loader/AbstractStaticMethodLoader.php @@ -0,0 +1,10 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Mapping\Loader; + +use Doctrine\Common\Annotations\AnnotationReader; +use Symfony\Component\Validator\Constraints\All; +use Symfony\Component\Validator\Constraints\Callback; +use Symfony\Component\Validator\Constraints\Choice; +use Symfony\Component\Validator\Constraints\Collection; +use Symfony\Component\Validator\Constraints\NotNull; +use Symfony\Component\Validator\Constraints\Range; +use Symfony\Component\Validator\Constraints\True; +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Mapping\Loader\AnnotationLoader; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; + +class AnnotationLoaderTest extends \PHPUnit_Framework_TestCase +{ + public function testLoadClassMetadataReturnsTrueIfSuccessful() + { + $reader = new AnnotationReader(); + $loader = new AnnotationLoader($reader); + $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + + $this->assertTrue($loader->loadClassMetadata($metadata)); + } + + public function testLoadClassMetadataReturnsFalseIfNotSuccessful() + { + $loader = new AnnotationLoader(new AnnotationReader()); + $metadata = new ClassMetadata('\stdClass'); + + $this->assertFalse($loader->loadClassMetadata($metadata)); + } + + public function testLoadClassMetadata() + { + $loader = new AnnotationLoader(new AnnotationReader()); + $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + + $loader->loadClassMetadata($metadata); + + $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + $expected->setGroupSequence(array('Foo', 'Entity')); + $expected->addConstraint(new ConstraintA()); + $expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback'))); + $expected->addConstraint(new Callback('validateMe')); + $expected->addConstraint(new Callback('validateMeStatic')); + $expected->addPropertyConstraint('firstName', new NotNull()); + $expected->addPropertyConstraint('firstName', new Range(array('min' => 3))); + $expected->addPropertyConstraint('firstName', new All(array(new NotNull(), new Range(array('min' => 3))))); + $expected->addPropertyConstraint('firstName', new All(array('constraints' => array(new NotNull(), new Range(array('min' => 3)))))); + $expected->addPropertyConstraint('firstName', new Collection(array('fields' => array( + 'foo' => array(new NotNull(), new Range(array('min' => 3))), + 'bar' => new Range(array('min' => 5)), + )))); + $expected->addPropertyConstraint('firstName', new Choice(array( + 'message' => 'Must be one of %choices%', + 'choices' => array('A', 'B'), + ))); + $expected->addGetterConstraint('lastName', new NotNull()); + $expected->addGetterConstraint('valid', new True()); + $expected->addGetterConstraint('permissions', new True()); + + // load reflection class so that the comparison passes + $expected->getReflectionClass(); + + $this->assertEquals($expected, $metadata); + } + + /** + * Test MetaData merge with parent annotation. + */ + public function testLoadParentClassMetadata() + { + $loader = new AnnotationLoader(new AnnotationReader()); + + // Load Parent MetaData + $parent_metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\EntityParent'); + $loader->loadClassMetadata($parent_metadata); + + $expected_parent = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\EntityParent'); + $expected_parent->addPropertyConstraint('other', new NotNull()); + $expected_parent->getReflectionClass(); + + $this->assertEquals($expected_parent, $parent_metadata); + } + /** + * Test MetaData merge with parent annotation. + */ + public function testLoadClassMetadataAndMerge() + { + $loader = new AnnotationLoader(new AnnotationReader()); + + // Load Parent MetaData + $parent_metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\EntityParent'); + $loader->loadClassMetadata($parent_metadata); + + $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + + // Merge parent metaData. + $metadata->mergeConstraints($parent_metadata); + + $loader->loadClassMetadata($metadata); + + $expected_parent = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\EntityParent'); + $expected_parent->addPropertyConstraint('other', new NotNull()); + $expected_parent->getReflectionClass(); + + $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + $expected->mergeConstraints($expected_parent); + + $expected->setGroupSequence(array('Foo', 'Entity')); + $expected->addConstraint(new ConstraintA()); + $expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback'))); + $expected->addConstraint(new Callback('validateMe')); + $expected->addConstraint(new Callback('validateMeStatic')); + $expected->addPropertyConstraint('firstName', new NotNull()); + $expected->addPropertyConstraint('firstName', new Range(array('min' => 3))); + $expected->addPropertyConstraint('firstName', new All(array(new NotNull(), new Range(array('min' => 3))))); + $expected->addPropertyConstraint('firstName', new All(array('constraints' => array(new NotNull(), new Range(array('min' => 3)))))); + $expected->addPropertyConstraint('firstName', new Collection(array('fields' => array( + 'foo' => array(new NotNull(), new Range(array('min' => 3))), + 'bar' => new Range(array('min' => 5)), + )))); + $expected->addPropertyConstraint('firstName', new Choice(array( + 'message' => 'Must be one of %choices%', + 'choices' => array('A', 'B'), + ))); + $expected->addGetterConstraint('lastName', new NotNull()); + $expected->addGetterConstraint('valid', new True()); + $expected->addGetterConstraint('permissions', new True()); + + // load reflection class so that the comparison passes + $expected->getReflectionClass(); + + $this->assertEquals($expected, $metadata); + } + + public function testLoadGroupSequenceProviderAnnotation() + { + $loader = new AnnotationLoader(new AnnotationReader()); + + $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity'); + $loader->loadClassMetadata($metadata); + + $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity'); + $expected->setGroupSequenceProvider(true); + $expected->getReflectionClass(); + + $this->assertEquals($expected, $metadata); + } +} diff --git a/core/vendor/symfony/validator/Tests/Mapping/Loader/FilesLoaderTest.php b/core/vendor/symfony/validator/Tests/Mapping/Loader/FilesLoaderTest.php new file mode 100644 index 0000000..09e6e44 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/Loader/FilesLoaderTest.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Mapping\Loader; + +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Mapping\Loader\LoaderInterface; + +class FilesLoaderTest extends \PHPUnit_Framework_TestCase +{ + public function testCallsGetFileLoaderInstanceForeachPath() + { + $loader = $this->getFilesLoader($this->getFileLoader()); + $this->assertEquals(4, $loader->getTimesCalled()); + } + + public function testCallsActualFileLoaderForMetadata() + { + $fileLoader = $this->getFileLoader(); + $fileLoader->expects($this->exactly(4)) + ->method('loadClassMetadata'); + $loader = $this->getFilesLoader($fileLoader); + $loader->loadClassMetadata(new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity')); + } + + public function getFilesLoader(LoaderInterface $loader) + { + return $this->getMockForAbstractClass('Symfony\Component\Validator\Tests\Fixtures\FilesLoader', array(array( + __DIR__.'/constraint-mapping.xml', + __DIR__.'/constraint-mapping.yaml', + __DIR__.'/constraint-mapping.test', + __DIR__.'/constraint-mapping.txt', + ), $loader)); + } + + public function getFileLoader() + { + return $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); + } +} diff --git a/core/vendor/symfony/validator/Tests/Mapping/Loader/LoaderChainTest.php b/core/vendor/symfony/validator/Tests/Mapping/Loader/LoaderChainTest.php new file mode 100644 index 0000000..647a568 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/Loader/LoaderChainTest.php @@ -0,0 +1,84 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Mapping\Loader; + +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Mapping\Loader\LoaderChain; + +class LoaderChainTest extends \PHPUnit_Framework_TestCase +{ + public function testAllLoadersAreCalled() + { + $metadata = new ClassMetadata('\stdClass'); + + $loader1 = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); + $loader1->expects($this->once()) + ->method('loadClassMetadata') + ->with($this->equalTo($metadata)); + + $loader2 = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); + $loader2->expects($this->once()) + ->method('loadClassMetadata') + ->with($this->equalTo($metadata)); + + $chain = new LoaderChain(array( + $loader1, + $loader2, + )); + + $chain->loadClassMetadata($metadata); + } + + public function testReturnsTrueIfAnyLoaderReturnedTrue() + { + $metadata = new ClassMetadata('\stdClass'); + + $loader1 = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); + $loader1->expects($this->any()) + ->method('loadClassMetadata') + ->will($this->returnValue(true)); + + $loader2 = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); + $loader2->expects($this->any()) + ->method('loadClassMetadata') + ->will($this->returnValue(false)); + + $chain = new LoaderChain(array( + $loader1, + $loader2, + )); + + $this->assertTrue($chain->loadClassMetadata($metadata)); + } + + public function testReturnsFalseIfNoLoaderReturnedTrue() + { + $metadata = new ClassMetadata('\stdClass'); + + $loader1 = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); + $loader1->expects($this->any()) + ->method('loadClassMetadata') + ->will($this->returnValue(false)); + + $loader2 = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); + $loader2->expects($this->any()) + ->method('loadClassMetadata') + ->will($this->returnValue(false)); + + $chain = new LoaderChain(array( + $loader1, + $loader2, + )); + + $this->assertFalse($chain->loadClassMetadata($metadata)); + } +} diff --git a/core/vendor/symfony/validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php b/core/vendor/symfony/validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php new file mode 100644 index 0000000..5829336 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php @@ -0,0 +1,143 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Mapping\Loader; + +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; + +class StaticMethodLoaderTest extends \PHPUnit_Framework_TestCase +{ + private $errorLevel; + + protected function setUp() + { + $this->errorLevel = error_reporting(); + } + + protected function tearDown() + { + error_reporting($this->errorLevel); + } + + public function testLoadClassMetadataReturnsTrueIfSuccessful() + { + $loader = new StaticMethodLoader('loadMetadata'); + $metadata = new ClassMetadata(__NAMESPACE__.'\StaticLoaderEntity'); + + $this->assertTrue($loader->loadClassMetadata($metadata)); + } + + public function testLoadClassMetadataReturnsFalseIfNotSuccessful() + { + $loader = new StaticMethodLoader('loadMetadata'); + $metadata = new ClassMetadata('\stdClass'); + + $this->assertFalse($loader->loadClassMetadata($metadata)); + } + + public function testLoadClassMetadata() + { + $loader = new StaticMethodLoader('loadMetadata'); + $metadata = new ClassMetadata(__NAMESPACE__.'\StaticLoaderEntity'); + + $loader->loadClassMetadata($metadata); + + $this->assertEquals(StaticLoaderEntity::$invokedWith, $metadata); + } + + public function testLoadClassMetadataDoesNotRepeatLoadWithParentClasses() + { + $loader = new StaticMethodLoader('loadMetadata'); + $metadata = new ClassMetadata(__NAMESPACE__.'\StaticLoaderDocument'); + $loader->loadClassMetadata($metadata); + $this->assertCount(0, $metadata->getConstraints()); + + $loader = new StaticMethodLoader('loadMetadata'); + $metadata = new ClassMetadata(__NAMESPACE__.'\BaseStaticLoaderDocument'); + $loader->loadClassMetadata($metadata); + $this->assertCount(1, $metadata->getConstraints()); + } + + public function testLoadClassMetadataIgnoresInterfaces() + { + $loader = new StaticMethodLoader('loadMetadata'); + $metadata = new ClassMetadata(__NAMESPACE__.'\StaticLoaderInterface'); + + $loader->loadClassMetadata($metadata); + + $this->assertCount(0, $metadata->getConstraints()); + } + + public function testLoadClassMetadataInAbstractClasses() + { + $loader = new StaticMethodLoader('loadMetadata'); + $metadata = new ClassMetadata(__NAMESPACE__.'\AbstractStaticLoader'); + + $loader->loadClassMetadata($metadata); + + $this->assertCount(1, $metadata->getConstraints()); + } + + public function testLoadClassMetadataIgnoresAbstractMethods() + { + // Disable error reporting, as AbstractStaticMethodLoader produces a + // strict standards error + error_reporting(0); + + if (0 !== error_reporting()) { + $this->markTestSkipped('Could not disable error reporting'); + } + + $metadata = new ClassMetadata(__NAMESPACE__.'\AbstractStaticMethodLoader'); + + $loader = new StaticMethodLoader('loadMetadata'); + $loader->loadClassMetadata($metadata); + + $this->assertCount(0, $metadata->getConstraints()); + } +} + +interface StaticLoaderInterface +{ + public static function loadMetadata(ClassMetadata $metadata); +} + +abstract class AbstractStaticLoader +{ + public static function loadMetadata(ClassMetadata $metadata) + { + $metadata->addConstraint(new ConstraintA()); + } +} + +class StaticLoaderEntity +{ + public static $invokedWith = null; + + public static function loadMetadata(ClassMetadata $metadata) + { + self::$invokedWith = $metadata; + } +} + +class StaticLoaderDocument extends BaseStaticLoaderDocument +{ +} + +class BaseStaticLoaderDocument +{ + public static function loadMetadata(ClassMetadata $metadata) + { + $metadata->addConstraint(new ConstraintA()); + } +} diff --git a/core/vendor/symfony/validator/Tests/Mapping/Loader/XmlFileLoaderTest.php b/core/vendor/symfony/validator/Tests/Mapping/Loader/XmlFileLoaderTest.php new file mode 100644 index 0000000..8ab2065 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/Loader/XmlFileLoaderTest.php @@ -0,0 +1,133 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Mapping\Loader; + +use Symfony\Component\Validator\Constraints\All; +use Symfony\Component\Validator\Constraints\Callback; +use Symfony\Component\Validator\Constraints\Choice; +use Symfony\Component\Validator\Constraints\Collection; +use Symfony\Component\Validator\Constraints\NotNull; +use Symfony\Component\Validator\Constraints\Range; +use Symfony\Component\Validator\Constraints\Regex; +use Symfony\Component\Validator\Constraints\True; +use Symfony\Component\Validator\Exception\MappingException; +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Mapping\Loader\XmlFileLoader; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintB; + +class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase +{ + public function testLoadClassMetadataReturnsTrueIfSuccessful() + { + $loader = new XmlFileLoader(__DIR__.'/constraint-mapping.xml'); + $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + + $this->assertTrue($loader->loadClassMetadata($metadata)); + } + + public function testLoadClassMetadataReturnsFalseIfNotSuccessful() + { + $loader = new XmlFileLoader(__DIR__.'/constraint-mapping.xml'); + $metadata = new ClassMetadata('\stdClass'); + + $this->assertFalse($loader->loadClassMetadata($metadata)); + } + + public function testLoadClassMetadata() + { + $loader = new XmlFileLoader(__DIR__.'/constraint-mapping.xml'); + $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + + $loader->loadClassMetadata($metadata); + + $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + $expected->setGroupSequence(array('Foo', 'Entity')); + $expected->addConstraint(new ConstraintA()); + $expected->addConstraint(new ConstraintB()); + $expected->addConstraint(new Callback('validateMe')); + $expected->addConstraint(new Callback('validateMeStatic')); + $expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback'))); + $expected->addPropertyConstraint('firstName', new NotNull()); + $expected->addPropertyConstraint('firstName', new Range(array('min' => 3))); + $expected->addPropertyConstraint('firstName', new Choice(array('A', 'B'))); + $expected->addPropertyConstraint('firstName', new All(array(new NotNull(), new Range(array('min' => 3))))); + $expected->addPropertyConstraint('firstName', new All(array('constraints' => array(new NotNull(), new Range(array('min' => 3)))))); + $expected->addPropertyConstraint('firstName', new Collection(array('fields' => array( + 'foo' => array(new NotNull(), new Range(array('min' => 3))), + 'bar' => array(new Range(array('min' => 5))), + )))); + $expected->addPropertyConstraint('firstName', new Choice(array( + 'message' => 'Must be one of %choices%', + 'choices' => array('A', 'B'), + ))); + $expected->addGetterConstraint('lastName', new NotNull()); + $expected->addGetterConstraint('valid', new True()); + $expected->addGetterConstraint('permissions', new True()); + + $this->assertEquals($expected, $metadata); + } + + public function testLoadClassMetadataWithNonStrings() + { + $loader = new XmlFileLoader(__DIR__.'/constraint-mapping-non-strings.xml'); + $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + + $loader->loadClassMetadata($metadata); + + $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + $expected->addPropertyConstraint('firstName', new Regex(array('pattern' => '/^1/', 'match' => false))); + + $properties = $metadata->getPropertyMetadata('firstName'); + $constraints = $properties[0]->getConstraints(); + + $this->assertFalse($constraints[0]->match); + } + + public function testLoadGroupSequenceProvider() + { + $loader = new XmlFileLoader(__DIR__.'/constraint-mapping.xml'); + $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity'); + + $loader->loadClassMetadata($metadata); + + $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity'); + $expected->setGroupSequenceProvider(true); + + $this->assertEquals($expected, $metadata); + } + + public function testThrowExceptionIfDocTypeIsSet() + { + $loader = new XmlFileLoader(__DIR__.'/withdoctype.xml'); + $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + + $this->setExpectedException('\Symfony\Component\Validator\Exception\MappingException'); + $loader->loadClassMetadata($metadata); + } + + /** + * @see https://github.com/symfony/symfony/pull/12158 + */ + public function testDoNotModifyStateIfExceptionIsThrown() + { + $loader = new XmlFileLoader(__DIR__.'/withdoctype.xml'); + $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + + try { + $loader->loadClassMetadata($metadata); + } catch (MappingException $e) { + $this->setExpectedException('\Symfony\Component\Validator\Exception\MappingException'); + $loader->loadClassMetadata($metadata); + } + } +} diff --git a/core/vendor/symfony/validator/Tests/Mapping/Loader/YamlFileLoaderTest.php b/core/vendor/symfony/validator/Tests/Mapping/Loader/YamlFileLoaderTest.php new file mode 100644 index 0000000..806a2b0 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/Loader/YamlFileLoaderTest.php @@ -0,0 +1,123 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Mapping\Loader; + +use Symfony\Component\Validator\Constraints\All; +use Symfony\Component\Validator\Constraints\Callback; +use Symfony\Component\Validator\Constraints\Choice; +use Symfony\Component\Validator\Constraints\Collection; +use Symfony\Component\Validator\Constraints\NotNull; +use Symfony\Component\Validator\Constraints\Range; +use Symfony\Component\Validator\Constraints\True; +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Mapping\Loader\YamlFileLoader; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintB; + +class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase +{ + public function testLoadClassMetadataReturnsFalseIfEmpty() + { + $loader = new YamlFileLoader(__DIR__.'/empty-mapping.yml'); + $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + + $this->assertFalse($loader->loadClassMetadata($metadata)); + } + + public function testLoadClassMetadataThrowsExceptionIfNotAnArray() + { + $loader = new YamlFileLoader(__DIR__.'/nonvalid-mapping.yml'); + $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + + $this->setExpectedException('\InvalidArgumentException'); + $loader->loadClassMetadata($metadata); + } + + /** + * @see https://github.com/symfony/symfony/pull/12158 + */ + public function testDoNotModifyStateIfExceptionIsThrown() + { + $loader = new YamlFileLoader(__DIR__.'/nonvalid-mapping.yml'); + $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + try { + $loader->loadClassMetadata($metadata); + } catch (\InvalidArgumentException $e) { + // Call again. Again an exception should be thrown + $this->setExpectedException('\InvalidArgumentException'); + $loader->loadClassMetadata($metadata); + } + } + + public function testLoadClassMetadataReturnsTrueIfSuccessful() + { + $loader = new YamlFileLoader(__DIR__.'/constraint-mapping.yml'); + $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + + $this->assertTrue($loader->loadClassMetadata($metadata)); + } + + public function testLoadClassMetadataReturnsFalseIfNotSuccessful() + { + $loader = new YamlFileLoader(__DIR__.'/constraint-mapping.yml'); + $metadata = new ClassMetadata('\stdClass'); + + $this->assertFalse($loader->loadClassMetadata($metadata)); + } + + public function testLoadClassMetadata() + { + $loader = new YamlFileLoader(__DIR__.'/constraint-mapping.yml'); + $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + + $loader->loadClassMetadata($metadata); + + $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + $expected->setGroupSequence(array('Foo', 'Entity')); + $expected->addConstraint(new ConstraintA()); + $expected->addConstraint(new ConstraintB()); + $expected->addConstraint(new Callback('validateMe')); + $expected->addConstraint(new Callback('validateMeStatic')); + $expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback'))); + $expected->addPropertyConstraint('firstName', new NotNull()); + $expected->addPropertyConstraint('firstName', new Range(array('min' => 3))); + $expected->addPropertyConstraint('firstName', new Choice(array('A', 'B'))); + $expected->addPropertyConstraint('firstName', new All(array(new NotNull(), new Range(array('min' => 3))))); + $expected->addPropertyConstraint('firstName', new All(array('constraints' => array(new NotNull(), new Range(array('min' => 3)))))); + $expected->addPropertyConstraint('firstName', new Collection(array('fields' => array( + 'foo' => array(new NotNull(), new Range(array('min' => 3))), + 'bar' => array(new Range(array('min' => 5))), + )))); + $expected->addPropertyConstraint('firstName', new Choice(array( + 'message' => 'Must be one of %choices%', + 'choices' => array('A', 'B'), + ))); + $expected->addGetterConstraint('lastName', new NotNull()); + $expected->addGetterConstraint('valid', new True()); + $expected->addGetterConstraint('permissions', new True()); + + $this->assertEquals($expected, $metadata); + } + + public function testLoadGroupSequenceProvider() + { + $loader = new YamlFileLoader(__DIR__.'/constraint-mapping.yml'); + $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity'); + + $loader->loadClassMetadata($metadata); + + $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity'); + $expected->setGroupSequenceProvider(true); + + $this->assertEquals($expected, $metadata); + } +} diff --git a/core/vendor/symfony/validator/Tests/Mapping/Loader/constraint-mapping-non-strings.xml b/core/vendor/symfony/validator/Tests/Mapping/Loader/constraint-mapping-non-strings.xml new file mode 100644 index 0000000..dfd5edd --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/Loader/constraint-mapping-non-strings.xml @@ -0,0 +1,19 @@ + + + + + Symfony\Component\Validator\Tests\Fixtures\ + + + + + + + + + + + + diff --git a/core/vendor/symfony/validator/Tests/Mapping/Loader/constraint-mapping.xml b/core/vendor/symfony/validator/Tests/Mapping/Loader/constraint-mapping.xml new file mode 100644 index 0000000..9b637e9 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/Loader/constraint-mapping.xml @@ -0,0 +1,119 @@ + + + + + Symfony\Component\Validator\Tests\Fixtures\ + + + + + Foo + Entity + + + + + + + + + + + + validateMe + + validateMeStatic + + + Symfony\Component\Validator\Tests\Fixtures\CallbackClass + callback + + + + + + + + + + + + + + + + + A + B + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/vendor/symfony/validator/Tests/Mapping/Loader/constraint-mapping.yml b/core/vendor/symfony/validator/Tests/Mapping/Loader/constraint-mapping.yml new file mode 100644 index 0000000..e96c5e0 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/Loader/constraint-mapping.yml @@ -0,0 +1,62 @@ +namespaces: + custom: Symfony\Component\Validator\Tests\Fixtures\ + +Symfony\Component\Validator\Tests\Fixtures\Entity: + group_sequence: + - Foo + - Entity + + constraints: + # Custom constraint + - Symfony\Component\Validator\Tests\Fixtures\ConstraintA: ~ + # Custom constraint with namespaces prefix + - "custom:ConstraintB": ~ + # Callbacks + - Callback: validateMe + - Callback: validateMeStatic + - Callback: [Symfony\Component\Validator\Tests\Fixtures\CallbackClass, callback] + + properties: + firstName: + # Constraint without value + - NotNull: ~ + # Constraint with single value + - Range: + min: 3 + # Constraint with multiple values + - Choice: [A, B] + # Constraint with child constraints + - All: + - NotNull: ~ + - Range: + min: 3 + # Option with child constraints + - All: + constraints: + - NotNull: ~ + - Range: + min: 3 + # Value with child constraints + - Collection: + fields: + foo: + - NotNull: ~ + - Range: + min: 3 + bar: + - Range: + min: 5 + # Constraint with options + - Choice: { choices: [A, B], message: Must be one of %choices% } + dummy: + + getters: + lastName: + - NotNull: ~ + valid: + - "True": ~ + permissions: + - "True": ~ + +Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity: + group_sequence_provider: true diff --git a/core/vendor/symfony/validator/Tests/Mapping/Loader/empty-mapping.yml b/core/vendor/symfony/validator/Tests/Mapping/Loader/empty-mapping.yml new file mode 100644 index 0000000..e69de29 diff --git a/core/vendor/symfony/validator/Tests/Mapping/Loader/nonvalid-mapping.yml b/core/vendor/symfony/validator/Tests/Mapping/Loader/nonvalid-mapping.yml new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/Loader/nonvalid-mapping.yml @@ -0,0 +1 @@ +foo diff --git a/core/vendor/symfony/validator/Tests/Mapping/Loader/withdoctype.xml b/core/vendor/symfony/validator/Tests/Mapping/Loader/withdoctype.xml new file mode 100644 index 0000000..0beacc3 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/Loader/withdoctype.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/core/vendor/symfony/validator/Tests/Mapping/MemberMetadataTest.php b/core/vendor/symfony/validator/Tests/Mapping/MemberMetadataTest.php new file mode 100644 index 0000000..a4473bc --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/MemberMetadataTest.php @@ -0,0 +1,123 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Mapping; + +use Symfony\Component\Validator\Constraints\Valid; +use Symfony\Component\Validator\Mapping\MemberMetadata; +use Symfony\Component\Validator\Tests\Fixtures\ClassConstraint; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; +use Symfony\Component\Validator\Tests\Fixtures\ConstraintB; + +class MemberMetadataTest extends \PHPUnit_Framework_TestCase +{ + protected $metadata; + + protected function setUp() + { + $this->metadata = new TestMemberMetadata( + 'Symfony\Component\Validator\Tests\Fixtures\Entity', + 'getLastName', + 'lastName' + ); + } + + protected function tearDown() + { + $this->metadata = null; + } + + /** + * @group legacy + */ + public function testLegacyAddValidSetsMemberToCascaded() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + $result = $this->metadata->addConstraint(new Valid()); + + $this->assertEquals(array(), $this->metadata->getConstraints()); + $this->assertEquals($result, $this->metadata); + $this->assertTrue($this->metadata->isCascaded()); + } + + /** + * @group legacy + */ + public function testLegacyAddOtherConstraintDoesNotSetMemberToCascaded() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + $result = $this->metadata->addConstraint($constraint = new ConstraintA()); + + $this->assertEquals(array($constraint), $this->metadata->getConstraints()); + $this->assertEquals($result, $this->metadata); + $this->assertFalse($this->metadata->isCascaded()); + } + + public function testAddConstraintRequiresClassConstraints() + { + $this->setExpectedException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); + + $this->metadata->addConstraint(new ClassConstraint()); + } + + public function testSerialize() + { + $this->metadata->addConstraint(new ConstraintA(array('property1' => 'A'))); + $this->metadata->addConstraint(new ConstraintB(array('groups' => 'TestGroup'))); + + $metadata = unserialize(serialize($this->metadata)); + + $this->assertEquals($this->metadata, $metadata); + } + + public function testSerializeCollectionCascaded() + { + $this->metadata->addConstraint(new Valid(array('traverse' => true))); + + $metadata = unserialize(serialize($this->metadata)); + + $this->assertEquals($this->metadata, $metadata); + } + + /** + * @group legacy + */ + public function testLegacySerializeCollectionCascadedDeeply() + { + $this->metadata->addConstraint(new Valid(array('traverse' => true))); + + $metadata = unserialize(serialize($this->metadata)); + + $this->assertEquals($this->metadata, $metadata); + } + + public function testSerializeCollectionNotCascaded() + { + $this->metadata->addConstraint(new Valid(array('traverse' => false))); + + $metadata = unserialize(serialize($this->metadata)); + + $this->assertEquals($this->metadata, $metadata); + } +} + +class TestMemberMetadata extends MemberMetadata +{ + public function getPropertyValue($object) + { + } + + protected function newReflectionMember($object) + { + } +} diff --git a/core/vendor/symfony/validator/Tests/Mapping/PropertyMetadataTest.php b/core/vendor/symfony/validator/Tests/Mapping/PropertyMetadataTest.php new file mode 100644 index 0000000..f411d95 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Mapping/PropertyMetadataTest.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Mapping; + +use Symfony\Component\Validator\Mapping\PropertyMetadata; +use Symfony\Component\Validator\Tests\Fixtures\Entity; + +class PropertyMetadataTest extends \PHPUnit_Framework_TestCase +{ + const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity'; + const PARENTCLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent'; + + public function testInvalidPropertyName() + { + $this->setExpectedException('Symfony\Component\Validator\Exception\ValidatorException'); + + new PropertyMetadata(self::CLASSNAME, 'foobar'); + } + + public function testGetPropertyValueFromPrivateProperty() + { + $entity = new Entity('foobar'); + $metadata = new PropertyMetadata(self::CLASSNAME, 'internal'); + + $this->assertEquals('foobar', $metadata->getPropertyValue($entity)); + } + + public function testGetPropertyValueFromOverriddenPrivateProperty() + { + $entity = new Entity('foobar'); + $metadata = new PropertyMetadata(self::PARENTCLASS, 'data'); + + $this->assertTrue($metadata->isPublic($entity)); + $this->assertEquals('Overridden data', $metadata->getPropertyValue($entity)); + } +} diff --git a/core/vendor/symfony/validator/Tests/Util/PropertyPathTest.php b/core/vendor/symfony/validator/Tests/Util/PropertyPathTest.php new file mode 100644 index 0000000..a8b9af9 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Util/PropertyPathTest.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Util; + +use Symfony\Component\Validator\Util\PropertyPath; + +class PropertyPathTest extends \PHPUnit_Framework_TestCase +{ + /** + * @dataProvider provideAppendPaths + */ + public function testAppend($basePath, $subPath, $expectedPath, $message) + { + $this->assertSame($expectedPath, PropertyPath::append($basePath, $subPath), $message); + } + + public function provideAppendPaths() + { + return array( + array('foo', '', 'foo', 'It returns the basePath if subPath is empty'), + array('', 'bar', 'bar', 'It returns the subPath if basePath is empty'), + array('foo', 'bar', 'foo.bar', 'It append the subPath to the basePath'), + array('foo', '[bar]', 'foo[bar]', 'It does not include the dot separator if subPath uses the array notation'), + array('0', 'bar', '0.bar', 'Leading zeros are kept.'), + ); + } +} diff --git a/core/vendor/symfony/validator/Tests/Validator/Abstract2Dot5ApiTest.php b/core/vendor/symfony/validator/Tests/Validator/Abstract2Dot5ApiTest.php new file mode 100644 index 0000000..4a041af --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Validator/Abstract2Dot5ApiTest.php @@ -0,0 +1,717 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Validator; + +use Symfony\Component\Validator\Constraints\Callback; +use Symfony\Component\Validator\Constraints\GroupSequence; +use Symfony\Component\Validator\Constraints\NotNull; +use Symfony\Component\Validator\Constraints\Traverse; +use Symfony\Component\Validator\Constraints\Valid; +use Symfony\Component\Validator\ConstraintViolationInterface; +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\MetadataFactoryInterface; +use Symfony\Component\Validator\Tests\Fixtures\Entity; +use Symfony\Component\Validator\Tests\Fixtures\FailingConstraint; +use Symfony\Component\Validator\Tests\Fixtures\FakeClassMetadata; +use Symfony\Component\Validator\Tests\Fixtures\Reference; +use Symfony\Component\Validator\Validator\ValidatorInterface; + +/** + * Verifies that a validator satisfies the API of Symfony 2.5+. + * + * @since 2.5 + * @author Bernhard Schussek + */ +abstract class Abstract2Dot5ApiTest extends AbstractValidatorTest +{ + /** + * @var ValidatorInterface + */ + protected $validator; + + /** + * @param MetadataFactoryInterface $metadataFactory + * + * @return ValidatorInterface + */ + abstract protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array()); + + protected function setUp() + { + parent::setUp(); + + $this->validator = $this->createValidator($this->metadataFactory); + } + + protected function validate($value, $constraints = null, $groups = null) + { + return $this->validator->validate($value, $constraints, $groups); + } + + protected function validateProperty($object, $propertyName, $groups = null) + { + return $this->validator->validateProperty($object, $propertyName, $groups); + } + + protected function validatePropertyValue($object, $propertyName, $value, $groups = null) + { + return $this->validator->validatePropertyValue($object, $propertyName, $value, $groups); + } + + public function testValidateConstraintWithoutGroup() + { + $violations = $this->validator->validate(null, new NotNull()); + + $this->assertCount(1, $violations); + } + + public function testGroupSequenceAbortsAfterFailedGroup() + { + $entity = new Entity(); + + $callback1 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Message 1'); + }; + $callback2 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Message 2'); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => function () {}, + 'groups' => 'Group 1', + ))); + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback1, + 'groups' => 'Group 2', + ))); + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback2, + 'groups' => 'Group 3', + ))); + + $sequence = new GroupSequence(array('Group 1', 'Group 2', 'Group 3')); + $violations = $this->validator->validate($entity, new Valid(), $sequence); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message 1', $violations[0]->getMessage()); + } + + public function testGroupSequenceIncludesReferences() + { + $entity = new Entity(); + $entity->reference = new Reference(); + + $callback1 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Reference violation 1'); + }; + $callback2 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Reference violation 2'); + }; + + $this->metadata->addPropertyConstraint('reference', new Valid()); + $this->referenceMetadata->addConstraint(new Callback(array( + 'callback' => $callback1, + 'groups' => 'Group 1', + ))); + $this->referenceMetadata->addConstraint(new Callback(array( + 'callback' => $callback2, + 'groups' => 'Group 2', + ))); + + $sequence = new GroupSequence(array('Group 1', 'Entity')); + $violations = $this->validator->validate($entity, new Valid(), $sequence); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Reference violation 1', $violations[0]->getMessage()); + } + + public function testValidateInSeparateContext() + { + $test = $this; + $entity = new Entity(); + $entity->reference = new Reference(); + + $callback1 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $violations = $context + ->getValidator() + // Since the validator is not context aware, the group must + // be passed explicitly + ->validate($value->reference, new Valid(), 'Group') + ; + + /** @var ConstraintViolationInterface[] $violations */ + $test->assertCount(1, $violations); + $test->assertSame('Message value', $violations[0]->getMessage()); + $test->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $test->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $test->assertSame('', $violations[0]->getPropertyPath()); + // The root is different as we're in a new context + $test->assertSame($entity->reference, $violations[0]->getRoot()); + $test->assertSame($entity->reference, $violations[0]->getInvalidValue()); + $test->assertNull($violations[0]->getPlural()); + $test->assertNull($violations[0]->getCode()); + + // Verify that this method is called + $context->addViolation('Separate violation'); + }; + + $callback2 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); + $test->assertNull($context->getPropertyName()); + $test->assertSame('', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($test->referenceMetadata, $context->getMetadata()); + $test->assertSame($entity->reference, $context->getRoot()); + $test->assertSame($entity->reference, $context->getValue()); + $test->assertSame($entity->reference, $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback1, + 'groups' => 'Group', + ))); + $this->referenceMetadata->addConstraint(new Callback(array( + 'callback' => $callback2, + 'groups' => 'Group', + ))); + + $violations = $this->validator->validate($entity, new Valid(), 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $test->assertSame('Separate violation', $violations[0]->getMessage()); + } + + public function testValidateInContext() + { + $test = $this; + $entity = new Entity(); + $entity->reference = new Reference(); + + $callback1 = function ($value, ExecutionContextInterface $context) use ($test) { + $previousValue = $context->getValue(); + $previousObject = $context->getObject(); + $previousMetadata = $context->getMetadata(); + $previousPath = $context->getPropertyPath(); + $previousGroup = $context->getGroup(); + + $context + ->getValidator() + ->inContext($context) + ->atPath('subpath') + ->validate($value->reference) + ; + + // context changes shouldn't leak out of the validate() call + $test->assertSame($previousValue, $context->getValue()); + $test->assertSame($previousObject, $context->getObject()); + $test->assertSame($previousMetadata, $context->getMetadata()); + $test->assertSame($previousPath, $context->getPropertyPath()); + $test->assertSame($previousGroup, $context->getGroup()); + }; + + $callback2 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); + $test->assertNull($context->getPropertyName()); + $test->assertSame('subpath', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($test->referenceMetadata, $context->getMetadata()); + $test->assertSame($entity, $context->getRoot()); + $test->assertSame($entity->reference, $context->getValue()); + $test->assertSame($entity->reference, $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback1, + 'groups' => 'Group', + ))); + $this->referenceMetadata->addConstraint(new Callback(array( + 'callback' => $callback2, + 'groups' => 'Group', + ))); + + $violations = $this->validator->validate($entity, new Valid(), 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('subpath', $violations[0]->getPropertyPath()); + $this->assertSame($entity, $violations[0]->getRoot()); + $this->assertSame($entity->reference, $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testValidateArrayInContext() + { + $test = $this; + $entity = new Entity(); + $entity->reference = new Reference(); + + $callback1 = function ($value, ExecutionContextInterface $context) use ($test) { + $previousValue = $context->getValue(); + $previousObject = $context->getObject(); + $previousMetadata = $context->getMetadata(); + $previousPath = $context->getPropertyPath(); + $previousGroup = $context->getGroup(); + + $context + ->getValidator() + ->inContext($context) + ->atPath('subpath') + ->validate(array('key' => $value->reference)) + ; + + // context changes shouldn't leak out of the validate() call + $test->assertSame($previousValue, $context->getValue()); + $test->assertSame($previousObject, $context->getObject()); + $test->assertSame($previousMetadata, $context->getMetadata()); + $test->assertSame($previousPath, $context->getPropertyPath()); + $test->assertSame($previousGroup, $context->getGroup()); + }; + + $callback2 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); + $test->assertNull($context->getPropertyName()); + $test->assertSame('subpath[key]', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($test->referenceMetadata, $context->getMetadata()); + $test->assertSame($entity, $context->getRoot()); + $test->assertSame($entity->reference, $context->getValue()); + $test->assertSame($entity->reference, $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback1, + 'groups' => 'Group', + ))); + $this->referenceMetadata->addConstraint(new Callback(array( + 'callback' => $callback2, + 'groups' => 'Group', + ))); + + $violations = $this->validator->validate($entity, new Valid(), 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('subpath[key]', $violations[0]->getPropertyPath()); + $this->assertSame($entity, $violations[0]->getRoot()); + $this->assertSame($entity->reference, $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testTraverseTraversableByDefault() + { + $test = $this; + $entity = new Entity(); + $traversable = new \ArrayIterator(array('key' => $entity)); + + $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $traversable) { + $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); + $test->assertNull($context->getPropertyName()); + $test->assertSame('[key]', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($test->metadata, $context->getMetadata()); + $test->assertSame($traversable, $context->getRoot()); + $test->assertSame($entity, $context->getValue()); + $test->assertSame($entity, $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadataFactory->addMetadata(new ClassMetadata('ArrayIterator')); + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $violations = $this->validate($traversable, new Valid(), 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('[key]', $violations[0]->getPropertyPath()); + $this->assertSame($traversable, $violations[0]->getRoot()); + $this->assertSame($entity, $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testTraversalEnabledOnClass() + { + $entity = new Entity(); + $traversable = new \ArrayIterator(array('key' => $entity)); + + $callback = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Message'); + }; + + $traversableMetadata = new ClassMetadata('ArrayIterator'); + $traversableMetadata->addConstraint(new Traverse(true)); + + $this->metadataFactory->addMetadata($traversableMetadata); + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $violations = $this->validate($traversable, new Valid(), 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + } + + public function testTraversalDisabledOnClass() + { + $test = $this; + $entity = new Entity(); + $traversable = new \ArrayIterator(array('key' => $entity)); + + $callback = function ($value, ExecutionContextInterface $context) use ($test) { + $test->fail('Should not be called'); + }; + + $traversableMetadata = new ClassMetadata('ArrayIterator'); + $traversableMetadata->addConstraint(new Traverse(false)); + + $this->metadataFactory->addMetadata($traversableMetadata); + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $violations = $this->validate($traversable, new Valid(), 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(0, $violations); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testExpectTraversableIfTraversalEnabledOnClass() + { + $entity = new Entity(); + + $this->metadata->addConstraint(new Traverse(true)); + + $this->validator->validate($entity); + } + + public function testReferenceTraversalDisabledOnClass() + { + $test = $this; + $entity = new Entity(); + $entity->reference = new \ArrayIterator(array('key' => new Reference())); + + $callback = function ($value, ExecutionContextInterface $context) use ($test) { + $test->fail('Should not be called'); + }; + + $traversableMetadata = new ClassMetadata('ArrayIterator'); + $traversableMetadata->addConstraint(new Traverse(false)); + + $this->metadataFactory->addMetadata($traversableMetadata); + $this->referenceMetadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + $this->metadata->addPropertyConstraint('reference', new Valid()); + + $violations = $this->validate($entity, new Valid(), 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(0, $violations); + } + + public function testReferenceTraversalEnabledOnReferenceDisabledOnClass() + { + $test = $this; + $entity = new Entity(); + $entity->reference = new \ArrayIterator(array('key' => new Reference())); + + $callback = function ($value, ExecutionContextInterface $context) use ($test) { + $test->fail('Should not be called'); + }; + + $traversableMetadata = new ClassMetadata('ArrayIterator'); + $traversableMetadata->addConstraint(new Traverse(false)); + + $this->metadataFactory->addMetadata($traversableMetadata); + $this->referenceMetadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + $this->metadata->addPropertyConstraint('reference', new Valid(array( + 'traverse' => true, + ))); + + $violations = $this->validate($entity, new Valid(), 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(0, $violations); + } + + public function testReferenceTraversalDisabledOnReferenceEnabledOnClass() + { + $test = $this; + $entity = new Entity(); + $entity->reference = new \ArrayIterator(array('key' => new Reference())); + + $callback = function ($value, ExecutionContextInterface $context) use ($test) { + $test->fail('Should not be called'); + }; + + $traversableMetadata = new ClassMetadata('ArrayIterator'); + $traversableMetadata->addConstraint(new Traverse(true)); + + $this->metadataFactory->addMetadata($traversableMetadata); + $this->referenceMetadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + $this->metadata->addPropertyConstraint('reference', new Valid(array( + 'traverse' => false, + ))); + + $violations = $this->validate($entity, new Valid(), 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(0, $violations); + } + + public function testAddCustomizedViolation() + { + $entity = new Entity(); + + $callback = function ($value, ExecutionContextInterface $context) { + $context->buildViolation('Message %param%') + ->setParameter('%param%', 'value') + ->setInvalidValue('Invalid value') + ->setPlural(2) + ->setCode(42) + ->addViolation(); + }; + + $this->metadata->addConstraint(new Callback($callback)); + + $violations = $this->validator->validate($entity); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('', $violations[0]->getPropertyPath()); + $this->assertSame($entity, $violations[0]->getRoot()); + $this->assertSame('Invalid value', $violations[0]->getInvalidValue()); + $this->assertSame(2, $violations[0]->getPlural()); + $this->assertSame(42, $violations[0]->getCode()); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnsupportedMetadataException + */ + public function testMetadataMustImplementClassMetadataInterface() + { + $entity = new Entity(); + + $metadata = $this->getMock('Symfony\Component\Validator\Tests\Fixtures\LegacyClassMetadata'); + $metadata->expects($this->any()) + ->method('getClassName') + ->will($this->returnValue(get_class($entity))); + + $this->metadataFactory->addMetadata($metadata); + + $this->validator->validate($entity); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnsupportedMetadataException + */ + public function testReferenceMetadataMustImplementClassMetadataInterface() + { + $entity = new Entity(); + $entity->reference = new Reference(); + + $metadata = $this->getMock('Symfony\Component\Validator\Tests\Fixtures\LegacyClassMetadata'); + $metadata->expects($this->any()) + ->method('getClassName') + ->will($this->returnValue(get_class($entity->reference))); + + $this->metadataFactory->addMetadata($metadata); + + $this->metadata->addPropertyConstraint('reference', new Valid()); + + $this->validator->validate($entity); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\UnsupportedMetadataException + * @group legacy + */ + public function testLegacyPropertyMetadataMustImplementPropertyMetadataInterface() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + $entity = new Entity(); + + // Legacy interface + $propertyMetadata = $this->getMock('Symfony\Component\Validator\MetadataInterface'); + $metadata = new FakeClassMetadata(get_class($entity)); + $metadata->addCustomPropertyMetadata('firstName', $propertyMetadata); + + $this->metadataFactory->addMetadata($metadata); + + $this->validator->validate($entity); + } + + public function testNoDuplicateValidationIfClassConstraintInMultipleGroups() + { + $entity = new Entity(); + + $callback = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Message'); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => array('Group 1', 'Group 2'), + ))); + + $violations = $this->validator->validate($entity, new Valid(), array('Group 1', 'Group 2')); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + } + + public function testNoDuplicateValidationIfPropertyConstraintInMultipleGroups() + { + $entity = new Entity(); + + $callback = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Message'); + }; + + $this->metadata->addPropertyConstraint('firstName', new Callback(array( + 'callback' => $callback, + 'groups' => array('Group 1', 'Group 2'), + ))); + + $violations = $this->validator->validate($entity, new Valid(), array('Group 1', 'Group 2')); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\RuntimeException + */ + public function testValidateFailsIfNoConstraintsAndNoObjectOrArray() + { + $this->validate('Foobar'); + } + + public function testAccessCurrentObject() + { + $test = $this; + $called = false; + $entity = new Entity(); + $entity->firstName = 'Bernhard'; + + $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, &$called) { + $called = true; + $test->assertSame($entity, $context->getObject()); + }; + + $this->metadata->addConstraint(new Callback($callback)); + $this->metadata->addPropertyConstraint('firstName', new Callback($callback)); + + $this->validator->validate($entity); + + $this->assertTrue($called); + } + + public function testInitializeObjectsOnFirstValidation() + { + $test = $this; + $entity = new Entity(); + $entity->initialized = false; + + // prepare initializers that set "initialized" to true + $initializer1 = $this->getMock('Symfony\\Component\\Validator\\ObjectInitializerInterface'); + $initializer2 = $this->getMock('Symfony\\Component\\Validator\\ObjectInitializerInterface'); + + $initializer1->expects($this->once()) + ->method('initialize') + ->with($entity) + ->will($this->returnCallback(function ($object) { + $object->initialized = true; + })); + + $initializer2->expects($this->once()) + ->method('initialize') + ->with($entity); + + $this->validator = $this->createValidator($this->metadataFactory, array( + $initializer1, + $initializer2, + )); + + // prepare constraint which + // * checks that "initialized" is set to true + // * validates the object again + $callback = function ($object, ExecutionContextInterface $context) use ($test) { + $test->assertTrue($object->initialized); + + // validate again in same group + $validator = $context->getValidator()->inContext($context); + + $validator->validate($object); + + // validate again in other group + $validator->validate($object, null, 'SomeGroup'); + }; + + $this->metadata->addConstraint(new Callback($callback)); + + $this->validate($entity); + + $this->assertTrue($entity->initialized); + } + + public function testPassConstraintToViolation() + { + $constraint = new FailingConstraint(); + $violations = $this->validate('Foobar', $constraint); + + $this->assertCount(1, $violations); + $this->assertSame($constraint, $violations[0]->getConstraint()); + } +} diff --git a/core/vendor/symfony/validator/Tests/Validator/AbstractLegacyApiTest.php b/core/vendor/symfony/validator/Tests/Validator/AbstractLegacyApiTest.php new file mode 100644 index 0000000..77ec102 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Validator/AbstractLegacyApiTest.php @@ -0,0 +1,315 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Validator; + +use Symfony\Component\Validator\Constraints\Callback; +use Symfony\Component\Validator\Constraints\Valid; +use Symfony\Component\Validator\ConstraintViolationInterface; +use Symfony\Component\Validator\ExecutionContextInterface; +use Symfony\Component\Validator\MetadataFactoryInterface; +use Symfony\Component\Validator\Tests\Fixtures\Entity; +use Symfony\Component\Validator\Tests\Fixtures\Reference; +use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface; + +/** + * Verifies that a validator satisfies the API of Symfony < 2.5. + * + * @since 2.5 + * @author Bernhard Schussek + */ +abstract class AbstractLegacyApiTest extends AbstractValidatorTest +{ + /** + * @var LegacyValidatorInterface + */ + protected $validator; + + /** + * @param MetadataFactoryInterface $metadataFactory + * + * @return LegacyValidatorInterface + */ + abstract protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array()); + + protected function setUp() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + parent::setUp(); + + $this->validator = $this->createValidator($this->metadataFactory); + } + + protected function validate($value, $constraints = null, $groups = null) + { + if (null === $constraints) { + $constraints = new Valid(); + } + + if ($constraints instanceof Valid) { + return $this->validator->validate($value, $groups, $constraints->traverse, $constraints->deep); + } + + return $this->validator->validateValue($value, $constraints, $groups); + } + + protected function validateProperty($object, $propertyName, $groups = null) + { + return $this->validator->validateProperty($object, $propertyName, $groups); + } + + protected function validatePropertyValue($object, $propertyName, $value, $groups = null) + { + return $this->validator->validatePropertyValue($object, $propertyName, $value, $groups); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\NoSuchMetadataException + */ + public function testTraversableTraverseDisabled() + { + $test = $this; + $entity = new Entity(); + $traversable = new \ArrayIterator(array('key' => $entity)); + + $callback = function () use ($test) { + $test->fail('Should not be called'); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $this->validator->validate($traversable, 'Group'); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\NoSuchMetadataException + */ + public function testRecursiveTraversableRecursiveTraversalDisabled() + { + $test = $this; + $entity = new Entity(); + $traversable = new \ArrayIterator(array( + 2 => new \ArrayIterator(array('key' => $entity)), + )); + + $callback = function () use ($test) { + $test->fail('Should not be called'); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $this->validator->validate($traversable, 'Group'); + } + + public function testValidateInContext() + { + $test = $this; + $entity = new Entity(); + $entity->reference = new Reference(); + + $callback1 = function ($value, ExecutionContextInterface $context) use ($test) { + $previousValue = $context->getValue(); + $previousMetadata = $context->getMetadata(); + $previousPath = $context->getPropertyPath(); + $previousGroup = $context->getGroup(); + + $context->validate($value->reference, 'subpath'); + + // context changes shouldn't leak out of the validate() call + $test->assertSame($previousValue, $context->getValue()); + $test->assertSame($previousMetadata, $context->getMetadata()); + $test->assertSame($previousPath, $context->getPropertyPath()); + $test->assertSame($previousGroup, $context->getGroup()); + }; + + $callback2 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); + $test->assertNull($context->getPropertyName()); + $test->assertSame('subpath', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($test->referenceMetadata, $context->getMetadata()); + $test->assertSame($test->metadataFactory, $context->getMetadataFactory()); + $test->assertSame($entity, $context->getRoot()); + $test->assertSame($entity->reference, $context->getValue()); + $test->assertSame($entity->reference, $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback1, + 'groups' => 'Group', + ))); + $this->referenceMetadata->addConstraint(new Callback(array( + 'callback' => $callback2, + 'groups' => 'Group', + ))); + + $violations = $this->validator->validate($entity, 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('subpath', $violations[0]->getPropertyPath()); + $this->assertSame($entity, $violations[0]->getRoot()); + $this->assertSame($entity->reference, $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testValidateArrayInContext() + { + $test = $this; + $entity = new Entity(); + $entity->reference = new Reference(); + + $callback1 = function ($value, ExecutionContextInterface $context) use ($test) { + $previousValue = $context->getValue(); + $previousMetadata = $context->getMetadata(); + $previousPath = $context->getPropertyPath(); + $previousGroup = $context->getGroup(); + + $context->validate(array('key' => $value->reference), 'subpath'); + + // context changes shouldn't leak out of the validate() call + $test->assertSame($previousValue, $context->getValue()); + $test->assertSame($previousMetadata, $context->getMetadata()); + $test->assertSame($previousPath, $context->getPropertyPath()); + $test->assertSame($previousGroup, $context->getGroup()); + }; + + $callback2 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); + $test->assertNull($context->getPropertyName()); + $test->assertSame('subpath[key]', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($test->referenceMetadata, $context->getMetadata()); + $test->assertSame($test->metadataFactory, $context->getMetadataFactory()); + $test->assertSame($entity, $context->getRoot()); + $test->assertSame($entity->reference, $context->getValue()); + $test->assertSame($entity->reference, $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback1, + 'groups' => 'Group', + ))); + $this->referenceMetadata->addConstraint(new Callback(array( + 'callback' => $callback2, + 'groups' => 'Group', + ))); + + $violations = $this->validator->validate($entity, 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('subpath[key]', $violations[0]->getPropertyPath()); + $this->assertSame($entity, $violations[0]->getRoot()); + $this->assertSame($entity->reference, $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testAddCustomizedViolation() + { + $entity = new Entity(); + + $callback = function ($value, ExecutionContextInterface $context) { + $context->addViolation( + 'Message %param%', + array('%param%' => 'value'), + 'Invalid value', + 2, + 'Code' + ); + }; + + $this->metadata->addConstraint(new Callback($callback)); + + $violations = $this->validator->validate($entity); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('', $violations[0]->getPropertyPath()); + $this->assertSame($entity, $violations[0]->getRoot()); + $this->assertSame('Invalid value', $violations[0]->getInvalidValue()); + $this->assertSame(2, $violations[0]->getPlural()); + $this->assertSame('Code', $violations[0]->getCode()); + } + + public function testInitializeObjectsOnFirstValidation() + { + $test = $this; + $entity = new Entity(); + $entity->initialized = false; + + // prepare initializers that set "initialized" to true + $initializer1 = $this->getMock('Symfony\\Component\\Validator\\ObjectInitializerInterface'); + $initializer2 = $this->getMock('Symfony\\Component\\Validator\\ObjectInitializerInterface'); + + $initializer1->expects($this->once()) + ->method('initialize') + ->with($entity) + ->will($this->returnCallback(function ($object) { + $object->initialized = true; + })); + + $initializer2->expects($this->once()) + ->method('initialize') + ->with($entity); + + $this->validator = $this->createValidator($this->metadataFactory, array( + $initializer1, + $initializer2, + )); + + // prepare constraint which + // * checks that "initialized" is set to true + // * validates the object again + $callback = function ($object, ExecutionContextInterface $context) use ($test) { + $test->assertTrue($object->initialized); + + // validate again in same group + $context->validate($object); + + // validate again in other group + $context->validate($object, '', 'SomeGroup'); + }; + + $this->metadata->addConstraint(new Callback($callback)); + + $this->validate($entity); + + $this->assertTrue($entity->initialized); + } + + public function testGetMetadataFactory() + { + $this->assertSame($this->metadataFactory, $this->validator->getMetadataFactory()); + } +} diff --git a/core/vendor/symfony/validator/Tests/Validator/AbstractValidatorTest.php b/core/vendor/symfony/validator/Tests/Validator/AbstractValidatorTest.php new file mode 100644 index 0000000..d8833de --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Validator/AbstractValidatorTest.php @@ -0,0 +1,1288 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Validator; + +use Symfony\Component\Validator\Constraints\Callback; +use Symfony\Component\Validator\Constraints\GroupSequence; +use Symfony\Component\Validator\Constraints\Valid; +use Symfony\Component\Validator\ConstraintViolationInterface; +use Symfony\Component\Validator\ExecutionContextInterface; +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Tests\Fixtures\Entity; +use Symfony\Component\Validator\Tests\Fixtures\FakeMetadataFactory; +use Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity; +use Symfony\Component\Validator\Tests\Fixtures\Reference; + +/** + * @since 2.5 + * @author Bernhard Schussek + */ +abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase +{ + const ENTITY_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\Entity'; + + const REFERENCE_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\Reference'; + + /** + * @var FakeMetadataFactory + */ + public $metadataFactory; + + /** + * @var ClassMetadata + */ + public $metadata; + + /** + * @var ClassMetadata + */ + public $referenceMetadata; + + protected function setUp() + { + $this->metadataFactory = new FakeMetadataFactory(); + $this->metadata = new ClassMetadata(self::ENTITY_CLASS); + $this->referenceMetadata = new ClassMetadata(self::REFERENCE_CLASS); + $this->metadataFactory->addMetadata($this->metadata); + $this->metadataFactory->addMetadata($this->referenceMetadata); + } + + protected function tearDown() + { + $this->metadataFactory = null; + $this->metadata = null; + $this->referenceMetadata = null; + } + + abstract protected function validate($value, $constraints = null, $groups = null); + + abstract protected function validateProperty($object, $propertyName, $groups = null); + + abstract protected function validatePropertyValue($object, $propertyName, $value, $groups = null); + + public function testValidate() + { + $test = $this; + + $callback = function ($value, ExecutionContextInterface $context) use ($test) { + $test->assertNull($context->getClassName()); + $test->assertNull($context->getPropertyName()); + $test->assertSame('', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame('Bernhard', $context->getRoot()); + $test->assertSame('Bernhard', $context->getValue()); + $test->assertSame('Bernhard', $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $constraint = new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + )); + + $violations = $this->validate('Bernhard', $constraint, 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('', $violations[0]->getPropertyPath()); + $this->assertSame('Bernhard', $violations[0]->getRoot()); + $this->assertSame('Bernhard', $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testClassConstraint() + { + $test = $this; + $entity = new Entity(); + + $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); + $test->assertNull($context->getPropertyName()); + $test->assertSame('', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($test->metadata, $context->getMetadata()); + $test->assertSame($entity, $context->getRoot()); + $test->assertSame($entity, $context->getValue()); + $test->assertSame($entity, $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $violations = $this->validate($entity, null, 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('', $violations[0]->getPropertyPath()); + $this->assertSame($entity, $violations[0]->getRoot()); + $this->assertSame($entity, $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testPropertyConstraint() + { + $test = $this; + $entity = new Entity(); + $entity->firstName = 'Bernhard'; + + $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $propertyMetadatas = $test->metadata->getPropertyMetadata('firstName'); + + $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); + $test->assertSame('firstName', $context->getPropertyName()); + $test->assertSame('firstName', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($propertyMetadatas[0], $context->getMetadata()); + $test->assertSame($entity, $context->getRoot()); + $test->assertSame('Bernhard', $context->getValue()); + $test->assertSame('Bernhard', $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addPropertyConstraint('firstName', new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $violations = $this->validate($entity, null, 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('firstName', $violations[0]->getPropertyPath()); + $this->assertSame($entity, $violations[0]->getRoot()); + $this->assertSame('Bernhard', $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testGetterConstraint() + { + $test = $this; + $entity = new Entity(); + $entity->setLastName('Schussek'); + + $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $propertyMetadatas = $test->metadata->getPropertyMetadata('lastName'); + + $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); + $test->assertSame('lastName', $context->getPropertyName()); + $test->assertSame('lastName', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($propertyMetadatas[0], $context->getMetadata()); + $test->assertSame($entity, $context->getRoot()); + $test->assertSame('Schussek', $context->getValue()); + $test->assertSame('Schussek', $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addGetterConstraint('lastName', new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $violations = $this->validate($entity, null, 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('lastName', $violations[0]->getPropertyPath()); + $this->assertSame($entity, $violations[0]->getRoot()); + $this->assertSame('Schussek', $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testArray() + { + $test = $this; + $entity = new Entity(); + $array = array('key' => $entity); + + $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $array) { + $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); + $test->assertNull($context->getPropertyName()); + $test->assertSame('[key]', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($test->metadata, $context->getMetadata()); + $test->assertSame($array, $context->getRoot()); + $test->assertSame($entity, $context->getValue()); + $test->assertSame($entity, $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $violations = $this->validate($array, null, 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('[key]', $violations[0]->getPropertyPath()); + $this->assertSame($array, $violations[0]->getRoot()); + $this->assertSame($entity, $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testRecursiveArray() + { + $test = $this; + $entity = new Entity(); + $array = array(2 => array('key' => $entity)); + + $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $array) { + $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); + $test->assertNull($context->getPropertyName()); + $test->assertSame('[2][key]', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($test->metadata, $context->getMetadata()); + $test->assertSame($array, $context->getRoot()); + $test->assertSame($entity, $context->getValue()); + $test->assertSame($entity, $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $violations = $this->validate($array, null, 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('[2][key]', $violations[0]->getPropertyPath()); + $this->assertSame($array, $violations[0]->getRoot()); + $this->assertSame($entity, $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testTraversable() + { + $test = $this; + $entity = new Entity(); + $traversable = new \ArrayIterator(array('key' => $entity)); + + $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $traversable) { + $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); + $test->assertNull($context->getPropertyName()); + $test->assertSame('[key]', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($test->metadata, $context->getMetadata()); + $test->assertSame($traversable, $context->getRoot()); + $test->assertSame($entity, $context->getValue()); + $test->assertSame($entity, $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $violations = $this->validate($traversable, null, 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('[key]', $violations[0]->getPropertyPath()); + $this->assertSame($traversable, $violations[0]->getRoot()); + $this->assertSame($entity, $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testRecursiveTraversable() + { + $test = $this; + $entity = new Entity(); + $traversable = new \ArrayIterator(array( + 2 => new \ArrayIterator(array('key' => $entity)), + )); + + $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $traversable) { + $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); + $test->assertNull($context->getPropertyName()); + $test->assertSame('[2][key]', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($test->metadata, $context->getMetadata()); + $test->assertSame($traversable, $context->getRoot()); + $test->assertSame($entity, $context->getValue()); + $test->assertSame($entity, $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $violations = $this->validate($traversable, null, 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('[2][key]', $violations[0]->getPropertyPath()); + $this->assertSame($traversable, $violations[0]->getRoot()); + $this->assertSame($entity, $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testReferenceClassConstraint() + { + $test = $this; + $entity = new Entity(); + $entity->reference = new Reference(); + + $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); + $test->assertNull($context->getPropertyName()); + $test->assertSame('reference', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($test->referenceMetadata, $context->getMetadata()); + $test->assertSame($entity, $context->getRoot()); + $test->assertSame($entity->reference, $context->getValue()); + $test->assertSame($entity->reference, $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addPropertyConstraint('reference', new Valid()); + $this->referenceMetadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $violations = $this->validate($entity, null, 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('reference', $violations[0]->getPropertyPath()); + $this->assertSame($entity, $violations[0]->getRoot()); + $this->assertSame($entity->reference, $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testReferencePropertyConstraint() + { + $test = $this; + $entity = new Entity(); + $entity->reference = new Reference(); + $entity->reference->value = 'Foobar'; + + $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $propertyMetadatas = $test->referenceMetadata->getPropertyMetadata('value'); + + $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); + $test->assertSame('value', $context->getPropertyName()); + $test->assertSame('reference.value', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($propertyMetadatas[0], $context->getMetadata()); + $test->assertSame($entity, $context->getRoot()); + $test->assertSame('Foobar', $context->getValue()); + $test->assertSame('Foobar', $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addPropertyConstraint('reference', new Valid()); + $this->referenceMetadata->addPropertyConstraint('value', new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $violations = $this->validate($entity, null, 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('reference.value', $violations[0]->getPropertyPath()); + $this->assertSame($entity, $violations[0]->getRoot()); + $this->assertSame('Foobar', $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testReferenceGetterConstraint() + { + $test = $this; + $entity = new Entity(); + $entity->reference = new Reference(); + $entity->reference->setPrivateValue('Bamboo'); + + $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $propertyMetadatas = $test->referenceMetadata->getPropertyMetadata('privateValue'); + + $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); + $test->assertSame('privateValue', $context->getPropertyName()); + $test->assertSame('reference.privateValue', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($propertyMetadatas[0], $context->getMetadata()); + $test->assertSame($entity, $context->getRoot()); + $test->assertSame('Bamboo', $context->getValue()); + $test->assertSame('Bamboo', $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addPropertyConstraint('reference', new Valid()); + $this->referenceMetadata->addPropertyConstraint('privateValue', new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $violations = $this->validate($entity, null, 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('reference.privateValue', $violations[0]->getPropertyPath()); + $this->assertSame($entity, $violations[0]->getRoot()); + $this->assertSame('Bamboo', $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testsIgnoreNullReference() + { + $entity = new Entity(); + $entity->reference = null; + + $this->metadata->addPropertyConstraint('reference', new Valid()); + + $violations = $this->validate($entity); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(0, $violations); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\NoSuchMetadataException + */ + public function testFailOnScalarReferences() + { + $entity = new Entity(); + $entity->reference = 'string'; + + $this->metadata->addPropertyConstraint('reference', new Valid()); + + $this->validate($entity); + } + + public function testArrayReference() + { + $test = $this; + $entity = new Entity(); + $entity->reference = array('key' => new Reference()); + + $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); + $test->assertNull($context->getPropertyName()); + $test->assertSame('reference[key]', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($test->referenceMetadata, $context->getMetadata()); + $test->assertSame($entity, $context->getRoot()); + $test->assertSame($entity->reference['key'], $context->getValue()); + $test->assertSame($entity->reference['key'], $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addPropertyConstraint('reference', new Valid()); + $this->referenceMetadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $violations = $this->validate($entity, null, 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('reference[key]', $violations[0]->getPropertyPath()); + $this->assertSame($entity, $violations[0]->getRoot()); + $this->assertSame($entity->reference['key'], $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + // https://github.com/symfony/symfony/issues/6246 + public function testRecursiveArrayReference() + { + $test = $this; + $entity = new Entity(); + $entity->reference = array(2 => array('key' => new Reference())); + + $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); + $test->assertNull($context->getPropertyName()); + $test->assertSame('reference[2][key]', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($test->referenceMetadata, $context->getMetadata()); + $test->assertSame($entity, $context->getRoot()); + $test->assertSame($entity->reference[2]['key'], $context->getValue()); + $test->assertSame($entity->reference[2]['key'], $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addPropertyConstraint('reference', new Valid()); + $this->referenceMetadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $violations = $this->validate($entity, null, 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('reference[2][key]', $violations[0]->getPropertyPath()); + $this->assertSame($entity, $violations[0]->getRoot()); + $this->assertSame($entity->reference[2]['key'], $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testArrayTraversalCannotBeDisabled() + { + $entity = new Entity(); + $entity->reference = array('key' => new Reference()); + + $callback = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addPropertyConstraint('reference', new Valid(array( + 'traverse' => false, + ))); + $this->referenceMetadata->addConstraint(new Callback($callback)); + + $violations = $this->validate($entity); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + } + + public function testRecursiveArrayTraversalCannotBeDisabled() + { + $entity = new Entity(); + $entity->reference = array(2 => array('key' => new Reference())); + + $callback = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addPropertyConstraint('reference', new Valid(array( + 'traverse' => false, + ))); + $this->referenceMetadata->addConstraint(new Callback($callback)); + + $violations = $this->validate($entity); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + } + + public function testIgnoreScalarsDuringArrayTraversal() + { + $entity = new Entity(); + $entity->reference = array('string', 1234); + + $this->metadata->addPropertyConstraint('reference', new Valid()); + + $violations = $this->validate($entity); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(0, $violations); + } + + public function testIgnoreNullDuringArrayTraversal() + { + $entity = new Entity(); + $entity->reference = array(null); + + $this->metadata->addPropertyConstraint('reference', new Valid()); + + $violations = $this->validate($entity); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(0, $violations); + } + + public function testTraversableReference() + { + $test = $this; + $entity = new Entity(); + $entity->reference = new \ArrayIterator(array('key' => new Reference())); + + $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); + $test->assertNull($context->getPropertyName()); + $test->assertSame('reference[key]', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($test->referenceMetadata, $context->getMetadata()); + $test->assertSame($entity, $context->getRoot()); + $test->assertSame($entity->reference['key'], $context->getValue()); + $test->assertSame($entity->reference['key'], $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addPropertyConstraint('reference', new Valid()); + $this->referenceMetadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $violations = $this->validate($entity, null, 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('reference[key]', $violations[0]->getPropertyPath()); + $this->assertSame($entity, $violations[0]->getRoot()); + $this->assertSame($entity->reference['key'], $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testDisableTraversableTraversal() + { + $entity = new Entity(); + $entity->reference = new \ArrayIterator(array('key' => new Reference())); + + $callback = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadataFactory->addMetadata(new ClassMetadata('ArrayIterator')); + $this->metadata->addPropertyConstraint('reference', new Valid(array( + 'traverse' => false, + ))); + $this->referenceMetadata->addConstraint(new Callback($callback)); + + $violations = $this->validate($entity); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(0, $violations); + } + + /** + * @expectedException \Symfony\Component\Validator\Exception\NoSuchMetadataException + */ + public function testMetadataMustExistIfTraversalIsDisabled() + { + $entity = new Entity(); + $entity->reference = new \ArrayIterator(); + + $this->metadata->addPropertyConstraint('reference', new Valid(array( + 'traverse' => false, + ))); + + $this->validate($entity); + } + + public function testEnableRecursiveTraversableTraversal() + { + $test = $this; + $entity = new Entity(); + $entity->reference = new \ArrayIterator(array( + 2 => new \ArrayIterator(array('key' => new Reference())), + )); + + $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); + $test->assertNull($context->getPropertyName()); + $test->assertSame('reference[2][key]', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($test->referenceMetadata, $context->getMetadata()); + $test->assertSame($entity, $context->getRoot()); + $test->assertSame($entity->reference[2]['key'], $context->getValue()); + $test->assertSame($entity->reference[2]['key'], $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $this->metadata->addPropertyConstraint('reference', new Valid(array( + 'traverse' => true, + ))); + $this->referenceMetadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group', + ))); + + $violations = $this->validate($entity, null, 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('reference[2][key]', $violations[0]->getPropertyPath()); + $this->assertSame($entity, $violations[0]->getRoot()); + $this->assertSame($entity->reference[2]['key'], $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testValidateProperty() + { + $test = $this; + $entity = new Entity(); + $entity->firstName = 'Bernhard'; + $entity->setLastName('Schussek'); + + $callback1 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $propertyMetadatas = $test->metadata->getPropertyMetadata('firstName'); + + $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); + $test->assertSame('firstName', $context->getPropertyName()); + $test->assertSame('firstName', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($propertyMetadatas[0], $context->getMetadata()); + $test->assertSame($entity, $context->getRoot()); + $test->assertSame('Bernhard', $context->getValue()); + $test->assertSame('Bernhard', $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $callback2 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Other violation'); + }; + + $this->metadata->addPropertyConstraint('firstName', new Callback(array( + 'callback' => $callback1, + 'groups' => 'Group', + ))); + $this->metadata->addPropertyConstraint('lastName', new Callback(array( + 'callback' => $callback2, + 'groups' => 'Group', + ))); + + $violations = $this->validateProperty($entity, 'firstName', 'Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('firstName', $violations[0]->getPropertyPath()); + $this->assertSame($entity, $violations[0]->getRoot()); + $this->assertSame('Bernhard', $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + /** + * Cannot be UnsupportedMetadataException for BC with Symfony < 2.5. + * + * @expectedException \Symfony\Component\Validator\Exception\ValidatorException + * @group legacy + */ + public function testLegacyValidatePropertyFailsIfPropertiesNotSupported() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + // $metadata does not implement PropertyMetadataContainerInterface + $metadata = $this->getMock('Symfony\Component\Validator\MetadataInterface'); + + $this->metadataFactory->addMetadataForValue('VALUE', $metadata); + + $this->validateProperty('VALUE', 'someProperty'); + } + + /** + * https://github.com/symfony/symfony/issues/11604 + */ + public function testValidatePropertyWithoutConstraints() + { + $entity = new Entity(); + $violations = $this->validateProperty($entity, 'lastName'); + + $this->assertCount(0, $violations, '->validateProperty() returns no violations if no constraints have been configured for the property being validated'); + } + + public function testValidatePropertyValue() + { + $test = $this; + $entity = new Entity(); + $entity->setLastName('Schussek'); + + $callback1 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { + $propertyMetadatas = $test->metadata->getPropertyMetadata('firstName'); + + $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); + $test->assertSame('firstName', $context->getPropertyName()); + $test->assertSame('firstName', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($propertyMetadatas[0], $context->getMetadata()); + $test->assertSame($entity, $context->getRoot()); + $test->assertSame('Bernhard', $context->getValue()); + $test->assertSame('Bernhard', $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $callback2 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Other violation'); + }; + + $this->metadata->addPropertyConstraint('firstName', new Callback(array( + 'callback' => $callback1, + 'groups' => 'Group', + ))); + $this->metadata->addPropertyConstraint('lastName', new Callback(array( + 'callback' => $callback2, + 'groups' => 'Group', + ))); + + $violations = $this->validatePropertyValue( + $entity, + 'firstName', + 'Bernhard', + 'Group' + ); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('firstName', $violations[0]->getPropertyPath()); + $this->assertSame($entity, $violations[0]->getRoot()); + $this->assertSame('Bernhard', $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + public function testValidatePropertyValueWithClassName() + { + $test = $this; + + $callback1 = function ($value, ExecutionContextInterface $context) use ($test) { + $propertyMetadatas = $test->metadata->getPropertyMetadata('firstName'); + + $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); + $test->assertSame('firstName', $context->getPropertyName()); + $test->assertSame('', $context->getPropertyPath()); + $test->assertSame('Group', $context->getGroup()); + $test->assertSame($propertyMetadatas[0], $context->getMetadata()); + $test->assertSame('Bernhard', $context->getRoot()); + $test->assertSame('Bernhard', $context->getValue()); + $test->assertSame('Bernhard', $value); + + $context->addViolation('Message %param%', array('%param%' => 'value')); + }; + + $callback2 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Other violation'); + }; + + $this->metadata->addPropertyConstraint('firstName', new Callback(array( + 'callback' => $callback1, + 'groups' => 'Group', + ))); + $this->metadata->addPropertyConstraint('lastName', new Callback(array( + 'callback' => $callback2, + 'groups' => 'Group', + ))); + + $violations = $this->validatePropertyValue( + self::ENTITY_CLASS, + 'firstName', + 'Bernhard', + 'Group' + ); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Message value', $violations[0]->getMessage()); + $this->assertSame('Message %param%', $violations[0]->getMessageTemplate()); + $this->assertSame(array('%param%' => 'value'), $violations[0]->getParameters()); + $this->assertSame('', $violations[0]->getPropertyPath()); + $this->assertSame('Bernhard', $violations[0]->getRoot()); + $this->assertSame('Bernhard', $violations[0]->getInvalidValue()); + $this->assertNull($violations[0]->getPlural()); + $this->assertNull($violations[0]->getCode()); + } + + /** + * Cannot be UnsupportedMetadataException for BC with Symfony < 2.5. + * + * @expectedException \Symfony\Component\Validator\Exception\ValidatorException + * @group legacy + */ + public function testLegacyValidatePropertyValueFailsIfPropertiesNotSupported() + { + $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); + + // $metadata does not implement PropertyMetadataContainerInterface + $metadata = $this->getMock('Symfony\Component\Validator\MetadataInterface'); + + $this->metadataFactory->addMetadataForValue('VALUE', $metadata); + + $this->validatePropertyValue('VALUE', 'someProperty', 'someValue'); + } + + /** + * https://github.com/symfony/symfony/issues/11604 + */ + public function testValidatePropertyValueWithoutConstraints() + { + $entity = new Entity(); + $violations = $this->validatePropertyValue($entity, 'lastName', 'foo'); + + $this->assertCount(0, $violations, '->validatePropertyValue() returns no violations if no constraints have been configured for the property being validated'); + } + + public function testValidateObjectOnlyOncePerGroup() + { + $entity = new Entity(); + $entity->reference = new Reference(); + $entity->reference2 = $entity->reference; + + $callback = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Message'); + }; + + $this->metadata->addPropertyConstraint('reference', new Valid()); + $this->metadata->addPropertyConstraint('reference2', new Valid()); + $this->referenceMetadata->addConstraint(new Callback($callback)); + + $violations = $this->validate($entity); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + } + + public function testValidateDifferentObjectsSeparately() + { + $entity = new Entity(); + $entity->reference = new Reference(); + $entity->reference2 = new Reference(); + + $callback = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Message'); + }; + + $this->metadata->addPropertyConstraint('reference', new Valid()); + $this->metadata->addPropertyConstraint('reference2', new Valid()); + $this->referenceMetadata->addConstraint(new Callback($callback)); + + $violations = $this->validate($entity); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(2, $violations); + } + + public function testValidateSingleGroup() + { + $entity = new Entity(); + + $callback = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Message'); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group 1', + ))); + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group 2', + ))); + + $violations = $this->validate($entity, null, 'Group 2'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + } + + public function testValidateMultipleGroups() + { + $entity = new Entity(); + + $callback = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Message'); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group 1', + ))); + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback, + 'groups' => 'Group 2', + ))); + + $violations = $this->validate($entity, null, array('Group 1', 'Group 2')); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(2, $violations); + } + + public function testReplaceDefaultGroupByGroupSequenceObject() + { + $entity = new Entity(); + + $callback1 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Violation in Group 2'); + }; + $callback2 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Violation in Group 3'); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => function () {}, + 'groups' => 'Group 1', + ))); + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback1, + 'groups' => 'Group 2', + ))); + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback2, + 'groups' => 'Group 3', + ))); + + $sequence = new GroupSequence(array('Group 1', 'Group 2', 'Group 3', 'Entity')); + $this->metadata->setGroupSequence($sequence); + + $violations = $this->validate($entity, null, 'Default'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Violation in Group 2', $violations[0]->getMessage()); + } + + public function testReplaceDefaultGroupByGroupSequenceArray() + { + $entity = new Entity(); + + $callback1 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Violation in Group 2'); + }; + $callback2 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Violation in Group 3'); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => function () {}, + 'groups' => 'Group 1', + ))); + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback1, + 'groups' => 'Group 2', + ))); + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback2, + 'groups' => 'Group 3', + ))); + + $sequence = array('Group 1', 'Group 2', 'Group 3', 'Entity'); + $this->metadata->setGroupSequence($sequence); + + $violations = $this->validate($entity, null, 'Default'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Violation in Group 2', $violations[0]->getMessage()); + } + + public function testPropagateDefaultGroupToReferenceWhenReplacingDefaultGroup() + { + $entity = new Entity(); + $entity->reference = new Reference(); + + $callback1 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Violation in Default group'); + }; + $callback2 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Violation in group sequence'); + }; + + $this->metadata->addPropertyConstraint('reference', new Valid()); + $this->referenceMetadata->addConstraint(new Callback(array( + 'callback' => $callback1, + 'groups' => 'Default', + ))); + $this->referenceMetadata->addConstraint(new Callback(array( + 'callback' => $callback2, + 'groups' => 'Group 1', + ))); + + $sequence = new GroupSequence(array('Group 1', 'Entity')); + $this->metadata->setGroupSequence($sequence); + + $violations = $this->validate($entity, null, 'Default'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Violation in Default group', $violations[0]->getMessage()); + } + + public function testValidateCustomGroupWhenDefaultGroupWasReplaced() + { + $entity = new Entity(); + + $callback1 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Violation in other group'); + }; + $callback2 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Violation in group sequence'); + }; + + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback1, + 'groups' => 'Other Group', + ))); + $this->metadata->addConstraint(new Callback(array( + 'callback' => $callback2, + 'groups' => 'Group 1', + ))); + + $sequence = new GroupSequence(array('Group 1', 'Entity')); + $this->metadata->setGroupSequence($sequence); + + $violations = $this->validate($entity, null, 'Other Group'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Violation in other group', $violations[0]->getMessage()); + } + + public function testReplaceDefaultGroupWithObjectFromGroupSequenceProvider() + { + $sequence = new GroupSequence(array('Group 1', 'Group 2', 'Group 3', 'Entity')); + $entity = new GroupSequenceProviderEntity($sequence); + + $callback1 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Violation in Group 2'); + }; + $callback2 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Violation in Group 3'); + }; + + $metadata = new ClassMetadata(get_class($entity)); + $metadata->addConstraint(new Callback(array( + 'callback' => function () {}, + 'groups' => 'Group 1', + ))); + $metadata->addConstraint(new Callback(array( + 'callback' => $callback1, + 'groups' => 'Group 2', + ))); + $metadata->addConstraint(new Callback(array( + 'callback' => $callback2, + 'groups' => 'Group 3', + ))); + $metadata->setGroupSequenceProvider(true); + + $this->metadataFactory->addMetadata($metadata); + + $violations = $this->validate($entity, null, 'Default'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Violation in Group 2', $violations[0]->getMessage()); + } + + public function testReplaceDefaultGroupWithArrayFromGroupSequenceProvider() + { + $sequence = array('Group 1', 'Group 2', 'Group 3', 'Entity'); + $entity = new GroupSequenceProviderEntity($sequence); + + $callback1 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Violation in Group 2'); + }; + $callback2 = function ($value, ExecutionContextInterface $context) { + $context->addViolation('Violation in Group 3'); + }; + + $metadata = new ClassMetadata(get_class($entity)); + $metadata->addConstraint(new Callback(array( + 'callback' => function () {}, + 'groups' => 'Group 1', + ))); + $metadata->addConstraint(new Callback(array( + 'callback' => $callback1, + 'groups' => 'Group 2', + ))); + $metadata->addConstraint(new Callback(array( + 'callback' => $callback2, + 'groups' => 'Group 3', + ))); + $metadata->setGroupSequenceProvider(true); + + $this->metadataFactory->addMetadata($metadata); + + $violations = $this->validate($entity, null, 'Default'); + + /** @var ConstraintViolationInterface[] $violations */ + $this->assertCount(1, $violations); + $this->assertSame('Violation in Group 2', $violations[0]->getMessage()); + } +} diff --git a/core/vendor/symfony/validator/Tests/Validator/LegacyValidator2Dot5ApiTest.php b/core/vendor/symfony/validator/Tests/Validator/LegacyValidator2Dot5ApiTest.php new file mode 100644 index 0000000..fd1287f --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Validator/LegacyValidator2Dot5ApiTest.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Validator; + +use Symfony\Component\Translation\IdentityTranslator; +use Symfony\Component\Validator\ConstraintValidatorFactory; +use Symfony\Component\Validator\Context\LegacyExecutionContextFactory; +use Symfony\Component\Validator\MetadataFactoryInterface; +use Symfony\Component\Validator\Validator\LegacyValidator; + +/** + * @group legacy + */ +class LegacyValidator2Dot5ApiTest extends Abstract2Dot5ApiTest +{ + protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array()) + { + $translator = new IdentityTranslator(); + $translator->setLocale('en'); + + $contextFactory = new LegacyExecutionContextFactory($metadataFactory, $translator); + $validatorFactory = new ConstraintValidatorFactory(); + + return new LegacyValidator($contextFactory, $metadataFactory, $validatorFactory, $objectInitializers); + } +} diff --git a/core/vendor/symfony/validator/Tests/Validator/LegacyValidatorLegacyApiTest.php b/core/vendor/symfony/validator/Tests/Validator/LegacyValidatorLegacyApiTest.php new file mode 100644 index 0000000..0b51a11 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Validator/LegacyValidatorLegacyApiTest.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Validator; + +use Symfony\Component\Translation\IdentityTranslator; +use Symfony\Component\Validator\ConstraintValidatorFactory; +use Symfony\Component\Validator\Context\LegacyExecutionContextFactory; +use Symfony\Component\Validator\MetadataFactoryInterface; +use Symfony\Component\Validator\Validator\LegacyValidator; + +/** + * @group legacy + */ +class LegacyValidatorLegacyApiTest extends AbstractLegacyApiTest +{ + protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array()) + { + $translator = new IdentityTranslator(); + $translator->setLocale('en'); + + $contextFactory = new LegacyExecutionContextFactory($metadataFactory, $translator); + $validatorFactory = new ConstraintValidatorFactory(); + + return new LegacyValidator($contextFactory, $metadataFactory, $validatorFactory, $objectInitializers); + } +} diff --git a/core/vendor/symfony/validator/Tests/Validator/RecursiveValidator2Dot5ApiTest.php b/core/vendor/symfony/validator/Tests/Validator/RecursiveValidator2Dot5ApiTest.php new file mode 100644 index 0000000..0596126 --- /dev/null +++ b/core/vendor/symfony/validator/Tests/Validator/RecursiveValidator2Dot5ApiTest.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Validator; + +use Symfony\Component\Translation\IdentityTranslator; +use Symfony\Component\Validator\ConstraintValidatorFactory; +use Symfony\Component\Validator\Context\ExecutionContextFactory; +use Symfony\Component\Validator\MetadataFactoryInterface; +use Symfony\Component\Validator\Validator\RecursiveValidator; + +class RecursiveValidator2Dot5ApiTest extends Abstract2Dot5ApiTest +{ + protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = array()) + { + $translator = new IdentityTranslator(); + $translator->setLocale('en'); + + $contextFactory = new ExecutionContextFactory($translator); + $validatorFactory = new ConstraintValidatorFactory(); + + return new RecursiveValidator($contextFactory, $metadataFactory, $validatorFactory, $objectInitializers); + } +} diff --git a/core/vendor/symfony/validator/Tests/ValidatorBuilderTest.php b/core/vendor/symfony/validator/Tests/ValidatorBuilderTest.php new file mode 100644 index 0000000..88e8b3b --- /dev/null +++ b/core/vendor/symfony/validator/Tests/ValidatorBuilderTest.php @@ -0,0 +1,117 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests; + +use Symfony\Component\Validator\Validation; +use Symfony\Component\Validator\ValidatorBuilder; +use Symfony\Component\Validator\ValidatorBuilderInterface; + +class ValidatorBuilderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var ValidatorBuilderInterface + */ + protected $builder; + + protected function setUp() + { + $this->builder = new ValidatorBuilder(); + } + + protected function tearDown() + { + $this->builder = null; + } + + public function testAddObjectInitializer() + { + $this->assertSame($this->builder, $this->builder->addObjectInitializer( + $this->getMock('Symfony\Component\Validator\ObjectInitializerInterface') + )); + } + + public function testAddObjectInitializers() + { + $this->assertSame($this->builder, $this->builder->addObjectInitializers(array())); + } + + public function testAddXmlMapping() + { + $this->assertSame($this->builder, $this->builder->addXmlMapping('mapping')); + } + + public function testAddXmlMappings() + { + $this->assertSame($this->builder, $this->builder->addXmlMappings(array())); + } + + public function testAddYamlMapping() + { + $this->assertSame($this->builder, $this->builder->addYamlMapping('mapping')); + } + + public function testAddYamlMappings() + { + $this->assertSame($this->builder, $this->builder->addYamlMappings(array())); + } + + public function testAddMethodMapping() + { + $this->assertSame($this->builder, $this->builder->addMethodMapping('mapping')); + } + + public function testAddMethodMappings() + { + $this->assertSame($this->builder, $this->builder->addMethodMappings(array())); + } + + public function testEnableAnnotationMapping() + { + $this->assertSame($this->builder, $this->builder->enableAnnotationMapping()); + } + + public function testDisableAnnotationMapping() + { + $this->assertSame($this->builder, $this->builder->disableAnnotationMapping()); + } + + public function testSetMetadataCache() + { + $this->assertSame($this->builder, $this->builder->setMetadataCache( + $this->getMock('Symfony\Component\Validator\Mapping\Cache\CacheInterface')) + ); + } + + public function testSetConstraintValidatorFactory() + { + $this->assertSame($this->builder, $this->builder->setConstraintValidatorFactory( + $this->getMock('Symfony\Component\Validator\ConstraintValidatorFactoryInterface')) + ); + } + + public function testSetTranslator() + { + $this->assertSame($this->builder, $this->builder->setTranslator( + $this->getMock('Symfony\Component\Translation\TranslatorInterface')) + ); + } + + public function testSetTranslationDomain() + { + $this->assertSame($this->builder, $this->builder->setTranslationDomain('TRANS_DOMAIN')); + } + + public function testGetValidator() + { + $this->assertInstanceOf('Symfony\Component\Validator\Validator\RecursiveValidator', $this->builder->getValidator()); + } +} diff --git a/core/vendor/symfony/validator/Util/PropertyPath.php b/core/vendor/symfony/validator/Util/PropertyPath.php new file mode 100644 index 0000000..3ef8a8b --- /dev/null +++ b/core/vendor/symfony/validator/Util/PropertyPath.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Util; + +/** + * Contains utility methods for dealing with property paths. + * + * For more extensive functionality, use Symfony's PropertyAccess component. + * + * @since 2.5 + * + * @author Bernhard Schussek + */ +class PropertyPath +{ + /** + * Appends a path to a given property path. + * + * If the base path is empty, the appended path will be returned unchanged. + * If the base path is not empty, and the appended path starts with a + * squared opening bracket ("["), the concatenation of the two paths is + * returned. Otherwise, the concatenation of the two paths is returned, + * separated by a dot ("."). + * + * @param string $basePath The base path + * @param string $subPath The path to append + * + * @return string The concatenation of the two property paths + */ + public static function append($basePath, $subPath) + { + if ('' !== (string) $subPath) { + if ('[' === $subPath{0}) { + return $basePath.$subPath; + } + + return '' !== (string) $basePath ? $basePath.'.'.$subPath : $subPath; + } + + return $basePath; + } + + /** + * Not instantiable. + */ + private function __construct() + { + } +} diff --git a/core/vendor/symfony/validator/Validation.php b/core/vendor/symfony/validator/Validation.php new file mode 100644 index 0000000..a03d215 --- /dev/null +++ b/core/vendor/symfony/validator/Validation.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * Entry point for the Validator component. + * + * @author Bernhard Schussek + */ +final class Validation +{ + /** + * The Validator API provided by Symfony 2.4 and older. + * @deprecated use API_VERSION_2_5_BC instead. + */ + const API_VERSION_2_4 = 1; + + /** + * The Validator API provided by Symfony 2.5 and newer. + */ + const API_VERSION_2_5 = 2; + + /** + * The Validator API provided by Symfony 2.5 and newer with a backwards + * compatibility layer for 2.4 and older. + */ + const API_VERSION_2_5_BC = 3; + + /** + * Creates a new validator. + * + * If you want to configure the validator, use + * {@link createValidatorBuilder()} instead. + * + * @return ValidatorInterface The new validator. + */ + public static function createValidator() + { + return self::createValidatorBuilder()->getValidator(); + } + + /** + * Creates a configurable builder for validator objects. + * + * @return ValidatorBuilderInterface The new builder. + */ + public static function createValidatorBuilder() + { + return new ValidatorBuilder(); + } + + /** + * This class cannot be instantiated. + */ + private function __construct() + { + } +} diff --git a/core/vendor/symfony/validator/ValidationVisitor.php b/core/vendor/symfony/validator/ValidationVisitor.php new file mode 100644 index 0000000..c7e0655 --- /dev/null +++ b/core/vendor/symfony/validator/ValidationVisitor.php @@ -0,0 +1,212 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +trigger_error('The '.__NAMESPACE__.'\ValidationVisitor class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); + +use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Component\Validator\Exception\NoSuchMetadataException; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Default implementation of {@link ValidationVisitorInterface} and + * {@link GlobalExecutionContextInterface}. + * + * @author Bernhard Schussek + * + * @deprecated since version 2.5, to be removed in 3.0. + */ +class ValidationVisitor implements ValidationVisitorInterface, GlobalExecutionContextInterface +{ + /** + * @var mixed + */ + private $root; + + /** + * @var MetadataFactoryInterface + */ + private $metadataFactory; + + /** + * @var ConstraintValidatorFactoryInterface + */ + private $validatorFactory; + + /** + * @var TranslatorInterface + */ + private $translator; + + /** + * @var null|string + */ + private $translationDomain; + + /** + * @var array + */ + private $objectInitializers; + + /** + * @var ConstraintViolationList + */ + private $violations; + + /** + * @var array + */ + private $validatedObjects = array(); + + /** + * Creates a new validation visitor. + * + * @param mixed $root The value passed to the validator. + * @param MetadataFactoryInterface $metadataFactory The factory for obtaining metadata instances. + * @param ConstraintValidatorFactoryInterface $validatorFactory The factory for creating constraint validators. + * @param TranslatorInterface $translator The translator for translating violation messages. + * @param string|null $translationDomain The domain of the translation messages. + * @param ObjectInitializerInterface[] $objectInitializers The initializers for preparing objects before validation. + * + * @throws UnexpectedTypeException If any of the object initializers is not an instance of ObjectInitializerInterface + */ + public function __construct($root, MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, TranslatorInterface $translator, $translationDomain = null, array $objectInitializers = array()) + { + foreach ($objectInitializers as $initializer) { + if (!$initializer instanceof ObjectInitializerInterface) { + throw new UnexpectedTypeException($initializer, 'Symfony\Component\Validator\ObjectInitializerInterface'); + } + } + + $this->root = $root; + $this->metadataFactory = $metadataFactory; + $this->validatorFactory = $validatorFactory; + $this->translator = $translator; + $this->translationDomain = $translationDomain; + $this->objectInitializers = $objectInitializers; + $this->violations = new ConstraintViolationList(); + } + + /** + * {@inheritdoc} + */ + public function visit(MetadataInterface $metadata, $value, $group, $propertyPath) + { + $context = new ExecutionContext( + $this, + $this->translator, + $this->translationDomain, + $metadata, + $value, + $group, + $propertyPath + ); + + $context->validateValue($value, $metadata->findConstraints($group)); + } + + /** + * {@inheritdoc} + */ + public function validate($value, $group, $propertyPath, $traverse = false, $deep = false) + { + if (null === $value) { + return; + } + + if (is_object($value)) { + $hash = spl_object_hash($value); + + // Exit, if the object is already validated for the current group + if (isset($this->validatedObjects[$hash][$group])) { + return; + } + + // Initialize if the object wasn't initialized before + if (!isset($this->validatedObjects[$hash])) { + foreach ($this->objectInitializers as $initializer) { + if (!$initializer instanceof ObjectInitializerInterface) { + throw new \LogicException('Validator initializers must implement ObjectInitializerInterface.'); + } + $initializer->initialize($value); + } + } + + // Remember validating this object before starting and possibly + // traversing the object graph + $this->validatedObjects[$hash][$group] = true; + } + + // Validate arrays recursively by default, otherwise every driver needs + // to implement special handling for arrays. + // https://github.com/symfony/symfony/issues/6246 + if (is_array($value) || ($traverse && $value instanceof \Traversable)) { + foreach ($value as $key => $element) { + // Ignore any scalar values in the collection + if (is_object($element) || is_array($element)) { + // Only repeat the traversal if $deep is set + $this->validate($element, $group, $propertyPath.'['.$key.']', $deep, $deep); + } + } + + try { + $this->metadataFactory->getMetadataFor($value)->accept($this, $value, $group, $propertyPath); + } catch (NoSuchMetadataException $e) { + // Metadata doesn't necessarily have to exist for + // traversable objects, because we know how to validate + // them anyway. Optionally, additional metadata is supported. + } + } else { + $this->metadataFactory->getMetadataFor($value)->accept($this, $value, $group, $propertyPath); + } + } + + /** + * {@inheritdoc} + */ + public function getViolations() + { + return $this->violations; + } + + /** + * {@inheritdoc} + */ + public function getRoot() + { + return $this->root; + } + + /** + * {@inheritdoc} + */ + public function getVisitor() + { + return $this; + } + + /** + * {@inheritdoc} + */ + public function getValidatorFactory() + { + return $this->validatorFactory; + } + + /** + * {@inheritdoc} + */ + public function getMetadataFactory() + { + return $this->metadataFactory; + } +} diff --git a/core/vendor/symfony/validator/ValidationVisitorInterface.php b/core/vendor/symfony/validator/ValidationVisitorInterface.php new file mode 100644 index 0000000..0ab7b73 --- /dev/null +++ b/core/vendor/symfony/validator/ValidationVisitorInterface.php @@ -0,0 +1,82 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * Validates values against constraints defined in {@link MetadataInterface} + * instances. + * + * This interface is an implementation of the Visitor design pattern. A value + * is validated by first passing it to the {@link validate} method. That method + * will determine the matching {@link MetadataInterface} for validating the + * value. It then calls the {@link MetadataInterface::accept} method of that + * metadata. accept() does two things: + * + *
    + *
  1. It calls {@link visit} to validate the value against the constraints of + * the metadata.
  2. + *
  3. It calls accept() on all nested metadata instances with the + * corresponding values extracted from the current value. For example, if the + * current metadata represents a class and the current value is an object of + * that class, the metadata contains nested instances for each property of that + * class. It forwards the call to these nested metadata with the values of the + * corresponding properties in the original object.
  4. + *
+ * + * @author Bernhard Schussek + * + * @deprecated since version 2.5, to be removed in 3.0. + */ +interface ValidationVisitorInterface +{ + /** + * Validates a value. + * + * If the value is an array or a traversable object, you can set the + * parameter $traverse to true in order to run through + * the collection and validate each element. If these elements can be + * collections again and you want to traverse them recursively, set the + * parameter $deep to true as well. + * + * If you set $traversable to true, the visitor will + * nevertheless try to find metadata for the collection and validate its + * constraints. If no such metadata is found, the visitor ignores that and + * only iterates the collection. + * + * If you don't set $traversable to true and the visitor + * does not find metadata for the given value, it will fail with an + * exception. + * + * @param mixed $value The value to validate. + * @param string $group The validation group to validate. + * @param string $propertyPath The current property path in the validation graph. + * @param bool $traverse Whether to traverse the value if it is traversable. + * @param bool $deep Whether to traverse nested traversable values recursively. + * + * @throws Exception\NoSuchMetadataException If no metadata can be found for + * the given value. + */ + public function validate($value, $group, $propertyPath, $traverse = false, $deep = false); + + /** + * Validates a value against the constraints defined in some metadata. + * + * This method implements the Visitor design pattern. See also + * {@link ValidationVisitorInterface}. + * + * @param MetadataInterface $metadata The metadata holding the constraints. + * @param mixed $value The value to validate. + * @param string $group The validation group to validate. + * @param string $propertyPath The current property path in the validation graph. + */ + public function visit(MetadataInterface $metadata, $value, $group, $propertyPath); +} diff --git a/core/vendor/symfony/validator/Validator.php b/core/vendor/symfony/validator/Validator.php new file mode 100644 index 0000000..8243f17 --- /dev/null +++ b/core/vendor/symfony/validator/Validator.php @@ -0,0 +1,237 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +trigger_error('The '.__NAMESPACE__.'\Validator class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Validator\Validator\RecursiveValidator class instead.', E_USER_DEPRECATED); + +use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Component\Validator\Constraints\Valid; +use Symfony\Component\Validator\Exception\ValidatorException; + +/** + * Default implementation of {@link ValidatorInterface}. + * + * @author Fabien Potencier + * @author Bernhard Schussek + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link Validator\RecursiveValidator} instead. + */ +class Validator implements ValidatorInterface, Mapping\Factory\MetadataFactoryInterface +{ + /** + * @var MetadataFactoryInterface + */ + private $metadataFactory; + + /** + * @var ConstraintValidatorFactoryInterface + */ + private $validatorFactory; + + /** + * @var TranslatorInterface + */ + private $translator; + + /** + * @var null|string + */ + private $translationDomain; + + /** + * @var array + */ + private $objectInitializers; + + public function __construct( + MetadataFactoryInterface $metadataFactory, + ConstraintValidatorFactoryInterface $validatorFactory, + TranslatorInterface $translator, + $translationDomain = 'validators', + array $objectInitializers = array() + ) { + $this->metadataFactory = $metadataFactory; + $this->validatorFactory = $validatorFactory; + $this->translator = $translator; + $this->translationDomain = $translationDomain; + $this->objectInitializers = $objectInitializers; + } + + /** + * {@inheritdoc} + */ + public function getMetadataFactory() + { + return $this->metadataFactory; + } + + /** + * {@inheritdoc} + */ + public function getMetadataFor($value) + { + return $this->metadataFactory->getMetadataFor($value); + } + + /** + * {@inheritdoc} + */ + public function hasMetadataFor($value) + { + return $this->metadataFactory->hasMetadataFor($value); + } + + /** + * {@inheritdoc} + */ + public function validate($value, $groups = null, $traverse = false, $deep = false) + { + $visitor = $this->createVisitor($value); + + foreach ($this->resolveGroups($groups) as $group) { + $visitor->validate($value, $group, '', $traverse, $deep); + } + + return $visitor->getViolations(); + } + + /** + * {@inheritdoc} + * + * @throws ValidatorException If the metadata for the value does not support properties. + */ + public function validateProperty($containingValue, $property, $groups = null) + { + $visitor = $this->createVisitor($containingValue); + $metadata = $this->metadataFactory->getMetadataFor($containingValue); + + if (!$metadata instanceof PropertyMetadataContainerInterface) { + $valueAsString = is_scalar($containingValue) + ? '"'.$containingValue.'"' + : 'the value of type '.gettype($containingValue); + + throw new ValidatorException(sprintf('The metadata for %s does not support properties.', $valueAsString)); + } + + foreach ($this->resolveGroups($groups) as $group) { + if (!$metadata->hasPropertyMetadata($property)) { + continue; + } + + foreach ($metadata->getPropertyMetadata($property) as $propMeta) { + $propMeta->accept($visitor, $propMeta->getPropertyValue($containingValue), $group, $property); + } + } + + return $visitor->getViolations(); + } + + /** + * {@inheritdoc} + * + * @throws ValidatorException If the metadata for the value does not support properties. + */ + public function validatePropertyValue($containingValue, $property, $value, $groups = null) + { + $visitor = $this->createVisitor(is_object($containingValue) ? $containingValue : $value); + $metadata = $this->metadataFactory->getMetadataFor($containingValue); + + if (!$metadata instanceof PropertyMetadataContainerInterface) { + $valueAsString = is_scalar($containingValue) + ? '"'.$containingValue.'"' + : 'the value of type '.gettype($containingValue); + + throw new ValidatorException(sprintf('The metadata for '.$valueAsString.' does not support properties.')); + } + + // If $containingValue is passed as class name, take $value as root + // and start the traversal with an empty property path + $propertyPath = is_object($containingValue) ? $property : ''; + + foreach ($this->resolveGroups($groups) as $group) { + if (!$metadata->hasPropertyMetadata($property)) { + continue; + } + + foreach ($metadata->getPropertyMetadata($property) as $propMeta) { + $propMeta->accept($visitor, $value, $group, $propertyPath); + } + } + + return $visitor->getViolations(); + } + + /** + * {@inheritdoc} + */ + public function validateValue($value, $constraints, $groups = null) + { + $context = new ExecutionContext($this->createVisitor($value), $this->translator, $this->translationDomain); + + $constraints = is_array($constraints) ? $constraints : array($constraints); + + foreach ($constraints as $constraint) { + if ($constraint instanceof Valid) { + // Why can't the Valid constraint be executed directly? + // + // It cannot be executed like regular other constraints, because regular + // constraints are only executed *if they belong to the validated group*. + // The Valid constraint, on the other hand, is always executed and propagates + // the group to the cascaded object. The propagated group depends on + // + // * Whether a group sequence is currently being executed. Then the default + // group is propagated. + // + // * Otherwise the validated group is propagated. + + throw new ValidatorException( + sprintf( + 'The constraint %s cannot be validated. Use the method validate() instead.', + get_class($constraint) + ) + ); + } + + $context->validateValue($value, $constraint, '', $groups); + } + + return $context->getViolations(); + } + + /** + * @param mixed $root + * + * @return ValidationVisitor + */ + private function createVisitor($root) + { + return new ValidationVisitor( + $root, + $this->metadataFactory, + $this->validatorFactory, + $this->translator, + $this->translationDomain, + $this->objectInitializers + ); + } + + /** + * @param null|string|string[] $groups + * + * @return string[] + */ + private function resolveGroups($groups) + { + return $groups ? (array) $groups : array(Constraint::DEFAULT_GROUP); + } +} diff --git a/core/vendor/symfony/validator/Validator/ContextualValidatorInterface.php b/core/vendor/symfony/validator/Validator/ContextualValidatorInterface.php new file mode 100644 index 0000000..767f895 --- /dev/null +++ b/core/vendor/symfony/validator/Validator/ContextualValidatorInterface.php @@ -0,0 +1,89 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Validator; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintViolationListInterface; + +/** + * A validator in a specific execution context. + * + * @since 2.5 + * @author Bernhard Schussek + */ +interface ContextualValidatorInterface +{ + /** + * Appends the given path to the property path of the context. + * + * If called multiple times, the path will always be reset to the context's + * original path with the given path appended to it. + * + * @param string $path The path to append + * + * @return ContextualValidatorInterface This validator + */ + public function atPath($path); + + /** + * Validates a value against a constraint or a list of constraints. + * + * If no constraint is passed, the constraint + * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. + * + * @param mixed $value The value to validate + * @param Constraint|Constraint[] $constraints The constraint(s) to validate + * against + * @param array|null $groups The validation groups to + * validate. If none is given, + * "Default" is assumed + * + * @return ContextualValidatorInterface This validator + */ + public function validate($value, $constraints = null, $groups = null); + + /** + * Validates a property of an object against the constraints specified + * for this property. + * + * @param object $object The object + * @param string $propertyName The name of the validated property + * @param array|null $groups The validation groups to validate. If + * none is given, "Default" is assumed + * + * @return ContextualValidatorInterface This validator + */ + public function validateProperty($object, $propertyName, $groups = null); + + /** + * Validates a value against the constraints specified for an object's + * property. + * + * @param object|string $objectOrClass The object or its class name + * @param string $propertyName The name of the property + * @param mixed $value The value to validate against the + * property's constraints + * @param array|null $groups The validation groups to validate. If + * none is given, "Default" is assumed + * + * @return ContextualValidatorInterface This validator + */ + public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null); + + /** + * Returns the violations that have been generated so far in the context + * of the validator. + * + * @return ConstraintViolationListInterface The constraint violations + */ + public function getViolations(); +} diff --git a/core/vendor/symfony/validator/Validator/LegacyValidator.php b/core/vendor/symfony/validator/Validator/LegacyValidator.php new file mode 100644 index 0000000..6c5a10c --- /dev/null +++ b/core/vendor/symfony/validator/Validator/LegacyValidator.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Validator; + +trigger_error('The '.__NAMESPACE__.'\LegacyValidator class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); + +/** + * A validator that supports both the API of Symfony < 2.5 and Symfony 2.5+. + * + * @since 2.5 + * @author Bernhard Schussek + * + * @see \Symfony\Component\Validator\ValidatorInterface + * @see \Symfony\Component\Validator\Validator\ValidatorInterface + * + * @deprecated since version 2.5, to be removed in 3.0. + */ +class LegacyValidator extends RecursiveValidator +{ +} diff --git a/core/vendor/symfony/validator/Validator/RecursiveContextualValidator.php b/core/vendor/symfony/validator/Validator/RecursiveContextualValidator.php new file mode 100644 index 0000000..9388d07 --- /dev/null +++ b/core/vendor/symfony/validator/Validator/RecursiveContextualValidator.php @@ -0,0 +1,872 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Validator; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\GroupSequence; +use Symfony\Component\Validator\ConstraintValidatorFactoryInterface; +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\NoSuchMetadataException; +use Symfony\Component\Validator\Exception\RuntimeException; +use Symfony\Component\Validator\Exception\UnsupportedMetadataException; +use Symfony\Component\Validator\Exception\ValidatorException; +use Symfony\Component\Validator\Mapping\CascadingStrategy; +use Symfony\Component\Validator\Mapping\ClassMetadataInterface; +use Symfony\Component\Validator\Mapping\GenericMetadata; +use Symfony\Component\Validator\Mapping\MetadataInterface; +use Symfony\Component\Validator\Mapping\PreprocessingMetadataInterface; +use Symfony\Component\Validator\Mapping\PropertyMetadataInterface; +use Symfony\Component\Validator\Mapping\TraversalStrategy; +use Symfony\Component\Validator\MetadataFactoryInterface; +use Symfony\Component\Validator\ObjectInitializerInterface; +use Symfony\Component\Validator\Util\PropertyPath; + +/** + * Recursive implementation of {@link ContextualValidatorInterface}. + * + * @since 2.5 + * + * @author Bernhard Schussek + */ +class RecursiveContextualValidator implements ContextualValidatorInterface +{ + /** + * @var ExecutionContextInterface + */ + private $context; + + /** + * @var MetadataFactoryInterface + */ + private $metadataFactory; + + /** + * @var ConstraintValidatorFactoryInterface + */ + private $validatorFactory; + + /** + * @var ObjectInitializerInterface[] + */ + private $objectInitializers; + + /** + * Creates a validator for the given context. + * + * @param ExecutionContextInterface $context The execution context + * @param MetadataFactoryInterface $metadataFactory The factory for + * fetching the metadata + * of validated objects + * @param ConstraintValidatorFactoryInterface $validatorFactory The factory for creating + * constraint validators + * @param ObjectInitializerInterface[] $objectInitializers The object initializers + */ + public function __construct(ExecutionContextInterface $context, MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, array $objectInitializers = array()) + { + $this->context = $context; + $this->defaultPropertyPath = $context->getPropertyPath(); + $this->defaultGroups = array($context->getGroup() ?: Constraint::DEFAULT_GROUP); + $this->metadataFactory = $metadataFactory; + $this->validatorFactory = $validatorFactory; + $this->objectInitializers = $objectInitializers; + } + + /** + * {@inheritdoc} + */ + public function atPath($path) + { + $this->defaultPropertyPath = $this->context->getPropertyPath($path); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function validate($value, $constraints = null, $groups = null) + { + $groups = $groups ? $this->normalizeGroups($groups) : $this->defaultGroups; + + $previousValue = $this->context->getValue(); + $previousObject = $this->context->getObject(); + $previousMetadata = $this->context->getMetadata(); + $previousPath = $this->context->getPropertyPath(); + $previousGroup = $this->context->getGroup(); + + // If explicit constraints are passed, validate the value against + // those constraints + if (null !== $constraints) { + // You can pass a single constraint or an array of constraints + // Make sure to deal with an array in the rest of the code + if (!is_array($constraints)) { + $constraints = array($constraints); + } + + $metadata = new GenericMetadata(); + $metadata->addConstraints($constraints); + + $this->validateGenericNode( + $value, + null, + is_object($value) ? spl_object_hash($value) : null, + $metadata, + $this->defaultPropertyPath, + $groups, + null, + TraversalStrategy::IMPLICIT, + $this->context + ); + + $this->context->setNode($previousValue, $previousObject, $previousMetadata, $previousPath); + $this->context->setGroup($previousGroup); + + return $this; + } + + // If an object is passed without explicit constraints, validate that + // object against the constraints defined for the object's class + if (is_object($value)) { + $this->validateObject( + $value, + $this->defaultPropertyPath, + $groups, + TraversalStrategy::IMPLICIT, + $this->context + ); + + $this->context->setNode($previousValue, $previousObject, $previousMetadata, $previousPath); + $this->context->setGroup($previousGroup); + + return $this; + } + + // If an array is passed without explicit constraints, validate each + // object in the array + if (is_array($value)) { + $this->validateEachObjectIn( + $value, + $this->defaultPropertyPath, + $groups, + true, + $this->context + ); + + $this->context->setNode($previousValue, $previousObject, $previousMetadata, $previousPath); + $this->context->setGroup($previousGroup); + + return $this; + } + + throw new RuntimeException(sprintf( + 'Cannot validate values of type "%s" automatically. Please '. + 'provide a constraint.', + gettype($value) + )); + } + + /** + * {@inheritdoc} + */ + public function validateProperty($object, $propertyName, $groups = null) + { + $classMetadata = $this->metadataFactory->getMetadataFor($object); + + if (!$classMetadata instanceof ClassMetadataInterface) { + // Cannot be UnsupportedMetadataException because of BC with + // Symfony < 2.5 + throw new ValidatorException(sprintf( + 'The metadata factory should return instances of '. + '"\Symfony\Component\Validator\Mapping\ClassMetadataInterface", '. + 'got: "%s".', + is_object($classMetadata) ? get_class($classMetadata) : gettype($classMetadata) + )); + } + + $propertyMetadatas = $classMetadata->getPropertyMetadata($propertyName); + $groups = $groups ? $this->normalizeGroups($groups) : $this->defaultGroups; + $cacheKey = spl_object_hash($object); + $propertyPath = PropertyPath::append($this->defaultPropertyPath, $propertyName); + + $previousValue = $this->context->getValue(); + $previousObject = $this->context->getObject(); + $previousMetadata = $this->context->getMetadata(); + $previousPath = $this->context->getPropertyPath(); + $previousGroup = $this->context->getGroup(); + + foreach ($propertyMetadatas as $propertyMetadata) { + $propertyValue = $propertyMetadata->getPropertyValue($object); + + $this->validateGenericNode( + $propertyValue, + $object, + $cacheKey.':'.$propertyName, + $propertyMetadata, + $propertyPath, + $groups, + null, + TraversalStrategy::IMPLICIT, + $this->context + ); + } + + $this->context->setNode($previousValue, $previousObject, $previousMetadata, $previousPath); + $this->context->setGroup($previousGroup); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null) + { + $classMetadata = $this->metadataFactory->getMetadataFor($objectOrClass); + + if (!$classMetadata instanceof ClassMetadataInterface) { + // Cannot be UnsupportedMetadataException because of BC with + // Symfony < 2.5 + throw new ValidatorException(sprintf( + 'The metadata factory should return instances of '. + '"\Symfony\Component\Validator\Mapping\ClassMetadataInterface", '. + 'got: "%s".', + is_object($classMetadata) ? get_class($classMetadata) : gettype($classMetadata) + )); + } + + $propertyMetadatas = $classMetadata->getPropertyMetadata($propertyName); + $groups = $groups ? $this->normalizeGroups($groups) : $this->defaultGroups; + + if (is_object($objectOrClass)) { + $object = $objectOrClass; + $cacheKey = spl_object_hash($objectOrClass); + $propertyPath = PropertyPath::append($this->defaultPropertyPath, $propertyName); + } else { + // $objectOrClass contains a class name + $object = null; + $cacheKey = null; + $propertyPath = $this->defaultPropertyPath; + } + + $previousValue = $this->context->getValue(); + $previousObject = $this->context->getObject(); + $previousMetadata = $this->context->getMetadata(); + $previousPath = $this->context->getPropertyPath(); + $previousGroup = $this->context->getGroup(); + + foreach ($propertyMetadatas as $propertyMetadata) { + $this->validateGenericNode( + $value, + $object, + $cacheKey.':'.$propertyName, + $propertyMetadata, + $propertyPath, + $groups, + null, + TraversalStrategy::IMPLICIT, + $this->context + ); + } + + $this->context->setNode($previousValue, $previousObject, $previousMetadata, $previousPath); + $this->context->setGroup($previousGroup); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getViolations() + { + return $this->context->getViolations(); + } + + /** + * Normalizes the given group or list of groups to an array. + * + * @param mixed $groups The groups to normalize + * + * @return array A group array + */ + protected function normalizeGroups($groups) + { + if (is_array($groups)) { + return $groups; + } + + return array($groups); + } + /** + * Validates an object against the constraints defined for its class. + * + * If no metadata is available for the class, but the class is an instance + * of {@link \Traversable} and the selected traversal strategy allows + * traversal, the object will be iterated and each nested object will be + * validated instead. + * + * @param object $object The object to cascade + * @param string $propertyPath The current property path + * @param string[] $groups The validated groups + * @param int $traversalStrategy The strategy for traversing the + * cascaded object + * @param ExecutionContextInterface $context The current execution context + * + * @throws NoSuchMetadataException If the object has no associated metadata + * and does not implement {@link \Traversable} + * or if traversal is disabled via the + * $traversalStrategy argument + * @throws UnsupportedMetadataException If the metadata returned by the + * metadata factory does not implement + * {@link ClassMetadataInterface} + */ + private function validateObject($object, $propertyPath, array $groups, $traversalStrategy, ExecutionContextInterface $context) + { + try { + $classMetadata = $this->metadataFactory->getMetadataFor($object); + + if (!$classMetadata instanceof ClassMetadataInterface) { + throw new UnsupportedMetadataException(sprintf( + 'The metadata factory should return instances of '. + '"Symfony\Component\Validator\Mapping\ClassMetadataInterface", '. + 'got: "%s".', + is_object($classMetadata) ? get_class($classMetadata) : gettype($classMetadata) + )); + } + + $this->validateClassNode( + $object, + spl_object_hash($object), + $classMetadata, + $propertyPath, + $groups, + null, + $traversalStrategy, + $context + ); + } catch (NoSuchMetadataException $e) { + // Rethrow if not Traversable + if (!$object instanceof \Traversable) { + throw $e; + } + + // Rethrow unless IMPLICIT or TRAVERSE + if (!($traversalStrategy & (TraversalStrategy::IMPLICIT | TraversalStrategy::TRAVERSE))) { + throw $e; + } + + $this->validateEachObjectIn( + $object, + $propertyPath, + $groups, + $traversalStrategy & TraversalStrategy::STOP_RECURSION, + $context + ); + } + } + + /** + * Validates each object in a collection against the constraints defined + * for their classes. + * + * If the parameter $recursive is set to true, nested {@link \Traversable} + * objects are iterated as well. Nested arrays are always iterated, + * regardless of the value of $recursive. + * + * @param array|\Traversable $collection The collection + * @param string $propertyPath The current property path + * @param string[] $groups The validated groups + * @param bool $stopRecursion Whether to disable + * recursive iteration. For + * backwards compatibility + * with Symfony < 2.5. + * @param ExecutionContextInterface $context The current execution context + * + * @see ClassNode + * @see CollectionNode + */ + private function validateEachObjectIn($collection, $propertyPath, array $groups, $stopRecursion, ExecutionContextInterface $context) + { + if ($stopRecursion) { + $traversalStrategy = TraversalStrategy::NONE; + } else { + $traversalStrategy = TraversalStrategy::IMPLICIT; + } + + foreach ($collection as $key => $value) { + if (is_array($value)) { + // Arrays are always cascaded, independent of the specified + // traversal strategy + // (BC with Symfony < 2.5) + $this->validateEachObjectIn( + $value, + $propertyPath.'['.$key.']', + $groups, + $stopRecursion, + $context + ); + + continue; + } + + // Scalar and null values in the collection are ignored + // (BC with Symfony < 2.5) + if (is_object($value)) { + $this->validateObject( + $value, + $propertyPath.'['.$key.']', + $groups, + $traversalStrategy, + $context + ); + } + } + } + + /** + * Validates a class node. + * + * A class node is a combination of an object with a {@link ClassMetadataInterface} + * instance. Each class node (conceptionally) has zero or more succeeding + * property nodes: + * + * (Article:class node) + * \ + * ($title:property node) + * + * This method validates the passed objects against all constraints defined + * at class level. It furthermore triggers the validation of each of the + * class' properties against the constraints for that property. + * + * If the selected traversal strategy allows traversal, the object is + * iterated and each nested object is validated against its own constraints. + * The object is not traversed if traversal is disabled in the class + * metadata. + * + * If the passed groups contain the group "Default", the validator will + * check whether the "Default" group has been replaced by a group sequence + * in the class metadata. If this is the case, the group sequence is + * validated instead. + * + * @param object $object The validated object + * @param string $cacheKey The key for caching + * the validated object + * @param ClassMetadataInterface $metadata The class metadata of + * the object + * @param string $propertyPath The property path leading + * to the object + * @param string[] $groups The groups in which the + * object should be validated + * @param string[]|null $cascadedGroups The groups in which + * cascaded objects should + * be validated + * @param int $traversalStrategy The strategy used for + * traversing the object + * @param ExecutionContextInterface $context The current execution context + * + * @throws UnsupportedMetadataException If a property metadata does not + * implement {@link PropertyMetadataInterface} + * @throws ConstraintDefinitionException If traversal was enabled but the + * object does not implement + * {@link \Traversable} + * + * @see TraversalStrategy + */ + private function validateClassNode($object, $cacheKey, ClassMetadataInterface $metadata = null, $propertyPath, array $groups, $cascadedGroups, $traversalStrategy, ExecutionContextInterface $context) + { + if ($metadata instanceof PreprocessingMetadataInterface) { + $object = $metadata->preprocessValue($object); + } + $context->setNode($object, $object, $metadata, $propertyPath); + + if (!$context->isObjectInitialized($cacheKey)) { + foreach ($this->objectInitializers as $initializer) { + $initializer->initialize($object); + } + + $context->markObjectAsInitialized($cacheKey); + } + + foreach ($groups as $key => $group) { + // If the "Default" group is replaced by a group sequence, remember + // to cascade the "Default" group when traversing the group + // sequence + $defaultOverridden = false; + + // Use the object hash for group sequences + $groupHash = is_object($group) ? spl_object_hash($group) : $group; + + if ($context->isGroupValidated($cacheKey, $groupHash)) { + // Skip this group when validating the properties and when + // traversing the object + unset($groups[$key]); + + continue; + } + + $context->markGroupAsValidated($cacheKey, $groupHash); + + // Replace the "Default" group by the group sequence defined + // for the class, if applicable. + // This is done after checking the cache, so that + // spl_object_hash() isn't called for this sequence and + // "Default" is used instead in the cache. This is useful + // if the getters below return different group sequences in + // every call. + if (Constraint::DEFAULT_GROUP === $group) { + if ($metadata->hasGroupSequence()) { + // The group sequence is statically defined for the class + $group = $metadata->getGroupSequence(); + $defaultOverridden = true; + } elseif ($metadata->isGroupSequenceProvider()) { + // The group sequence is dynamically obtained from the validated + // object + /* @var \Symfony\Component\Validator\GroupSequenceProviderInterface $object */ + $group = $object->getGroupSequence(); + $defaultOverridden = true; + + if (!$group instanceof GroupSequence) { + $group = new GroupSequence($group); + } + } + } + + // If the groups (=[,G3,G4]) contain a group sequence + // (=), then call validateClassNode() with each entry of the + // group sequence and abort if necessary (G1, G2) + if ($group instanceof GroupSequence) { + $this->stepThroughGroupSequence( + $object, + $object, + $cacheKey, + $metadata, + $propertyPath, + $traversalStrategy, + $group, + $defaultOverridden ? Constraint::DEFAULT_GROUP : null, + $context + ); + + // Skip the group sequence when validating properties, because + // stepThroughGroupSequence() already validates the properties + unset($groups[$key]); + + continue; + } + + $this->validateInGroup($object, $cacheKey, $metadata, $group, $context); + } + + // If no more groups should be validated for the property nodes, + // we can safely quit + if (0 === count($groups)) { + return; + } + + // Validate all properties against their constraints + foreach ($metadata->getConstrainedProperties() as $propertyName) { + // If constraints are defined both on the getter of a property as + // well as on the property itself, then getPropertyMetadata() + // returns two metadata objects, not just one + foreach ($metadata->getPropertyMetadata($propertyName) as $propertyMetadata) { + if (!$propertyMetadata instanceof PropertyMetadataInterface) { + throw new UnsupportedMetadataException(sprintf( + 'The property metadata instances should implement '. + '"Symfony\Component\Validator\Mapping\PropertyMetadataInterface", '. + 'got: "%s".', + is_object($propertyMetadata) ? get_class($propertyMetadata) : gettype($propertyMetadata) + )); + } + + $propertyValue = $propertyMetadata->getPropertyValue($object); + + $this->validateGenericNode( + $propertyValue, + $object, + $cacheKey.':'.$propertyName, + $propertyMetadata, + PropertyPath::append($propertyPath, $propertyName), + $groups, + $cascadedGroups, + TraversalStrategy::IMPLICIT, + $context + ); + } + } + + // If no specific traversal strategy was requested when this method + // was called, use the traversal strategy of the class' metadata + if ($traversalStrategy & TraversalStrategy::IMPLICIT) { + // Keep the STOP_RECURSION flag, if it was set + $traversalStrategy = $metadata->getTraversalStrategy() + | ($traversalStrategy & TraversalStrategy::STOP_RECURSION); + } + + // Traverse only if IMPLICIT or TRAVERSE + if (!($traversalStrategy & (TraversalStrategy::IMPLICIT | TraversalStrategy::TRAVERSE))) { + return; + } + + // If IMPLICIT, stop unless we deal with a Traversable + if ($traversalStrategy & TraversalStrategy::IMPLICIT && !$object instanceof \Traversable) { + return; + } + + // If TRAVERSE, fail if we have no Traversable + if (!$object instanceof \Traversable) { + // Must throw a ConstraintDefinitionException for backwards + // compatibility reasons with Symfony < 2.5 + throw new ConstraintDefinitionException(sprintf( + 'Traversal was enabled for "%s", but this class '. + 'does not implement "\Traversable".', + get_class($object) + )); + } + + $this->validateEachObjectIn( + $object, + $propertyPath, + $groups, + $traversalStrategy & TraversalStrategy::STOP_RECURSION, + $context + ); + } + + /** + * Validates a node that is not a class node. + * + * Currently, two such node types exist: + * + * - property nodes, which consist of the value of an object's + * property together with a {@link PropertyMetadataInterface} instance + * - generic nodes, which consist of a value and some arbitrary + * constraints defined in a {@link MetadataInterface} container + * + * In both cases, the value is validated against all constraints defined + * in the passed metadata object. Then, if the value is an instance of + * {@link \Traversable} and the selected traversal strategy permits it, + * the value is traversed and each nested object validated against its own + * constraints. Arrays are always traversed. + * + * @param mixed $value The validated value + * @param object|null $object The current object + * @param string $cacheKey The key for caching + * the validated value + * @param MetadataInterface $metadata The metadata of the + * value + * @param string $propertyPath The property path leading + * to the value + * @param string[] $groups The groups in which the + * value should be validated + * @param string[]|null $cascadedGroups The groups in which + * cascaded objects should + * be validated + * @param int $traversalStrategy The strategy used for + * traversing the value + * @param ExecutionContextInterface $context The current execution context + * + * @see TraversalStrategy + */ + private function validateGenericNode($value, $object, $cacheKey, MetadataInterface $metadata = null, $propertyPath, array $groups, $cascadedGroups, $traversalStrategy, ExecutionContextInterface $context) + { + if ($metadata instanceof PreprocessingMetadataInterface) { + $value = $metadata->preprocessValue($value); + } + $context->setNode($value, $object, $metadata, $propertyPath); + + foreach ($groups as $key => $group) { + if ($group instanceof GroupSequence) { + $this->stepThroughGroupSequence( + $value, + $object, + $cacheKey, + $metadata, + $propertyPath, + $traversalStrategy, + $group, + null, + $context + ); + + // Skip the group sequence when cascading, as the cascading + // logic is already done in stepThroughGroupSequence() + unset($groups[$key]); + + continue; + } + + $this->validateInGroup($value, $cacheKey, $metadata, $group, $context); + } + + if (0 === count($groups)) { + return; + } + + if (null === $value) { + return; + } + + $cascadingStrategy = $metadata->getCascadingStrategy(); + + // Quit unless we have an array or a cascaded object + if (!is_array($value) && !($cascadingStrategy & CascadingStrategy::CASCADE)) { + return; + } + + // If no specific traversal strategy was requested when this method + // was called, use the traversal strategy of the node's metadata + if ($traversalStrategy & TraversalStrategy::IMPLICIT) { + // Keep the STOP_RECURSION flag, if it was set + $traversalStrategy = $metadata->getTraversalStrategy() + | ($traversalStrategy & TraversalStrategy::STOP_RECURSION); + } + + // The $cascadedGroups property is set, if the "Default" group is + // overridden by a group sequence + // See validateClassNode() + $cascadedGroups = count($cascadedGroups) > 0 + ? $cascadedGroups + : $groups; + + if (is_array($value)) { + // Arrays are always traversed, independent of the specified + // traversal strategy + // (BC with Symfony < 2.5) + $this->validateEachObjectIn( + $value, + $propertyPath, + $cascadedGroups, + $traversalStrategy & TraversalStrategy::STOP_RECURSION, + $context + ); + + return; + } + + // If the value is a scalar, pass it anyway, because we want + // a NoSuchMetadataException to be thrown in that case + // (BC with Symfony < 2.5) + $this->validateObject( + $value, + $propertyPath, + $cascadedGroups, + $traversalStrategy, + $context + ); + + // Currently, the traversal strategy can only be TRAVERSE for a + // generic node if the cascading strategy is CASCADE. Thus, traversable + // objects will always be handled within validateObject() and there's + // nothing more to do here. + + // see GenericMetadata::addConstraint() + } + + /** + * Sequentially validates a node's value in each group of a group sequence. + * + * If any of the constraints generates a violation, subsequent groups in the + * group sequence are skipped. + * + * @param mixed $value The validated value + * @param object|null $object The current object + * @param string $cacheKey The key for caching + * the validated value + * @param MetadataInterface $metadata The metadata of the + * value + * @param string $propertyPath The property path leading + * to the value + * @param int $traversalStrategy The strategy used for + * traversing the value + * @param GroupSequence $groupSequence The group sequence + * @param string[]|null $cascadedGroup The group that should + * be passed to cascaded + * objects instead of + * the group sequence + * @param ExecutionContextInterface $context The execution context + */ + private function stepThroughGroupSequence($value, $object, $cacheKey, MetadataInterface $metadata = null, $propertyPath, $traversalStrategy, GroupSequence $groupSequence, $cascadedGroup, ExecutionContextInterface $context) + { + $violationCount = count($context->getViolations()); + $cascadedGroups = $cascadedGroup ? array($cascadedGroup) : null; + + foreach ($groupSequence->groups as $groupInSequence) { + $groups = array($groupInSequence); + + if ($metadata instanceof ClassMetadataInterface) { + $this->validateClassNode( + $value, + $cacheKey, + $metadata, + $propertyPath, + $groups, + $cascadedGroups, + $traversalStrategy, + $context + ); + } else { + $this->validateGenericNode( + $value, + $object, + $cacheKey, + $metadata, + $propertyPath, + $groups, + $cascadedGroups, + $traversalStrategy, + $context + ); + } + + // Abort sequence validation if a violation was generated + if (count($context->getViolations()) > $violationCount) { + break; + } + } + } + + /** + * 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 + */ + 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 ($context->isConstraintValidated($cacheKey, $constraintHash)) { + continue; + } + + $context->markConstraintAsValidated($cacheKey, $constraintHash); + } + + $context->setConstraint($constraint); + + $validator = $this->validatorFactory->getInstance($constraint); + $validator->initialize($context); + $validator->validate($value, $constraint); + } + } +} diff --git a/core/vendor/symfony/validator/Validator/RecursiveValidator.php b/core/vendor/symfony/validator/Validator/RecursiveValidator.php new file mode 100644 index 0000000..c825bfa --- /dev/null +++ b/core/vendor/symfony/validator/Validator/RecursiveValidator.php @@ -0,0 +1,187 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Validator; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\GroupSequence; +use Symfony\Component\Validator\Constraints\Valid; +use Symfony\Component\Validator\ConstraintValidatorFactoryInterface; +use Symfony\Component\Validator\Context\ExecutionContextFactoryInterface; +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\MetadataFactoryInterface; +use Symfony\Component\Validator\ObjectInitializerInterface; +use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface; + +/** + * Recursive implementation of {@link ValidatorInterface}. + * + * @since 2.5 + * @author Bernhard Schussek + */ +class RecursiveValidator implements ValidatorInterface, LegacyValidatorInterface +{ + /** + * @var ExecutionContextFactoryInterface + */ + protected $contextFactory; + + /** + * @var MetadataFactoryInterface + */ + protected $metadataFactory; + + /** + * @var ConstraintValidatorFactoryInterface + */ + protected $validatorFactory; + + /** + * @var ObjectInitializerInterface[] + */ + protected $objectInitializers; + + /** + * Creates a new validator. + * + * @param ExecutionContextFactoryInterface $contextFactory The factory for + * creating new contexts + * @param MetadataFactoryInterface $metadataFactory The factory for + * fetching the metadata + * of validated objects + * @param ConstraintValidatorFactoryInterface $validatorFactory The factory for creating + * constraint validators + * @param ObjectInitializerInterface[] $objectInitializers The object initializers + */ + public function __construct(ExecutionContextFactoryInterface $contextFactory, MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, array $objectInitializers = array()) + { + $this->contextFactory = $contextFactory; + $this->metadataFactory = $metadataFactory; + $this->validatorFactory = $validatorFactory; + $this->objectInitializers = $objectInitializers; + } + + /** + * {@inheritdoc} + */ + public function startContext($root = null) + { + return new RecursiveContextualValidator( + $this->contextFactory->createContext($this, $root), + $this->metadataFactory, + $this->validatorFactory, + $this->objectInitializers + ); + } + + /** + * {@inheritdoc} + */ + public function inContext(ExecutionContextInterface $context) + { + return new RecursiveContextualValidator( + $context, + $this->metadataFactory, + $this->validatorFactory, + $this->objectInitializers + ); + } + + /** + * {@inheritdoc} + */ + public function getMetadataFor($object) + { + return $this->metadataFactory->getMetadataFor($object); + } + + /** + * {@inheritdoc} + */ + public function hasMetadataFor($object) + { + return $this->metadataFactory->hasMetadataFor($object); + } + + /** + * {@inheritdoc} + */ + public function validate($value, $groups = null, $traverse = false, $deep = false) + { + $numArgs = func_num_args(); + + // Use new signature if constraints are given in the second argument + if (self::testConstraints($groups) && ($numArgs < 3 || 3 === $numArgs && self::testGroups($traverse))) { + // Rename to avoid total confusion ;) + $constraints = $groups; + $groups = $traverse; + } else { + trigger_error('The Symfony\Component\Validator\ValidatorInterface::validate method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::validate method instead.', E_USER_DEPRECATED); + + $constraints = new Valid(array('traverse' => $traverse, 'deep' => $deep)); + } + + return $this->startContext($value) + ->validate($value, $constraints, $groups) + ->getViolations(); + } + + /** + * {@inheritdoc} + */ + public function validateProperty($object, $propertyName, $groups = null) + { + return $this->startContext($object) + ->validateProperty($object, $propertyName, $groups) + ->getViolations(); + } + + /** + * {@inheritdoc} + */ + public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null) + { + // If a class name is passed, take $value as root + return $this->startContext(is_object($objectOrClass) ? $objectOrClass : $value) + ->validatePropertyValue($objectOrClass, $propertyName, $value, $groups) + ->getViolations(); + } + + /** + * {@inheritdoc} + */ + public function validateValue($value, $constraints, $groups = null) + { + trigger_error('The '.__METHOD__.' method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::validate method instead.', E_USER_DEPRECATED); + + return $this->validate($value, $constraints, $groups); + } + + /** + * {@inheritdoc} + */ + public function getMetadataFactory() + { + trigger_error('The '.__METHOD__.' method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::getMetadataFor or Symfony\Component\Validator\Validator\ValidatorInterface::hasMetadataFor method instead.', E_USER_DEPRECATED); + + return $this->metadataFactory; + } + + private static function testConstraints($constraints) + { + return null === $constraints || $constraints instanceof Constraint || (is_array($constraints) && current($constraints) instanceof Constraint); + } + + private static function testGroups($groups) + { + return null === $groups || is_string($groups) || $groups instanceof GroupSequence || (is_array($groups) && (is_string(current($groups)) || current($groups) instanceof GroupSequence)); + } +} diff --git a/core/vendor/symfony/validator/Validator/ValidatorInterface.php b/core/vendor/symfony/validator/Validator/ValidatorInterface.php new file mode 100644 index 0000000..2582bf6 --- /dev/null +++ b/core/vendor/symfony/validator/Validator/ValidatorInterface.php @@ -0,0 +1,100 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Validator; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintViolationListInterface; +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; + +/** + * Validates PHP values against constraints. + * + * @since 2.5 + * @author Bernhard Schussek + */ +interface ValidatorInterface extends MetadataFactoryInterface +{ + /** + * Validates a value against a constraint or a list of constraints. + * + * If no constraint is passed, the constraint + * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. + * + * @param mixed $value The value to validate + * @param Constraint|Constraint[] $constraints The constraint(s) to validate + * against + * @param array|null $groups The validation groups to + * validate. If none is given, + * "Default" is assumed + * + * @return ConstraintViolationListInterface A list of constraint violations. + * If the list is empty, validation + * succeeded + */ + public function validate($value, $constraints = null, $groups = null); + + /** + * Validates a property of an object against the constraints specified + * for this property. + * + * @param object $object The object + * @param string $propertyName The name of the validated property + * @param array|null $groups The validation groups to validate. If + * none is given, "Default" is assumed + * + * @return ConstraintViolationListInterface A list of constraint violations. + * If the list is empty, validation + * succeeded + */ + public function validateProperty($object, $propertyName, $groups = null); + + /** + * Validates a value against the constraints specified for an object's + * property. + * + * @param object|string $objectOrClass The object or its class name + * @param string $propertyName The name of the property + * @param mixed $value The value to validate against the + * property's constraints + * @param array|null $groups The validation groups to validate. If + * none is given, "Default" is assumed + * + * @return ConstraintViolationListInterface A list of constraint violations. + * If the list is empty, validation + * succeeded + */ + public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null); + + /** + * Starts a new validation context and returns a validator for that context. + * + * The returned validator collects all violations generated within its + * context. You can access these violations with the + * {@link ContextualValidatorInterface::getViolations()} method. + * + * @return ContextualValidatorInterface The validator for the new context + */ + public function startContext(); + + /** + * Returns a validator in the given execution context. + * + * The returned validator adds all generated violations to the given + * context. + * + * @param ExecutionContextInterface $context The execution context + * + * @return ContextualValidatorInterface The validator for that context + */ + public function inContext(ExecutionContextInterface $context); +} diff --git a/core/vendor/symfony/validator/ValidatorBuilder.php b/core/vendor/symfony/validator/ValidatorBuilder.php new file mode 100644 index 0000000..dd772cf --- /dev/null +++ b/core/vendor/symfony/validator/ValidatorBuilder.php @@ -0,0 +1,387 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +use Doctrine\Common\Annotations\AnnotationReader; +use Doctrine\Common\Annotations\CachedReader; +use Doctrine\Common\Annotations\Reader; +use Doctrine\Common\Cache\ArrayCache; +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; +use Symfony\Component\Translation\IdentityTranslator; +use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Component\Validator\Context\ExecutionContextFactory; +use Symfony\Component\Validator\Exception\InvalidArgumentException; +use Symfony\Component\Validator\Exception\ValidatorException; +use Symfony\Component\Validator\Mapping\Cache\CacheInterface; +use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory; +use Symfony\Component\Validator\Mapping\Loader\AnnotationLoader; +use Symfony\Component\Validator\Mapping\Loader\LoaderChain; +use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader; +use Symfony\Component\Validator\Mapping\Loader\XmlFileLoader; +use Symfony\Component\Validator\Mapping\Loader\XmlFilesLoader; +use Symfony\Component\Validator\Mapping\Loader\YamlFileLoader; +use Symfony\Component\Validator\Mapping\Loader\YamlFilesLoader; +use Symfony\Component\Validator\Validator\RecursiveValidator; + +/** + * The default implementation of {@link ValidatorBuilderInterface}. + * + * @author Bernhard Schussek + */ +class ValidatorBuilder implements ValidatorBuilderInterface +{ + /** + * @var array + */ + private $initializers = array(); + + /** + * @var array + */ + private $xmlMappings = array(); + + /** + * @var array + */ + private $yamlMappings = array(); + + /** + * @var array + */ + private $methodMappings = array(); + + /** + * @var Reader|null + */ + private $annotationReader; + + /** + * @var MetadataFactoryInterface|null + */ + private $metadataFactory; + + /** + * @var ConstraintValidatorFactoryInterface|null + */ + private $validatorFactory; + + /** + * @var CacheInterface|null + */ + private $metadataCache; + + /** + * @var TranslatorInterface|null + */ + private $translator; + + /** + * @var null|string + */ + private $translationDomain; + + /** + * @var PropertyAccessorInterface|null + */ + private $propertyAccessor; + + /** + * {@inheritdoc} + */ + public function addObjectInitializer(ObjectInitializerInterface $initializer) + { + $this->initializers[] = $initializer; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addObjectInitializers(array $initializers) + { + $this->initializers = array_merge($this->initializers, $initializers); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addXmlMapping($path) + { + if (null !== $this->metadataFactory) { + throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); + } + + $this->xmlMappings[] = $path; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addXmlMappings(array $paths) + { + if (null !== $this->metadataFactory) { + throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); + } + + $this->xmlMappings = array_merge($this->xmlMappings, $paths); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addYamlMapping($path) + { + if (null !== $this->metadataFactory) { + throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); + } + + $this->yamlMappings[] = $path; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addYamlMappings(array $paths) + { + if (null !== $this->metadataFactory) { + throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); + } + + $this->yamlMappings = array_merge($this->yamlMappings, $paths); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addMethodMapping($methodName) + { + if (null !== $this->metadataFactory) { + throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); + } + + $this->methodMappings[] = $methodName; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addMethodMappings(array $methodNames) + { + if (null !== $this->metadataFactory) { + throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); + } + + $this->methodMappings = array_merge($this->methodMappings, $methodNames); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function enableAnnotationMapping(Reader $annotationReader = null) + { + if (null !== $this->metadataFactory) { + throw new ValidatorException('You cannot enable annotation mapping after setting a custom metadata factory. Configure your metadata factory instead.'); + } + + if (null === $annotationReader) { + if (!class_exists('Doctrine\Common\Annotations\AnnotationReader') || !class_exists('Doctrine\Common\Cache\ArrayCache')) { + throw new \RuntimeException('Enabling annotation based constraint mapping requires the packages doctrine/annotations and doctrine/cache to be installed.'); + } + + $annotationReader = new CachedReader(new AnnotationReader(), new ArrayCache()); + } + + $this->annotationReader = $annotationReader; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function disableAnnotationMapping() + { + $this->annotationReader = null; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setMetadataFactory(MetadataFactoryInterface $metadataFactory) + { + if (count($this->xmlMappings) > 0 || count($this->yamlMappings) > 0 || count($this->methodMappings) > 0 || null !== $this->annotationReader) { + throw new ValidatorException('You cannot set a custom metadata factory after adding custom mappings. You should do either of both.'); + } + + $this->metadataFactory = $metadataFactory; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setMetadataCache(CacheInterface $cache) + { + if (null !== $this->metadataFactory) { + throw new ValidatorException('You cannot set a custom metadata cache after setting a custom metadata factory. Configure your metadata factory instead.'); + } + + $this->metadataCache = $cache; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory) + { + if (null !== $this->propertyAccessor) { + throw new ValidatorException('You cannot set a validator factory after setting a custom property accessor. Remove the call to setPropertyAccessor() if you want to call setConstraintValidatorFactory().'); + } + + $this->validatorFactory = $validatorFactory; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setTranslator(TranslatorInterface $translator) + { + $this->translator = $translator; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setTranslationDomain($translationDomain) + { + $this->translationDomain = $translationDomain; + + return $this; + } + + /** + * {@inheritdoc} + * + * @deprecated since version 2.5, to be removed in 3.0. + * The validator will function without a property accessor. + */ + public function setPropertyAccessor(PropertyAccessorInterface $propertyAccessor) + { + trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. The validator will function without a property accessor.', E_USER_DEPRECATED); + + if (null !== $this->validatorFactory) { + throw new ValidatorException('You cannot set a property accessor after setting a custom validator factory. Configure your validator factory instead.'); + } + + $this->propertyAccessor = $propertyAccessor; + + return $this; + } + + /** + * {@inheritdoc} + * + * @deprecated since version 2.7, to be removed in 3.0. + */ + public function setApiVersion($apiVersion) + { + trigger_error('The '.__METHOD__.' method is deprecated in version 2.7 and will be removed in version 3.0.', E_USER_DEPRECATED); + + if (!in_array($apiVersion, array(Validation::API_VERSION_2_4, Validation::API_VERSION_2_5, Validation::API_VERSION_2_5_BC))) { + throw new InvalidArgumentException(sprintf('The requested API version is invalid: "%s"', $apiVersion)); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getValidator() + { + $metadataFactory = $this->metadataFactory; + + if (!$metadataFactory) { + $loaders = array(); + + if (count($this->xmlMappings) > 1) { + $loaders[] = new XmlFilesLoader($this->xmlMappings); + } elseif (1 === count($this->xmlMappings)) { + $loaders[] = new XmlFileLoader($this->xmlMappings[0]); + } + + if (count($this->yamlMappings) > 1) { + $loaders[] = new YamlFilesLoader($this->yamlMappings); + } elseif (1 === count($this->yamlMappings)) { + $loaders[] = new YamlFileLoader($this->yamlMappings[0]); + } + + foreach ($this->methodMappings as $methodName) { + $loaders[] = new StaticMethodLoader($methodName); + } + + if ($this->annotationReader) { + $loaders[] = new AnnotationLoader($this->annotationReader); + } + + $loader = null; + + if (count($loaders) > 1) { + $loader = new LoaderChain($loaders); + } elseif (1 === count($loaders)) { + $loader = $loaders[0]; + } + + $metadataFactory = new LazyLoadingMetadataFactory($loader, $this->metadataCache); + } + + $validatorFactory = $this->validatorFactory ?: new ConstraintValidatorFactory($this->propertyAccessor); + $translator = $this->translator; + + if (null === $translator) { + $translator = new IdentityTranslator(); + // Force the locale to be 'en' when no translator is provided rather than relying on the Intl default locale + // This avoids depending on Intl or the stub implementation being available. It also ensures that Symfony + // validation messages are pluralized properly even when the default locale gets changed because they are in + // English. + $translator->setLocale('en'); + } + + $contextFactory = new ExecutionContextFactory($translator, $this->translationDomain); + + return new RecursiveValidator($contextFactory, $metadataFactory, $validatorFactory, $this->initializers); + } +} diff --git a/core/vendor/symfony/validator/ValidatorBuilderInterface.php b/core/vendor/symfony/validator/ValidatorBuilderInterface.php new file mode 100644 index 0000000..cc00077 --- /dev/null +++ b/core/vendor/symfony/validator/ValidatorBuilderInterface.php @@ -0,0 +1,194 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +use Doctrine\Common\Annotations\Reader; +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; +use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Component\Validator\Mapping\Cache\CacheInterface; + +/** + * A configurable builder for ValidatorInterface objects. + * + * @author Bernhard Schussek + */ +interface ValidatorBuilderInterface +{ + /** + * Adds an object initializer to the validator. + * + * @param ObjectInitializerInterface $initializer The initializer + * + * @return ValidatorBuilderInterface The builder object + */ + public function addObjectInitializer(ObjectInitializerInterface $initializer); + + /** + * Adds a list of object initializers to the validator. + * + * @param array $initializers The initializer + * + * @return ValidatorBuilderInterface The builder object + */ + public function addObjectInitializers(array $initializers); + + /** + * Adds an XML constraint mapping file to the validator. + * + * @param string $path The path to the mapping file + * + * @return ValidatorBuilderInterface The builder object + */ + public function addXmlMapping($path); + + /** + * Adds a list of XML constraint mapping files to the validator. + * + * @param array $paths The paths to the mapping files + * + * @return ValidatorBuilderInterface The builder object + */ + public function addXmlMappings(array $paths); + + /** + * Adds a YAML constraint mapping file to the validator. + * + * @param string $path The path to the mapping file + * + * @return ValidatorBuilderInterface The builder object + */ + public function addYamlMapping($path); + + /** + * Adds a list of YAML constraint mappings file to the validator. + * + * @param array $paths The paths to the mapping files + * + * @return ValidatorBuilderInterface The builder object + */ + public function addYamlMappings(array $paths); + + /** + * Enables constraint mapping using the given static method. + * + * @param string $methodName The name of the method + * + * @return ValidatorBuilderInterface The builder object + */ + public function addMethodMapping($methodName); + + /** + * Enables constraint mapping using the given static methods. + * + * @param array $methodNames The names of the methods + * + * @return ValidatorBuilderInterface The builder object + */ + public function addMethodMappings(array $methodNames); + + /** + * Enables annotation based constraint mapping. + * + * @param Reader $annotationReader The annotation reader to be used + * + * @return ValidatorBuilderInterface The builder object + */ + public function enableAnnotationMapping(Reader $annotationReader = null); + + /** + * Disables annotation based constraint mapping. + * + * @return ValidatorBuilderInterface The builder object + */ + public function disableAnnotationMapping(); + + /** + * Sets the class metadata factory used by the validator. + * + * @param MetadataFactoryInterface $metadataFactory The metadata factory + * + * @return ValidatorBuilderInterface The builder object + */ + public function setMetadataFactory(MetadataFactoryInterface $metadataFactory); + + /** + * Sets the cache for caching class metadata. + * + * @param CacheInterface $cache The cache instance + * + * @return ValidatorBuilderInterface The builder object + */ + public function setMetadataCache(CacheInterface $cache); + + /** + * Sets the constraint validator factory used by the validator. + * + * @param ConstraintValidatorFactoryInterface $validatorFactory The validator factory + * + * @return ValidatorBuilderInterface The builder object + */ + public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory); + + /** + * Sets the translator used for translating violation messages. + * + * @param TranslatorInterface $translator The translator instance + * + * @return ValidatorBuilderInterface The builder object + */ + public function setTranslator(TranslatorInterface $translator); + + /** + * Sets the default translation domain of violation messages. + * + * The same message can have different translations in different domains. + * Pass the domain that is used for violation messages by default to this + * method. + * + * @param string $translationDomain The translation domain of the violation messages + * + * @return ValidatorBuilderInterface The builder object + */ + public function setTranslationDomain($translationDomain); + + /** + * Sets the property accessor for resolving property paths. + * + * @param PropertyAccessorInterface $propertyAccessor The property accessor + * + * @return ValidatorBuilderInterface The builder object + * + * @deprecated since version 2.5, to be removed in 3.0. + */ + public function setPropertyAccessor(PropertyAccessorInterface $propertyAccessor); + + /** + * Sets the API version that the returned validator should support. + * + * @param int $apiVersion The required API version + * + * @return ValidatorBuilderInterface The builder object + * + * @see Validation::API_VERSION_2_5 + * @see Validation::API_VERSION_2_5_BC + * + * @deprecated since version 2.7, to be removed in 3.0. + */ + public function setApiVersion($apiVersion); + + /** + * Builds and returns a new validator object. + * + * @return ValidatorInterface The built validator. + */ + public function getValidator(); +} diff --git a/core/vendor/symfony/validator/ValidatorInterface.php b/core/vendor/symfony/validator/ValidatorInterface.php new file mode 100644 index 0000000..9da5d38 --- /dev/null +++ b/core/vendor/symfony/validator/ValidatorInterface.php @@ -0,0 +1,115 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * Validates values and graphs of objects and arrays. + * + * @author Bernhard Schussek + * + * @api + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link \Symfony\Component\Validator\ValidatorInterface} instead. + */ +interface ValidatorInterface +{ + /** + * Validates a value. + * + * The accepted values depend on the {@link MetadataFactoryInterface} + * implementation. + * + * The signature changed with Symfony 2.5 (see + * {@link Validator\ValidatorInterface::validate()}. This signature will be + * disabled in Symfony 3.0. + * + * @param mixed $value The value to validate + * @param array|null $groups The validation groups to validate. + * @param bool $traverse Whether to traverse the value if it is traversable. + * @param bool $deep Whether to traverse nested traversable values recursively. + * + * @return ConstraintViolationListInterface A list of constraint violations. If the + * list is empty, validation succeeded. + * + * @api + */ + public function validate($value, $groups = null, $traverse = false, $deep = false); + + /** + * Validates a property of a value against its current value. + * + * The accepted values depend on the {@link MetadataFactoryInterface} + * implementation. + * + * @param mixed $containingValue The value containing the property. + * @param string $property The name of the property to validate. + * @param array|null $groups The validation groups to validate. + * + * @return ConstraintViolationListInterface A list of constraint violations. If the + * list is empty, validation succeeded. + * + * @api + */ + public function validateProperty($containingValue, $property, $groups = null); + + /** + * Validate a property of a value against a potential value. + * + * The accepted values depend on the {@link MetadataFactoryInterface} + * implementation. + * + * @param mixed $containingValue The value containing the property. + * @param string $property The name of the property to validate + * @param string $value The value to validate against the + * constraints of the property. + * @param array|null $groups The validation groups to validate. + * + * @return ConstraintViolationListInterface A list of constraint violations. If the + * list is empty, validation succeeded. + * + * @api + */ + public function validatePropertyValue($containingValue, $property, $value, $groups = null); + + /** + * Validates a value against a constraint or a list of constraints. + * + * @param mixed $value The value to validate. + * @param Constraint|Constraint[] $constraints The constraint(s) to validate against. + * @param array|null $groups The validation groups to validate. + * + * @return ConstraintViolationListInterface A list of constraint violations. If the + * list is empty, validation succeeded. + * + * @api + * + * @deprecated since version 2.5, to be removed in 3.0. + * Renamed to {@link Validator\ValidatorInterface::validate()} + * in Symfony 2.5. + */ + public function validateValue($value, $constraints, $groups = null); + + /** + * Returns the factory for metadata instances. + * + * @return MetadataFactoryInterface The metadata factory. + * + * @api + * + * @deprecated since version 2.5, to be removed in 3.0. + * Use {@link Validator\ValidatorInterface::getMetadataFor()} or + * {@link Validator\ValidatorInterface::hasMetadataFor()} + * instead. + */ + public function getMetadataFactory(); +} diff --git a/core/vendor/symfony/validator/Violation/ConstraintViolationBuilder.php b/core/vendor/symfony/validator/Violation/ConstraintViolationBuilder.php new file mode 100644 index 0000000..b752c39 --- /dev/null +++ b/core/vendor/symfony/validator/Violation/ConstraintViolationBuilder.php @@ -0,0 +1,225 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Violation; + +use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintViolation; +use Symfony\Component\Validator\ConstraintViolationList; +use Symfony\Component\Validator\Util\PropertyPath; + +/** + * Default implementation of {@link ConstraintViolationBuilderInterface}. + * + * @since 2.5 + * @author Bernhard Schussek + * + * @internal You should not instantiate or use this class. Code against + * {@link ConstraintViolationBuilderInterface} instead. + */ +class ConstraintViolationBuilder implements ConstraintViolationBuilderInterface +{ + /** + * @var ConstraintViolationList + */ + private $violations; + + /** + * @var string + */ + private $message; + + /** + * @var array + */ + private $parameters; + + /** + * @var mixed + */ + private $root; + + /** + * @var mixed + */ + private $invalidValue; + + /** + * @var string + */ + private $propertyPath; + + /** + * @var TranslatorInterface + */ + private $translator; + + /** + * @var string|null + */ + private $translationDomain; + + /** + * @var int|null + */ + private $plural; + + /** + * @var Constraint + */ + private $constraint; + + /** + * @var mixed + */ + private $code; + + /** + * @var mixed + */ + private $cause; + + public function __construct(ConstraintViolationList $violations, Constraint $constraint, $message, array $parameters, $root, $propertyPath, $invalidValue, TranslatorInterface $translator, $translationDomain = null) + { + $this->violations = $violations; + $this->message = $message; + $this->parameters = $parameters; + $this->root = $root; + $this->propertyPath = $propertyPath; + $this->invalidValue = $invalidValue; + $this->translator = $translator; + $this->translationDomain = $translationDomain; + $this->constraint = $constraint; + } + + /** + * {@inheritdoc} + */ + public function atPath($path) + { + $this->propertyPath = PropertyPath::append($this->propertyPath, $path); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setParameter($key, $value) + { + $this->parameters[$key] = $value; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setParameters(array $parameters) + { + $this->parameters = $parameters; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setTranslationDomain($translationDomain) + { + $this->translationDomain = $translationDomain; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setInvalidValue($invalidValue) + { + $this->invalidValue = $invalidValue; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setPlural($number) + { + $this->plural = $number; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setCode($code) + { + $this->code = $code; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setCause($cause) + { + $this->cause = $cause; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addViolation() + { + if (null === $this->plural) { + $translatedMessage = $this->translator->trans( + $this->message, + $this->parameters, + $this->translationDomain + ); + } else { + try { + $translatedMessage = $this->translator->transChoice( + $this->message, + $this->plural, + $this->parameters, + $this->translationDomain# + ); + } catch (\InvalidArgumentException $e) { + $translatedMessage = $this->translator->trans( + $this->message, + $this->parameters, + $this->translationDomain + ); + } + } + + $this->violations->add(new ConstraintViolation( + $translatedMessage, + $this->message, + $this->parameters, + $this->root, + $this->propertyPath, + $this->invalidValue, + $this->plural, + $this->code, + $this->constraint, + $this->cause + )); + } +} diff --git a/core/vendor/symfony/validator/Violation/ConstraintViolationBuilderInterface.php b/core/vendor/symfony/validator/Violation/ConstraintViolationBuilderInterface.php new file mode 100644 index 0000000..3dc270a --- /dev/null +++ b/core/vendor/symfony/validator/Violation/ConstraintViolationBuilderInterface.php @@ -0,0 +1,115 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Violation; + +/** + * Builds {@link \Symfony\Component\Validator\ConstraintViolationInterface} + * objects. + * + * Use the various methods on this interface to configure the built violation. + * Finally, call {@link addViolation()} to add the violation to the current + * execution context. + * + * @since 2.5 + * @author Bernhard Schussek + */ +interface ConstraintViolationBuilderInterface +{ + /** + * Stores the property path at which the violation should be generated. + * + * The passed path will be appended to the current property path of the + * execution context. + * + * @param string $path The property path + * + * @return ConstraintViolationBuilderInterface This builder + */ + public function atPath($path); + + /** + * Sets a parameter to be inserted into the violation message. + * + * @param string $key The name of the parameter + * @param string $value The value to be inserted in the parameter's place + * + * @return ConstraintViolationBuilderInterface This builder + */ + public function setParameter($key, $value); + + /** + * Sets all parameters to be inserted into the violation message. + * + * @param array $parameters An array with the parameter names as keys and + * the values to be inserted in their place as + * values + * + * @return ConstraintViolationBuilderInterface This builder + */ + public function setParameters(array $parameters); + + /** + * Sets the translation domain which should be used for translating the + * violation message. + * + * @param string $translationDomain The translation domain + * + * @return ConstraintViolationBuilderInterface This builder + * + * @see \Symfony\Component\Translation\TranslatorInterface + */ + public function setTranslationDomain($translationDomain); + + /** + * Sets the invalid value that caused this violation. + * + * @param mixed $invalidValue The invalid value + * + * @return ConstraintViolationBuilderInterface This builder + */ + public function setInvalidValue($invalidValue); + + /** + * Sets the number which determines how the plural form of the violation + * message is chosen when it is translated. + * + * @param int $number The number for determining the plural form + * + * @return ConstraintViolationBuilderInterface This builder + * + * @see \Symfony\Component\Translation\TranslatorInterface::transChoice() + */ + public function setPlural($number); + + /** + * Sets the violation code. + * + * @param int $code The violation code + * + * @return ConstraintViolationBuilderInterface This builder + */ + public function setCode($code); + + /** + * Sets the cause of the violation. + * + * @param mixed $cause The cause of the violation + * + * @return ConstraintViolationBuilderInterface This builder + */ + public function setCause($cause); + + /** + * Adds the violation to the current execution context. + */ + public function addViolation(); +} diff --git a/core/vendor/symfony/validator/Violation/LegacyConstraintViolationBuilder.php b/core/vendor/symfony/validator/Violation/LegacyConstraintViolationBuilder.php new file mode 100644 index 0000000..0ce6da9 --- /dev/null +++ b/core/vendor/symfony/validator/Violation/LegacyConstraintViolationBuilder.php @@ -0,0 +1,166 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Violation; + +trigger_error('The '.__NAMESPACE__.'\LegacyConstraintViolationBuilder class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); + +use Symfony\Component\Validator\ExecutionContextInterface; + +/** + * Backwards-compatible implementation of {@link ConstraintViolationBuilderInterface}. + * + * @author Bernhard Schussek + * + * @internal You should not instantiate or use this class. Code against + * {@link ConstraintViolationBuilderInterface} instead. + * + * @deprecated since version 2.5.5, to be removed in 3.0. + */ +class LegacyConstraintViolationBuilder implements ConstraintViolationBuilderInterface +{ + /** + * @var ExecutionContextInterface + */ + private $context; + + /** + * @var string + */ + private $message; + + /** + * @var array + */ + private $parameters; + + /** + * @var mixed + */ + private $invalidValue; + + /** + * @var string + */ + private $propertyPath; + + /** + * @var int|null + */ + private $plural; + + /** + * @var mixed + */ + private $code; + + public function __construct(ExecutionContextInterface $context, $message, array $parameters) + { + $this->context = $context; + $this->message = $message; + $this->parameters = $parameters; + $this->invalidValue = $context->getValue(); + } + + /** + * {@inheritdoc} + */ + public function atPath($path) + { + $this->propertyPath = $path; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setParameter($key, $value) + { + $this->parameters[$key] = $value; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setParameters(array $parameters) + { + $this->parameters = $parameters; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setTranslationDomain($translationDomain) + { + // can't be set in the old API + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setInvalidValue($invalidValue) + { + $this->invalidValue = $invalidValue; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setPlural($number) + { + $this->plural = $number; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setCode($code) + { + $this->code = $code; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setCause($cause) + { + // do nothing - we can't save the cause through the old API + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addViolation() + { + if ($this->propertyPath) { + $this->context->addViolationAt($this->propertyPath, $this->message, $this->parameters, $this->invalidValue, $this->plural, $this->code); + + return; + } + + $this->context->addViolation($this->message, $this->parameters, $this->invalidValue, $this->plural, $this->code); + } +} diff --git a/core/vendor/symfony/validator/composer.json b/core/vendor/symfony/validator/composer.json new file mode 100644 index 0000000..3dbfef2 --- /dev/null +++ b/core/vendor/symfony/validator/composer.json @@ -0,0 +1,54 @@ +{ + "name": "symfony/validator", + "type": "library", + "description": "Symfony Validator Component", + "keywords": [], + "homepage": "http://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "require": { + "php": ">=5.3.9", + "symfony/translation": "~2.4" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7", + "symfony/http-foundation": "~2.1", + "symfony/intl": "~2.3", + "symfony/yaml": "~2.0,>=2.0.5", + "symfony/config": "~2.2", + "symfony/property-access": "~2.3", + "symfony/expression-language": "~2.4", + "doctrine/annotations": "~1.0", + "doctrine/cache": "~1.0", + "egulias/email-validator": "~1.2,>=1.2.1" + }, + "suggest": { + "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", + "doctrine/cache": "For using the default cached annotation reader and metadata cache.", + "symfony/http-foundation": "", + "symfony/intl": "", + "symfony/yaml": "", + "symfony/config": "", + "egulias/email-validator": "Strict (RFC compliant) email validation", + "symfony/property-access": "For using the 2.4 Validator API", + "symfony/expression-language": "For using the 2.4 Expression validator" + }, + "autoload": { + "psr-4": { "Symfony\\Component\\Validator\\": "" } + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + } +} diff --git a/core/vendor/symfony/validator/phpunit.xml.dist b/core/vendor/symfony/validator/phpunit.xml.dist new file mode 100644 index 0000000..1bf4391 --- /dev/null +++ b/core/vendor/symfony/validator/phpunit.xml.dist @@ -0,0 +1,28 @@ + + + + + + + + + + ./Tests/ + + + + + + ./ + + ./vendor + ./Tests + + + +