ValidatorAwareInterface.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * For full copyright and license information, please see the LICENSE.txt
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  11. * @link http://cakephp.org CakePHP(tm) Project
  12. * @since 3.5.0
  13. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace Cake\Validation;
  16. /**
  17. * Provides methods for managing multiple validators.
  18. */
  19. interface ValidatorAwareInterface
  20. {
  21. /**
  22. * Name of default validation set.
  23. *
  24. * @var string
  25. */
  26. const DEFAULT_VALIDATOR = 'default';
  27. /**
  28. * Returns the validation rules tagged with $name.
  29. *
  30. * If a $name argument has not been provided, the default validator will be returned.
  31. * You can configure your default validator name in a `DEFAULT_VALIDATOR`
  32. * class constant.
  33. *
  34. * @param string|null $name The name of the validation set to return.
  35. * @return \Cake\Validation\Validator
  36. */
  37. public function getValidator($name = null);
  38. /**
  39. * This method stores a custom validator under the given name.
  40. *
  41. * @param string $name The name of a validator to be set.
  42. * @param \Cake\Validation\Validator $validator Validator object to be set.
  43. * @return $this
  44. */
  45. public function setValidator($name, Validator $validator);
  46. /**
  47. * Checks whether or not a validator has been set.
  48. *
  49. * @param string $name The name of a validator.
  50. * @return bool
  51. */
  52. public function hasValidator($name);
  53. }