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

Class: Structures_Form_Rule_Base

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

Class Overview




Author(s):

Variables

Methods


Child classes:

Inherited Variables

Inherited Methods


Class Details

[line 14]
  • Abstract:


[ Top ]


Class Variables

$errorMessage =  '{elementName} is not valid.'

[line 25]

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


[ Top ]

$substitutions = array('{elementName}' => 'getLabel')

[line 36]

The array of substitutions to be made in the error message.

The array should be of the form: array(<replace> => <withMethod>). The <withMethod> should be an element method such as getName or getValue.

  • Access: protected

Type:   array


[ Top ]



Method Detail

__construct (Constructor)   [line 49]

void __construct( [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_LengthRange::__construct()
Constructor. Calls the parent constructor then sets up the min and max values.
Structures_Form_Rule_Regex::__construct()
Constructor.
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.
Structures_Form_Rule_Required::__construct()
Constructor. Just calls the parent constructor.

Parameters:

string   $errorMessage   —  Optional error message.
array   $substitutions   —  Optional substitution array.

[ Top ]

addSubstitution   [line 102]

void addSubstitution( string $key, string $value)

Adds a new subsitution to the substitution array.
  • Access: public

Parameters:

string   $key   —  The substituion key.
string   $value   —  The substitution value.

[ Top ]

generateErrorString   [line 129]

string generateErrorString( Structures_Form_ElementInterface $element)

Generates an error string based on the class' error string and the class' substitution array.
  • Access: protected

Parameters:

object   $element   —  A Structures_Form element.

[ Top ]

removeSubstitution   [line 114]

void removeSubstitution( string $key)

Removes a subsitution from the substitution array.
  • Access: public

Parameters:

string   $key   —  The substituion key.

[ Top ]

setErrorMessage   [line 72]

void setErrorMessage( string $message)

Sets the error message to be used when a value fails to validate.

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

  • Access: public

Parameters:

string   $message   —  The error message.

[ Top ]

setSubstitutions   [line 87]

void setSubstitutions( array $subs)

Sets the array of error message substitutions.

The array should be of the form: array(<replace> => <withMethod>). The <withMethod> should be an element method such as getName or getValue.

  • Access: public

Parameters:

array   $subs   —  The array of substitutions.

[ Top ]


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