Path

ez components / documentation / api reference / 2007.2alpha1 / consoletools


eZ Components 2007.2alpha1

ConsoleTools: ezcConsoleQuestionDialogRegexValidator

[ Tutorial ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcConsoleQuestionDialogRegexValidator

Regex validator for ezcConsoleQuestionDialog Validator class for ezcConsoleQuestionDialog objects that validates by matching a certain regular expression. [source]

Implemented Interfaces

Properties

mixed read/write  $default
A default value if no (an empty string) result given.
string read/write  $pattern
The pattern to use for validation. Delimiters and modifiers included.

Member Variables

protected array(string=>mixed) $properties = array(
"pattern" => null,
"default" => null,
)

Properties

Method Summary

public void __construct( $pattern, [$default = null] )
Create a new question dialog regex validator.
public mixed fixup( $result )
Returns a fixed version of the result, if possible.
public string getResultString( )
Returns a string representing valid results.
public bool validate( $result )
Returns if the given result is valid.

Methods

__construct

void __construct( string $pattern, [mixed $default = null] )
Create a new question dialog regex validator.
Create a new question dialog regex validator, which validates the result specified against a given regular expression. The delimiters and eventual modifiers must be included in the pattern. If not value is provided by the user a possibly set $default value is used instead.

Parameters

Name Type Description
$pattern string Pattern to validate against.
$default mixed Default value.

fixup

mixed fixup( mixed $result )
Returns a fixed version of the result, if possible.
If no result was provided by the user, the default value will be returned, if set.

Parameters

Name Type Description
$result mixed The received result.

getResultString

string getResultString( )
Returns a string representing valid results.
Returns the string that will be displayed with the question to indicate valid results to the user and a possibly set default, if available.

validate

bool validate( mixed $result )
Returns if the given result is valid.
Returns if the result matches the regular expression.

Parameters

Name Type Description
$result mixed The received result.

Last updated: Mon, 12 Nov 2007