Move into nested docroot
This commit is contained in:
parent
83a0d3a149
commit
c8b70abde9
13405 changed files with 0 additions and 0 deletions
web/vendor/symfony/validator/Mapping
BlackholeMetadataFactory.php
Cache
CascadingStrategy.phpClassMetadata.phpClassMetadataFactory.phpClassMetadataInterface.phpElementMetadata.phpFactory
GenericMetadata.phpGetterMetadata.phpLoader
AbstractLoader.phpAnnotationLoader.phpFileLoader.phpFilesLoader.phpLoaderChain.phpLoaderInterface.phpStaticMethodLoader.phpXmlFileLoader.phpXmlFilesLoader.phpYamlFileLoader.phpYamlFilesLoader.php
MemberMetadata.phpMetadataInterface.phpPropertyMetadata.phpPropertyMetadataInterface.phpTraversalStrategy.phpschema/dic/constraint-mapping
28
web/vendor/symfony/validator/Mapping/BlackholeMetadataFactory.php
vendored
Normal file
28
web/vendor/symfony/validator/Mapping/BlackholeMetadataFactory.php
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <fabien@symfony.com>
|
||||
*
|
||||
* @deprecated since version 2.5, to be removed in 3.0.
|
||||
* Use {@link Factory\BlackHoleMetadataFactory} instead.
|
||||
*/
|
||||
class BlackholeMetadataFactory extends MappingBlackHoleMetadataFactory
|
||||
{
|
||||
}
|
57
web/vendor/symfony/validator/Mapping/Cache/ApcCache.php
vendored
Normal file
57
web/vendor/symfony/validator/Mapping/Cache/ApcCache.php
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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);
|
||||
}
|
||||
}
|
45
web/vendor/symfony/validator/Mapping/Cache/CacheInterface.php
vendored
Normal file
45
web/vendor/symfony/validator/Mapping/Cache/CacheInterface.php
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <bschussek@gmail.com>
|
||||
*/
|
||||
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);
|
||||
}
|
69
web/vendor/symfony/validator/Mapping/Cache/DoctrineCache.php
vendored
Normal file
69
web/vendor/symfony/validator/Mapping/Cache/DoctrineCache.php
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <florian@voutzinos.com>
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
52
web/vendor/symfony/validator/Mapping/CascadingStrategy.php
vendored
Normal file
52
web/vendor/symfony/validator/Mapping/CascadingStrategy.php
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
}
|
||||
}
|
564
web/vendor/symfony/validator/Mapping/ClassMetadata.php
vendored
Normal file
564
web/vendor/symfony/validator/Mapping/ClassMetadata.php
vendored
Normal file
|
@ -0,0 +1,564 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <bschussek@gmail.com>
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
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
|
||||
* "<ClassName>", where <ClassName> 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 "<ClassName>".
|
||||
*
|
||||
* @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 $this
|
||||
*/
|
||||
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 $this
|
||||
*/
|
||||
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 $this
|
||||
*/
|
||||
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 $this
|
||||
*/
|
||||
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) {
|
||||
if ($this->hasPropertyMetadata($property)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($source->getPropertyMetadata($property) as $member) {
|
||||
$member = clone $member;
|
||||
|
||||
foreach ($member->getConstraints() as $constraint) {
|
||||
if (in_array($constraint::DEFAULT_GROUP, $constraint->groups, true)) {
|
||||
$member->constraintsByGroup[$this->getDefaultGroup()][] = $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 $this
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
}
|
28
web/vendor/symfony/validator/Mapping/ClassMetadataFactory.php
vendored
Normal file
28
web/vendor/symfony/validator/Mapping/ClassMetadataFactory.php
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated since version 2.5, to be removed in 3.0.
|
||||
* Use {@link LazyLoadingMetadataFactory} instead.
|
||||
*/
|
||||
class ClassMetadataFactory extends LazyLoadingMetadataFactory
|
||||
{
|
||||
}
|
79
web/vendor/symfony/validator/Mapping/ClassMetadataInterface.php
vendored
Normal file
79
web/vendor/symfony/validator/Mapping/ClassMetadataInterface.php
vendored
Normal file
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @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();
|
||||
}
|
30
web/vendor/symfony/validator/Mapping/ElementMetadata.php
vendored
Normal file
30
web/vendor/symfony/validator/Mapping/ElementMetadata.php
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <bschussek@gmail.com>
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
}
|
40
web/vendor/symfony/validator/Mapping/Factory/BlackHoleMetadataFactory.php
vendored
Normal file
40
web/vendor/symfony/validator/Mapping/Factory/BlackHoleMetadataFactory.php
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <fabien@symfony.com>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
182
web/vendor/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php
vendored
Normal file
182
web/vendor/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php
vendored
Normal file
|
@ -0,0 +1,182 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <bschussek@gmail.com>
|
||||
*/
|
||||
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 !== ($metadata = $this->cache->read($class))) {
|
||||
// Include constraints from the parent class
|
||||
$this->mergeConstraints($metadata);
|
||||
|
||||
return $this->loadedClasses[$class] = $metadata;
|
||||
}
|
||||
|
||||
if (!class_exists($class) && !interface_exists($class)) {
|
||||
throw new NoSuchMetadataException(sprintf('The class or interface "%s" does not exist.', $class));
|
||||
}
|
||||
|
||||
$metadata = new ClassMetadata($class);
|
||||
|
||||
if (null !== $this->loader) {
|
||||
$this->loader->loadClassMetadata($metadata);
|
||||
}
|
||||
|
||||
if (null !== $this->cache) {
|
||||
$this->cache->write($metadata);
|
||||
}
|
||||
|
||||
// Include constraints from the parent class
|
||||
$this->mergeConstraints($metadata);
|
||||
|
||||
return $this->loadedClasses[$class] = $metadata;
|
||||
}
|
||||
|
||||
private function mergeConstraints(ClassMetadata $metadata)
|
||||
{
|
||||
// Include constraints from the parent class
|
||||
if ($parent = $metadata->getReflectionClass()->getParentClass()) {
|
||||
$metadata->mergeConstraints($this->getMetadataFor($parent->name));
|
||||
}
|
||||
|
||||
$interfaces = $metadata->getReflectionClass()->getInterfaces();
|
||||
|
||||
$interfaces = array_filter($interfaces, function ($interface) use ($parent, $interfaces) {
|
||||
$interfaceName = $interface->getName();
|
||||
|
||||
if ($parent && $parent->implementsInterface($interfaceName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($interfaces as $i) {
|
||||
if ($i !== $interface && $i->implementsInterface($interfaceName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
// Include constraints from all directly implemented interfaces
|
||||
foreach ($interfaces as $interface) {
|
||||
if ('Symfony\Component\Validator\GroupSequenceProviderInterface' === $interface->name) {
|
||||
continue;
|
||||
}
|
||||
$metadata->mergeConstraints($this->getMetadataFor($interface->name));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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;
|
||||
}
|
||||
}
|
23
web/vendor/symfony/validator/Mapping/Factory/MetadataFactoryInterface.php
vendored
Normal file
23
web/vendor/symfony/validator/Mapping/Factory/MetadataFactoryInterface.php
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
interface MetadataFactoryInterface extends LegacyMetadataFactoryInterface
|
||||
{
|
||||
}
|
243
web/vendor/symfony/validator/Mapping/GenericMetadata.php
vendored
Normal file
243
web/vendor/symfony/validator/Mapping/GenericMetadata.php
vendored
Normal file
|
@ -0,0 +1,243 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
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 $this
|
||||
*
|
||||
* @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 $this
|
||||
*/
|
||||
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.');
|
||||
}
|
||||
}
|
77
web/vendor/symfony/validator/Mapping/GetterMetadata.php
vendored
Normal file
77
web/vendor/symfony/validator/Mapping/GetterMetadata.php
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <bschussek@gmail.com>
|
||||
*
|
||||
* @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());
|
||||
}
|
||||
}
|
91
web/vendor/symfony/validator/Mapping/Loader/AbstractLoader.php
vendored
Normal file
91
web/vendor/symfony/validator/Mapping/Loader/AbstractLoader.php
vendored
Normal file
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <bschussek@gmail.com>
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
95
web/vendor/symfony/validator/Mapping/Loader/AnnotationLoader.php
vendored
Normal file
95
web/vendor/symfony/validator/Mapping/Loader/AnnotationLoader.php
vendored
Normal file
|
@ -0,0 +1,95 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <bschussek@gmail.com>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
56
web/vendor/symfony/validator/Mapping/Loader/FileLoader.php
vendored
Normal file
56
web/vendor/symfony/validator/Mapping/Loader/FileLoader.php
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <bschussek@gmail.com>
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
}
|
61
web/vendor/symfony/validator/Mapping/Loader/FilesLoader.php
vendored
Normal file
61
web/vendor/symfony/validator/Mapping/Loader/FilesLoader.php
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <mallluhuct@gmail.com>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @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);
|
||||
}
|
62
web/vendor/symfony/validator/Mapping/Loader/LoaderChain.php
vendored
Normal file
62
web/vendor/symfony/validator/Mapping/Loader/LoaderChain.php
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <bschussek@gmail.com>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
31
web/vendor/symfony/validator/Mapping/Loader/LoaderInterface.php
vendored
Normal file
31
web/vendor/symfony/validator/Mapping/Loader/LoaderInterface.php
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <bschussek@gmail.com>
|
||||
*/
|
||||
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);
|
||||
}
|
71
web/vendor/symfony/validator/Mapping/Loader/StaticMethodLoader.php
vendored
Normal file
71
web/vendor/symfony/validator/Mapping/Loader/StaticMethodLoader.php
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <bschussek@gmail.com>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
213
web/vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php
vendored
Normal file
213
web/vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php
vendored
Normal file
|
@ -0,0 +1,213 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <bschussek@gmail.com>
|
||||
*/
|
||||
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 = XmlUtils::phpize(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);
|
||||
}
|
||||
|
||||
private function loadClassMetadataFromXml(ClassMetadata $metadata, \SimpleXMLElement $classDescription)
|
||||
{
|
||||
if (count($classDescription->{'group-sequence-provider'}) > 0) {
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
31
web/vendor/symfony/validator/Mapping/Loader/XmlFilesLoader.php
vendored
Normal file
31
web/vendor/symfony/validator/Mapping/Loader/XmlFilesLoader.php
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <mallluhuct@gmail.com>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @see FilesLoader
|
||||
*/
|
||||
class XmlFilesLoader extends FilesLoader
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFileLoaderInstance($file)
|
||||
{
|
||||
return new XmlFileLoader($file);
|
||||
}
|
||||
}
|
178
web/vendor/symfony/validator/Mapping/Loader/YamlFileLoader.php
vendored
Normal file
178
web/vendor/symfony/validator/Mapping/Loader/YamlFileLoader.php
vendored
Normal file
|
@ -0,0 +1,178 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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\Exception\ParseException;
|
||||
use Symfony\Component\Yaml\Parser as YamlParser;
|
||||
|
||||
/**
|
||||
* Loads validation metadata from a YAML file.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
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->classes = $this->parseFile($this->file);
|
||||
|
||||
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 The class descriptions
|
||||
*
|
||||
* @throws \InvalidArgumentException If the file could not be loaded or did
|
||||
* not contain a YAML array
|
||||
*/
|
||||
private function parseFile($path)
|
||||
{
|
||||
try {
|
||||
$classes = $this->yamlParser->parse(file_get_contents($path));
|
||||
} catch (ParseException $e) {
|
||||
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e);
|
||||
}
|
||||
|
||||
// empty file
|
||||
if (null === $classes) {
|
||||
return array();
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
31
web/vendor/symfony/validator/Mapping/Loader/YamlFilesLoader.php
vendored
Normal file
31
web/vendor/symfony/validator/Mapping/Loader/YamlFilesLoader.php
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <mallluhuct@gmail.com>
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @see FilesLoader
|
||||
*/
|
||||
class YamlFilesLoader extends FilesLoader
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFileLoaderInstance($file)
|
||||
{
|
||||
return new YamlFileLoader($file);
|
||||
}
|
||||
}
|
160
web/vendor/symfony/validator/Mapping/Loader/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd
vendored
Normal file
160
web/vendor/symfony/validator/Mapping/Loader/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd
vendored
Normal file
|
@ -0,0 +1,160 @@
|
|||
<?xml version="1.0" ?>
|
||||
|
||||
<xsd:schema xmlns="http://symfony.com/schema/dic/constraint-mapping"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://symfony.com/schema/dic/constraint-mapping"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Symfony Validator Constraint Mapping Schema, version 1.0
|
||||
Authors: Bernhard Schussek
|
||||
|
||||
A constraint mapping connects classes, properties and getters with
|
||||
validation constraints.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:element name="constraint-mapping" type="constraint-mapping" />
|
||||
|
||||
<xsd:complexType name="constraint-mapping">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The root element of the constraint mapping definition.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="namespace" type="namespace" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:element name="class" type="class" maxOccurs="unbounded" />
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="namespace">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Contains the abbreviation for a namespace.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="xsd:string">
|
||||
<xsd:attribute name="prefix" type="xsd:string" use="required" />
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="class">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Contains constraints for a single class.
|
||||
|
||||
Nested elements may be class constraints, property and/or getter
|
||||
definitions.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="group-sequence-provider" type="group-sequence-provider" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="group-sequence" type="group-sequence" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="constraint" type="constraint" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:element name="property" type="property" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:element name="getter" type="getter" minOccurs="0" maxOccurs="unbounded" />
|
||||
</xsd:choice>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="group-sequence">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Contains the group sequence of a class. Each group should be written
|
||||
into a "value" tag.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="value" minOccurs="1" maxOccurs="unbounded" />
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="group-sequence-provider">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Defines the name of the group sequence provider for a class.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="property">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Contains constraints for a single property. The name of the property
|
||||
should be given in the "name" option.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="constraint" type="constraint" maxOccurs="unbounded" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="getter">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Contains constraints for a getter method. The name of the corresponding
|
||||
property should be given in the "property" option.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="constraint" type="constraint" maxOccurs="unbounded" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="property" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="constraint" mixed="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Contains a constraint definition. The name of the constraint should be
|
||||
given in the "name" option.
|
||||
|
||||
May contain a single value, multiple "constraint" elements,
|
||||
multiple "value" elements or multiple "option" elements.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:choice minOccurs="0">
|
||||
<xsd:element name="constraint" type="constraint" minOccurs="1" maxOccurs="unbounded" />
|
||||
<xsd:element name="option" type="option" minOccurs="1" maxOccurs="unbounded" />
|
||||
<xsd:element name="value" type="value" minOccurs="1" maxOccurs="unbounded" />
|
||||
</xsd:choice>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="option" mixed="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Contains a constraint option definition. The name of the option
|
||||
should be given in the "name" option.
|
||||
|
||||
May contain a single value, multiple "value" elements or multiple
|
||||
"constraint" elements.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:choice minOccurs="0">
|
||||
<xsd:element name="constraint" type="constraint" minOccurs="1" maxOccurs="unbounded" />
|
||||
<xsd:element name="value" type="value" minOccurs="1" maxOccurs="unbounded" />
|
||||
</xsd:choice>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="value" mixed="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
A value of an element.
|
||||
|
||||
May contain a single value, multiple "value" elements or multiple
|
||||
"constraint" elements.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:choice minOccurs="0">
|
||||
<xsd:element name="constraint" type="constraint" minOccurs="1" maxOccurs="unbounded" />
|
||||
<xsd:element name="value" type="value" minOccurs="1" maxOccurs="unbounded" />
|
||||
</xsd:choice>
|
||||
<xsd:attribute name="key" type="xsd:string" use="optional" />
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
259
web/vendor/symfony/validator/Mapping/MemberMetadata.php
vendored
Normal file
259
web/vendor/symfony/validator/Mapping/MemberMetadata.php
vendored
Normal file
|
@ -0,0 +1,259 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <bschussek@gmail.com>
|
||||
*
|
||||
* @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);
|
||||
}
|
58
web/vendor/symfony/validator/Mapping/MetadataInterface.php
vendored
Normal file
58
web/vendor/symfony/validator/Mapping/MetadataInterface.php
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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\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.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @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();
|
||||
}
|
76
web/vendor/symfony/validator/Mapping/PropertyMetadata.php
vendored
Normal file
76
web/vendor/symfony/validator/Mapping/PropertyMetadata.php
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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 <bschussek@gmail.com>
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
$originalClass = is_string($objectOrClassName) ? $objectOrClassName : get_class($objectOrClassName);
|
||||
|
||||
while (!property_exists($objectOrClassName, $this->getName())) {
|
||||
$objectOrClassName = get_parent_class($objectOrClassName);
|
||||
|
||||
if (false === $objectOrClassName) {
|
||||
throw new ValidatorException(sprintf('Property "%s" does not exist in class "%s".', $this->getName(), $originalClass));
|
||||
}
|
||||
}
|
||||
|
||||
$member = new \ReflectionProperty($objectOrClassName, $this->getName());
|
||||
$member->setAccessible(true);
|
||||
|
||||
return $member;
|
||||
}
|
||||
}
|
35
web/vendor/symfony/validator/Mapping/PropertyMetadataInterface.php
vendored
Normal file
35
web/vendor/symfony/validator/Mapping/PropertyMetadataInterface.php
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @see MetadataInterface
|
||||
* @see CascadingStrategy
|
||||
* @see TraversalStrategy
|
||||
*/
|
||||
interface PropertyMetadataInterface extends MetadataInterface, LegacyPropertyMetadataInterface, ClassBasedInterface
|
||||
{
|
||||
}
|
65
web/vendor/symfony/validator/Mapping/TraversalStrategy.php
vendored
Normal file
65
web/vendor/symfony/validator/Mapping/TraversalStrategy.php
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @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()
|
||||
{
|
||||
}
|
||||
}
|
Reference in a new issue