Validation.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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;
  11. /**
  12. * Entry point for the Validator component.
  13. *
  14. * @author Bernhard Schussek <bschussek@gmail.com>
  15. */
  16. final class Validation
  17. {
  18. /**
  19. * The Validator API provided by Symfony 2.4 and older.
  20. *
  21. * @deprecated use API_VERSION_2_5_BC instead.
  22. */
  23. const API_VERSION_2_4 = 1;
  24. /**
  25. * The Validator API provided by Symfony 2.5 and newer.
  26. */
  27. const API_VERSION_2_5 = 2;
  28. /**
  29. * The Validator API provided by Symfony 2.5 and newer with a backwards
  30. * compatibility layer for 2.4 and older.
  31. */
  32. const API_VERSION_2_5_BC = 3;
  33. /**
  34. * Creates a new validator.
  35. *
  36. * If you want to configure the validator, use
  37. * {@link createValidatorBuilder()} instead.
  38. *
  39. * @return ValidatorInterface The new validator
  40. */
  41. public static function createValidator()
  42. {
  43. return self::createValidatorBuilder()->getValidator();
  44. }
  45. /**
  46. * Creates a configurable builder for validator objects.
  47. *
  48. * @return ValidatorBuilderInterface The new builder
  49. */
  50. public static function createValidatorBuilder()
  51. {
  52. return new ValidatorBuilder();
  53. }
  54. /**
  55. * This class cannot be instantiated.
  56. */
  57. private function __construct()
  58. {
  59. }
  60. }