Class Nexista_Validator

Description

This class Nexista_is the base class Nexista_upon which to extend custom validators

Located in /kernel/validator.php (line 20)


	
			
Direct descendents
Class Description
 class Nexista_RegexValidator This validator is used to check data using a Regular Expression passed as a parameter
 class Nexista_GdValidator This validator checks whether the format of the given image is supported by our version of GD.
 class Nexista_PhoneValidator This validator is used to check whether or not data is a valid phone number
 class Nexista_CustomValidator This validator calls a user defined function to validate the data.
 class Nexista_LengthValidator This validator is used to check that a string is under a certain length.
 class Nexista_RequiredValidator This validator is used to check whether or data is present.
 class Nexista_Nexista_XmlValidator This validator is used to make sure that a string contains is xml safe (i.e all tags close and nest appropriately) It does not check for headers and root tags.
 class Nexista_NumericValidator This validator is used to check whether or not data is composed of only numbers.
 class Nexista_MatchValidator This validator is used to check whether or not two values are the same.
 class Nexista_ValueValidator This validator checks that the data is equal to a certain value (i.e. true) using case insensitve string comparison
 class Nexista_AlphaValidator This validator is used to check whether or not data is composed of only letters.
 class Nexista_DummyValidator This validator is just a dummy validator. It is used when a field is required but no other validation is needed.
 class Nexista_EmailValidator This validator is used to check whether or not data is a valid email address.
 class Nexista_AlphanumValidator This validator is used to check whether or not data is composed of only alphanumeric characters.
Variable Summary
 boolean $empty
 string $message
 array $params
 boolean $required
 boolean $result
Method Summary
 boolean applyParams (array &$params)
 string getMessage ()
 void isEmpty (boolean 0)
 void isRequired (boolean 0)
 boolean isValid ()
 boolean main ()
 boolean process (array &$params, sring $required, boolean &$result)
 void setEmpty ()
 void setMessage (string $message)
 void setRequired (string $required)
Variables
boolean $empty = false (line 38)

Data existence flag

  • access: protected
string $message = '' (line 56)

Validation info message

  • access: protected

Redefined in descendants as:
array $params = array() (line 65)

Function parameter array

  • access: protected

Redefined in descendants as:
boolean $required = true (line 29)

Data requirement flag

  • access: protected
boolean $result = false (line 47)

Validator result flag

  • access: protected
Methods
applyParams (line 267)

Load class Nexista_parameters

This function will check if the required parameters for this class Nexista_are supplied and will load them into $this->params array

  • return: success
  • access: protected
boolean applyParams (array &$params)
  • array &$params: class Nexista_parameters
getMessage (line 248)

Gets a message from validator

string getMessage ()
isEmpty (line 223)

Gets data existence

  • access: public
void isEmpty (boolean 0)
  • boolean 0: true if present, false if absent
isRequired (line 235)

Gets data requirement flag

  • access: public
void isRequired (boolean 0)
  • boolean 0: true if required, false if not
isValid (line 200)

Gets validator result

  • return: validator result
  • access: public
boolean isValid ()
main (line 121)

Applies validator

This function should be extended in the custom validators. The function should return true/false for errors. If the item to validate is empty, call the method $this->isEmpty(). Set the property $this->valid to record validator result.

Sample code

  1.  //get data
  2.   $data time();
  3.  //check if empty value
  4.  if(!isset($data))
  5.       $this->setEmpty();
  6.  //validate
  7.  if($data 1)
  8.       $this->valid true;
  9.  else
  10.       $this->valid false;
  11.  //return true or false for function errors
  12.  return true;

  • return: success
  • access: protected
boolean main ()

Redefined in descendants as:
process (line 77)

Applies validator and checks requirements

  • return: function success
  • access: public
boolean process (array &$params, sring $required, boolean &$result)
  • array &$params: class Nexista_parameters
  • sring $required: item requirement parameters
  • boolean &$result: validator success
setEmpty (line 211)

Sets data existence to absent

  • access: public
void setEmpty ()
setMessage (line 140)

Sets a message from validator

This function allows a validator to set a text message that can be used to present to the user as error. Please note that this is not the error string itself. These error strings are language dependent and not set by the validator. This is rather some useful information that some validators may provide such as where and what kind of error caused the failure of the validation process.

  • access: protected
void setMessage (string $message)
  • string $message: message
setRequired (line 152)

Checks item requirements

  • access: protected
void setRequired (string $required)
  • string $required: item requirements

Documentation generated on Tue, 11 Mar 2008 23:23:15 -0400 for Nexista 0.2.0