Source for file ArrayValidatorRule.class.php

Documentation is available at ArrayValidatorRule.class.php

  1. <?php
  2.  
  3. require_once(HARMONI."utilities/FieldSetValidator/rules/ArrayValidatorRuleWithRule.class.php");
  4.  
  5. /**
  6. * an ArrayValidatorRule will check if a given value is an array
  7. *
  8. * @package harmoni.utilities.fieldsetvalidator.rules
  9. *
  10. * @copyright Copyright &copy; 2005, Middlebury College
  11. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  12. *
  13. * @version $Id: ArrayValidatorRule.class.php,v 1.6 2007/09/04 20:25:55 adamfranco Exp $
  14. */
  15. class ArrayValidatorRule
  16. extends ArrayValidatorRuleWithRule
  17. {
  18. /**
  19. * the constructor
  20. *
  21. * @access public
  22. * @return void
  23. ***/
  24. function ArrayValidatorRule() {
  25. $this->_rule = AlwaysTrueValidatorRule::getRule();
  26. }
  27. /**
  28. * This is a static method to return an already-created instance of a validator
  29. * rule. There are at most about a hundred unique rule objects in use durring
  30. * any given execution cycle, but rule objects are instantiated hundreds of
  31. * thousands of times.
  32. *
  33. * This method follows a modified Singleton pattern
  34. *
  35. * @return object ValidatorRule
  36. * @access public
  37. * @static
  38. * @since 3/28/05
  39. */
  40. function getRule () {
  41. // Because there is no way in PHP to get the class name of the descendent
  42. // class on which this method is called, this method must be implemented
  43. // in each descendent class.
  44.  
  45. if (!isset($GLOBALS['validator_rules']) || !is_array($GLOBALS['validator_rules']))
  46. $GLOBALS['validator_rules'] = array();
  47. $class = __CLASS__;
  48. if (!isset($GLOBALS['validator_rules'][$class]))
  49. $GLOBALS['validator_rules'][$class] = new $class;
  50. return $GLOBALS['validator_rules'][$class];
  51. }
  52. }
  53.  
  54. ?>

Documentation generated on Wed, 19 Sep 2007 10:21:32 -0400 by phpDocumentor 1.3.0RC3