Validation.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. }