ZenMagick 0.9.10


org.zenmagick.mvc.validation.rules\ZMRegexpRule
mvc\validation\rules\ZMRegexpRule.php at line 30

Class ZMRegexpRule

ZMObject
└─ZMRule
└─ZMRegexpRule

public class ZMRegexpRule
extends ZMRule

Regexp validation rules.

Author:
DerManoMann

Method Summary
void

__construct(string name, string regexp, string msg, string defaultMsg)

Create new regexp rule.

string

getRegexp()

Get the regular expression.

void

setRegexp(string regexp)

Set the regular expression.

string

toJSString()

Create JS validation call.

boolean

validate(ZMRequest request, array data)

Validate the given request data.

Methods inherited from org.zenmagick.mvc.validation\ZMRule
__construct, getDefaultMsg, getErrorMsg, getJSName, getMsg, getName, setDefaultMsg, setMsg, setName, toJSString, validate
Methods inherited from org.zenmagick.core\ZMObject
__construct, attachMethod, get, getAttachedMethods, getProperties, getPropertyNames, set, singleton

Method Detail

mvc\validation\rules\ZMRegexpRule.php at line 41

__construct

public void __construct(string name, string regexp, string msg, string defaultMsg)

Create new regexp rule.

Parameters:
name - The field name; default is null.
regexp - The regular expression; default is null.
msg - Optional message; default is null.

mvc\validation\rules\ZMRegexpRule.php at line 68

getRegexp

public string getRegexp()

Get the regular expression.

Returns:
The regular expression.

mvc\validation\rules\ZMRegexpRule.php at line 59

setRegexp

public void setRegexp(string regexp)

Set the regular expression.

Parameters:
regexp - The regular expression.

mvc\validation\rules\ZMRegexpRule.php at line 89

toJSString

public string toJSString()

Create JS validation call.

Returns:
Formatted JavaScript .

mvc\validation\rules\ZMRegexpRule.php at line 79

validate

public boolean validate(ZMRequest request, array data)

Validate the given request data.

Parameters:
request - The current request.
data - The data.
Returns:
true if the regular expression does match.

ZenMagick 0.9.10