BlackHoleMetadataFactory.php 921 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Validator\Mapping\Factory;
  11. /**
  12. * Metadata factory that does not store metadata.
  13. *
  14. * This implementation is useful if you want to validate values against
  15. * constraints only and you don't need to add constraints to classes and
  16. * properties.
  17. *
  18. * @author Fabien Potencier <fabien@symfony.com>
  19. */
  20. class BlackHoleMetadataFactory implements MetadataFactoryInterface
  21. {
  22. /**
  23. * {@inheritdoc}
  24. */
  25. public function getMetadataFor($value)
  26. {
  27. throw new \LogicException('This class does not support metadata.');
  28. }
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public function hasMetadataFor($value)
  33. {
  34. return false;
  35. }
  36. }