Documentation is available at NonzeroLengthStringValidatorRule.class.php
- <?php
- require_once(HARMONI."utilities/FieldSetValidator/rules/StringValidatorRule.class.php");
- /**
- * the NonzeroLengthStringValidatorRule checks a given value to make sure it's string and
- * has a non-zero length
- *
- * @package harmoni.utilities.fieldsetvalidator.rules
- *
- * @copyright Copyright © 2005, Middlebury College
- * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
- *
- * @version $Id: NonzeroLengthStringValidatorRule.class.php,v 1.6 2007/09/04 20:25:55 adamfranco Exp $
- */
- class NonzeroLengthStringValidatorRule
- extends StringValidatorRule
- {
- /**
- * Checks a given value to make sure it's an string and has a non-zero length
- * @param mixed $val The value to check.
- * @access public
- * @return boolean TRUE, if the value is an string; FALSE if it is not.
- ***/
- function check( $val ) {
- return parent::check($val) && (strlen($val) > 0);
- }
- /**
- * This is a static method to return an already-created instance of a validator
- * rule. There are at most about a hundred unique rule objects in use durring
- * any given execution cycle, but rule objects are instantiated hundreds of
- * thousands of times.
- *
- * This method follows a modified Singleton pattern
- *
- * @return object ValidatorRule
- * @access public
- * @static
- * @since 3/28/05
- */
- function getRule () {
- // Because there is no way in PHP to get the class name of the descendent
- // class on which this method is called, this method must be implemented
- // in each descendent class.
- if (!isset($GLOBALS['validator_rules']) || !is_array($GLOBALS['validator_rules']))
- $GLOBALS['validator_rules'] = array();
- $class = __CLASS__;
- if (!isset($GLOBALS['validator_rules'][$class]))
- $GLOBALS['validator_rules'][$class] = new $class;
- return $GLOBALS['validator_rules'][$class];
- }
- }
- ?>
Documentation generated on Wed, 19 Sep 2007 10:25:16 -0400 by phpDocumentor 1.3.0RC3