* @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id: Rule.php,v 1.4 2009/04/04 21:34:02 avb Exp $ * @link http://pear.php.net/package/HTML_QuickForm */ /** * Abstract base class for QuickForm validation rules * * @category HTML * @package HTML_QuickForm * @author Bertrand Mansion * @version Release: 3.2.11 * @since 3.2 * @abstract */ class HTML_QuickForm_Rule { /** * Name of the rule to use in validate method * * This property is used in more global rules like Callback and Regex * to determine which callback and which regex is to be used for validation * * @var string * @access public */ public $name; /** * Validates a value * * @access public * @abstract */ public function validate($value, $options) { return true; } /** * Sets the rule name * * @param string rule name * @access public */ public function setName($ruleName) { $this->name = $ruleName; } /** * Returns the javascript test (the test should return true if the value is INVALID) * * @param mixed Options for the rule * @access public * @return array first element is code to setup validation, second is the check itself * @abstract */ function getValidationScript($options = null) { return array('', ''); } }