apidoc
[ class tree: apidoc ] [ index: apidoc ] [ all elements ]

Class: Structures_Form_Rule_Regex

Source Location: /Structures_Form-0.8.0devel/Form/Rule/Regex.php

Class Overview

Structures_Form_Rule_Base
   |
   --Structures_Form_Rule_Regex



Variables

Methods


Child classes:

Inherited Variables

Inherited Methods

Class: Structures_Form_Rule_Base

Structures_Form_Rule_Base::__construct()
Constructor.
Structures_Form_Rule_Base::addSubstitution()
Adds a new subsitution to the substitution array.
Structures_Form_Rule_Base::generateErrorString()
Generates an error string based on the class' error string and the class' substitution array.
Structures_Form_Rule_Base::removeSubstitution()
Removes a subsitution from the substitution array.
Structures_Form_Rule_Base::setErrorMessage()
Sets the error message to be used when a value fails to validate.
Structures_Form_Rule_Base::setSubstitutions()
Sets the array of error message substitutions.

Class Details

[line 18]


[ Top ]


Class Variables

$errorMessage =  '{elementName} must match {regex}.'

[line 29]

The error message to be returned if the element does not validate.

The values in {curly braces} will be substituted for values from the substitiution array.

  • Access: protected

Type:   string
Overrides:   Array


[ Top ]

$regex =

[line 39]

The regular expression to validate against.

Must be a PCRE.

  • Access: protected

Type:   string


[ Top ]



Method Detail

__construct (Constructor)   [line 53]

void __construct( string $regex, [string $errorMessage = null], [array $substitutions = null])

Constructor.

This rule does not require any additional arguments, but may accept two optional arguments.

  • Access: public

Overridden in child classes as:

Structures_Form_Rule_Alpha::__construct()
Constructor.
Structures_Form_Rule_Numeric::__construct()
Constructor.
Structures_Form_Rule_NumericRange::__construct()
Constructor. Calls the parent constructor then sets up the min and max values.
Structures_Form_Rule_AlphaNumeric::__construct()
Constructor.

Overrides Structures_Form_Rule_Base::__construct() (Constructor.)

Parameters:

string   $regex   —  A regular expression to validate against.
string   $errorMessage   —  Optional error message.
array   $substitutions   —  Optional substitution array.

[ Top ]

setRegex   [line 76]

void setRegex( string $regex)

Sets the regular expression to be used for validation.

Must be a PCRE.

  • Access: public

Parameters:

string   $regex   —  The regex for validation.

[ Top ]

validate   [line 89]

mixed validate( Structures_Form_ElementInterface $element)

Validates the given element.
  • Return: true if the value is ok, an error message otherwise.
  • Access: public

Overridden in child classes as:

Structures_Form_Rule_NumericRange::validate()
Validates the given element.

Parameters:

object   $element   —  A Structures_Form element.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:44:13 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.