Class ChoiceValidatorRule

Description

a ChoiceValidatorRule checks a value against a certain given number of choices

  • version: $Id: ChoiceValidatorRule.class.php,v 1.7 2007/09/04 20:25:55 adamfranco Exp $
  • license: GNU General Public License (GPL)
  • copyright: Copyright © 2005, Middlebury College

Located in /harmoni/core/utilities/FieldSetValidator/rules/ChoiceValidatorRule.class.php (line 15)

ValidatorRuleInterface
   |
   --ChoiceValidatorRule
Variable Summary
array $_choices
Method Summary
void ChoiceValidatorRule (mixed $choice1,$choice2,...)
boolean check (mixed $val)
object ValidatorRule getRule ()
string getRuleKey ()
Variables
array $_choices (line 24)

an array of choices to allow

  • var: the array of choices
  • access: private
Methods
Constructor ChoiceValidatorRule (line 34)

the concstructor

  • access: public
void ChoiceValidatorRule (mixed $choice1,$choice2,...)
  • mixed $choice1,$choice2,...: a variable-length list of choices to allow if any of $choiceN are an array, all the values contained within are used
check (line 50)

checks a given value against the given choices

  • return: true if the check succeeds, false if it (guess...) fails.
  • access: public
boolean check (mixed $val)
  • mixed $val: the value to check against the rule

Redefinition of:
ValidatorRuleInterface::check()
checks a given value against the rule contained within the class
getRule (line 69)

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

  • since: 3/28/05
  • static:
  • access: public
object ValidatorRule getRule ()

Redefinition of:
ValidatorRuleInterface::getRule()
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.
getRuleKey (line 116)

Return a key that can be used to identify this Rule for caching purposes.

If this rule takes no arguments, the class name should be sufficient. otherwise, append the arguments.

This method should only be called by ValidatorRules.

  • since: 3/29/05
  • access: protected
string getRuleKey ()

Redefinition of:
ValidatorRuleInterface::getRuleKey()
Return a key that can be used to identify this Rule for caching purposes.

Inherited Methods

Inherited From ValidatorRuleInterface

ValidatorRuleInterface::check()
ValidatorRuleInterface::getRule()
ValidatorRuleInterface::getRuleKey()

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