BlackHoleMetadataFactory.php 979 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. use Symfony\Component\Validator\Exception\LogicException;
  12. /**
  13. * Metadata factory that does not store metadata.
  14. *
  15. * This implementation is useful if you want to validate values against
  16. * constraints only and you don't need to add constraints to classes and
  17. * properties.
  18. *
  19. * @author Fabien Potencier <fabien@symfony.com>
  20. */
  21. class BlackHoleMetadataFactory implements MetadataFactoryInterface
  22. {
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public function getMetadataFor($value)
  27. {
  28. throw new LogicException('This class does not support metadata.');
  29. }
  30. /**
  31. * {@inheritdoc}
  32. */
  33. public function hasMetadataFor($value)
  34. {
  35. return false;
  36. }
  37. }