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 https://nette.org
  12. 12:  *
  13. 13:  * @copyright  Copyright (c) 2004, 2009 David Grudl
  14. 14:  * @license    https://nette.org/license  Nette license
  15. 15:  * @link       https://nette.org
  16. 16:  * @category   Nette
  17. 17:  * @package    Nette\Forms
  18. 18:  * @version    $Id$
  19. 19:  */
  20. 20:  
  21. 21:  
  22. 22:  
  23. 23: require_once dirname(__FILE__'/../Object.php';
  24. 24:  
  25. 25:  
  26. 26:  
  27. 27: /**
  28. 28:  * Single validation rule or condition represented as value object.
  29. 29:  *
  30. 30:  * @author     David Grudl
  31. 31:  * @copyright  Copyright (c) 2004, 2009 David Grudl
  32. 32:  * @package    Nette\Forms
  33. 33:  */
  34. 34: final class Rule extends Object
  35. 35: {
  36. 36:     /** type */
  37. 37:     const CONDITION = 1;
  38. 38:  
  39. 39:     /** type */
  40. 40:     const VALIDATOR = 2;
  41. 41:  
  42. 42:     /** type */
  43. 43:     const FILTER = 3;
  44. 44:  
  45. 45:     /** type */
  46. 46:     const TERMINATOR = 4;
  47. 47:  
  48. 48:     /** @var IFormControl */
  49. 49:     public $control;
  50. 50:  
  51. 51:     /** @var mixed */
  52. 52:     public $operation;
  53. 53:  
  54. 54:     /** @var mixed */
  55. 55:     public $arg;
  56. 56:  
  57. 57:     /** @var int (CONDITION, VALIDATOR, FILTER) */
  58. 58:     public $type;
  59. 59:  
  60. 60:     /** @var bool */
  61. 61:     public $isNegative = FALSE;
  62. 62:  
  63. 63:     /** @var string (only for VALIDATOR type) */
  64. 64:     public $message;
  65. 65:  
  66. 66:     /** @var bool (only for VALIDATOR type) */
  67. 67:     public $breakOnFailure = TRUE;
  68. 68:  
  69. 69:     /** @var Rules (only for CONDITION type)  */
  70. 70:     public $subRules;
  71. 71:  
  72. 72: }