Source for file Rule.php

Documentation is available at Rule.php

  1. 1: <?php
  2. 2:  
  3. 3: /**
  4. 4:  * Nette Framework
  5. 5:  *
  6. 6:  * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
  7. 7:  *
  8. 8:  * This source file is subject to the "Nette license" that is bundled
  9. 9:  * with this package in the file license.txt.
  10. 10:  *
  11. 11:  * For more information please see http://nettephp.com
  12. 12:  *
  13. 13:  * @copyright  Copyright (c) 2004, 2009 David Grudl
  14. 14:  * @license    http://nettephp.com/license  Nette license
  15. 15:  * @link       http://nettephp.com
  16. 16:  * @category   Nette
  17. 17:  * @package    Nette\Forms
  18. 18:  */
  19. 19:  
  20. 20:  
  21. 21:  
  22. 22: require_once dirname(__FILE__'/../Object.php';
  23. 23:  
  24. 24:  
  25. 25:  
  26. 26: /**
  27. 27:  * Single validation rule or condition represented as value object.
  28. 28:  *
  29. 29:  * @author     David Grudl
  30. 30:  * @copyright  Copyright (c) 2004, 2009 David Grudl
  31. 31:  * @package    Nette\Forms
  32. 32:  */
  33. 33: final class Rule extends Object
  34. 34: {
  35. 35:     /** type */
  36. 36:     const CONDITION = 1;
  37. 37:  
  38. 38:     /** type */
  39. 39:     const VALIDATOR = 2;
  40. 40:  
  41. 41:     /** type */
  42. 42:     const FILTER = 3;
  43. 43:  
  44. 44:     /** type */
  45. 45:     const TERMINATOR = 4;
  46. 46:  
  47. 47:     /** @var IFormControl */
  48. 48:     public $control;
  49. 49:  
  50. 50:     /** @var mixed */
  51. 51:     public $operation;
  52. 52:  
  53. 53:     /** @var mixed */
  54. 54:     public $arg;
  55. 55:  
  56. 56:     /** @var int (CONDITION, VALIDATOR, FILTER) */
  57. 57:     public $type;
  58. 58:  
  59. 59:     /** @var bool */
  60. 60:     public $isNegative = FALSE;
  61. 61:  
  62. 62:     /** @var string (only for VALIDATOR type) */
  63. 63:     public $message;
  64. 64:  
  65. 65:     /** @var bool (only for VALIDATOR type) */
  66. 66:     public $breakOnFailure = TRUE;
  67. 67:  
  68. 68:     /** @var Rules (only for CONDITION type)  */
  69. 69:     public $subRules;
  70. 70:  
  71. 71: }