Generates random word which user should recognise
Methods
Abstract constructor for all validators
A validator should accept following parameters:
- nothing f.e.
__construct(array | \Traversable $options)
Inherited
Validator()
- one or multiple scalar values f.e. Validator($first, $second, $third)
- an array f.e. Validator(array($first => 'first', $second => 'second', $third => 'third'))
- an instance of Traversable f.e. Validator($config_instance)
inherited_from |
\Zend\Validator\AbstractValidator::__construct() |
inherited_from |
\Zend\Captcha\AbstractAdapter::__construct() |
Parameters
$options
array\Traversable
Magic function returns the value of the requested property, if and only if it is the value or a
message variable.
__get(string $property) : mixed
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::__get() |
inherited_from |
\Zend\Captcha\AbstractAdapter::__get() |
Parameters
$property
string
Exceptions
Returns
mixed
Invoke as command
__invoke(mixed $value) : bool
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::__invoke() |
inherited_from |
\Zend\Captcha\AbstractAdapter::__invoke() |
Parameters
$value
mixed
Returns
bool
Generate new session ID and new word
generate() : string
Get default translation object for all validate objects
getDefaultTranslator() : \Zend\Validator\Translator\TranslatorInterface | null
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::getDefaultTranslator() |
inherited_from |
\Zend\Captcha\AbstractAdapter::getDefaultTranslator() |
Returns
Get default translation text domain for all validate objects
getDefaultTranslatorTextDomain() : string
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::getDefaultTranslatorTextDomain() |
inherited_from |
\Zend\Captcha\AbstractAdapter::getDefaultTranslatorTextDomain() |
Returns
string
Get helper name used to render captcha
getHelperName() : string
By default, return empty string, indicating no helper needed.
Returns
string
Retrieve captcha ID
getId() : string
Returns the maximum allowed message length
getMessageLength() : int
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::getMessageLength() |
inherited_from |
\Zend\Captcha\AbstractAdapter::getMessageLength() |
Returns
int
Returns the message templates from the validator
getMessageTemplates() : array
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::getMessageTemplates() |
inherited_from |
\Zend\Captcha\AbstractAdapter::getMessageTemplates() |
Returns
array
Returns an array of the names of variables that are used in constructing validation failure messages
getMessageVariables() : array
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::getMessageVariables() |
inherited_from |
\Zend\Captcha\AbstractAdapter::getMessageVariables() |
Returns
array
Returns array of validation failure messages
getMessages() : array
Inherited
The array keys are validation failure message identifiers,
and the array values are the corresponding human-readable message strings.
If isValid() was never called or if the most recent isValid() call
returned true, then this method returns an empty array.
inherited_from |
\Zend\Validator\AbstractValidator::getMessages() |
inherited_from |
\Zend\Captcha\AbstractAdapter::getMessages() |
Returns
array
Get name
getName() : string
Inherited
inherited_from |
\Zend\Captcha\AbstractAdapter::getName() |
Returns
string
Returns an option
getOption(string $option) : mixed
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::getOption() |
inherited_from |
\Zend\Captcha\AbstractAdapter::getOption() |
Parameters
$option
string
Option to be returned
Exceptions
Returns
mixed
Returned option
Retrieve options representing object state
getOptions() : array
Inherited
inherited_from |
\Zend\Captcha\AbstractAdapter::getOptions() |
Returns
array
Retrieve session class to utilize
getSessionClass() : string
Get session token timeout
getTimeout() : int
Return translation object
getTranslator() : \Zend\Validator\Translator\TranslatorInterface | null
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::getTranslator() |
inherited_from |
\Zend\Captcha\AbstractAdapter::getTranslator() |
Returns
Return the translation text domain
getTranslatorTextDomain() : string
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::getTranslatorTextDomain() |
inherited_from |
\Zend\Captcha\AbstractAdapter::getTranslatorTextDomain() |
Returns
string
Numbers should be included in the pattern?
getUseNumbers() : bool
Get captcha word
getWord() : string
Retrieve word length to use when generating captcha
getWordlen() : int
Is there a default translation object set?
hasDefaultTranslator() : bool
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::hasDefaultTranslator() |
inherited_from |
\Zend\Captcha\AbstractAdapter::hasDefaultTranslator() |
Returns
bool
Does this validator have its own specific translator?
hasTranslator() : bool
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::hasTranslator() |
inherited_from |
\Zend\Captcha\AbstractAdapter::hasTranslator() |
Returns
bool
Is translation enabled?
isTranslatorEnabled() : bool
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::isTranslatorEnabled() |
inherited_from |
\Zend\Captcha\AbstractAdapter::isTranslatorEnabled() |
Returns
bool
Validate the word
isValid(mixed $value, mixed $context) : bool
If $value fails validation, then this method returns false, and
getMessages() will return an array of messages that explain why the
validation failed.
see |
\Zend\Validator\ValidatorInterface::isValid() |
Parameters
$value
mixed
$context
mixed
Exceptions
Returns
bool
Retrieve flag indicating whether or not value should be obfuscated in
messages
isValueObscured() : bool
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::isValueObscured() |
inherited_from |
\Zend\Captcha\AbstractAdapter::isValueObscured() |
Returns
bool
Set default translation object for all validate objects
setDefaultTranslator(\Zend\Validator\Translator\TranslatorInterface $translator, string $textDomain) : void
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::setDefaultTranslator() |
inherited_from |
\Zend\Captcha\AbstractAdapter::setDefaultTranslator() |
Parameters
$textDomain
string
(optional)
Exceptions
Set default translation text domain for all validate objects
setDefaultTranslatorTextDomain(string $textDomain) : void
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::setDefaultTranslatorTextDomain() |
inherited_from |
\Zend\Captcha\AbstractAdapter::setDefaultTranslatorTextDomain() |
Parameters
$textDomain
string
Sets if session should be preserved on generate()
setKeepSession(bool $keepSession) : \Zend\Captcha\AbstractWord
Parameters
$keepSession
bool
Should session be kept on generate()?
Returns
Sets the validation failure message template for a particular key
setMessage(string $messageString, string $messageKey) : \Zend\Validator\AbstractValidator
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::setMessage() |
inherited_from |
\Zend\Captcha\AbstractAdapter::setMessage() |
Parameters
$messageString
string
$messageKey
string
OPTIONAL
Exceptions
Returns
Sets the maximum allowed message length
setMessageLength(int $length)
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::setMessageLength() |
inherited_from |
\Zend\Captcha\AbstractAdapter::setMessageLength() |
Parameters
$length
int
Sets validation failure message templates given as an array, where the array keys are the message keys,
and the array values are the message template strings.
setMessages(array $messages) : \Zend\Validator\AbstractValidator
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::setMessages() |
inherited_from |
\Zend\Captcha\AbstractAdapter::setMessages() |
Parameters
$messages
array
Returns
Set name
setName(string $name) : \Zend\Captcha\AbstractAdapter
Inherited
inherited_from |
\Zend\Captcha\AbstractAdapter::setName() |
Parameters
$name
string
Returns
Set single option for the object
setOption(string $key, string $value) : \Zend\Captcha\AbstractAdapter
Inherited
inherited_from |
\Zend\Captcha\AbstractAdapter::setOption() |
Parameters
$key
string
$value
string
Returns
Set object state from options array
setOptions(array | \Traversable $options) : \Zend\Captcha\AbstractAdapter
Inherited
inherited_from |
\Zend\Captcha\AbstractAdapter::setOptions() |
Parameters
$options
array\Traversable
Exceptions
Returns
Set session class for persistence
setSessionClass(string $sessionClass) : \Zend\Captcha\AbstractWord
Parameters
$sessionClass
string
Returns
Set translation object
setTranslator(\Zend\Validator\Translator\TranslatorInterface $translator, string $textDomain) : \Zend\Validator\AbstractValidator
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::setTranslator() |
inherited_from |
\Zend\Captcha\AbstractAdapter::setTranslator() |
Parameters
$textDomain
string
(optional)
Exceptions
Returns
Indicate whether or not translation should be enabled
setTranslatorEnabled(bool $flag) : \Zend\Validator\AbstractValidator
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::setTranslatorEnabled() |
inherited_from |
\Zend\Captcha\AbstractAdapter::setTranslatorEnabled() |
Parameters
$flag
bool
Returns
Set translation text domain
setTranslatorTextDomain(string $textDomain) : \Zend\Validator\AbstractValidator
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::setTranslatorTextDomain() |
inherited_from |
\Zend\Captcha\AbstractAdapter::setTranslatorTextDomain() |
Parameters
$textDomain
string
Returns
Set if numbers should be included in the pattern
setUseNumbers(bool $useNumbers) : \Zend\Captcha\AbstractWord
Parameters
$useNumbers
bool
numbers should be included in the pattern?
Returns
Set flag indicating whether or not value should be obfuscated in messages
setValueObscured(bool $flag) : \Zend\Validator\AbstractValidator
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::setValueObscured() |
inherited_from |
\Zend\Captcha\AbstractAdapter::setValueObscured() |
Parameters
$flag
bool
Returns
Constructs and returns a validation failure message with the given message key and value.
createMessage(string $messageKey, string | array | object $value) : string
Inherited
Returns null if and only if $messageKey does not correspond to an existing template.
If a translator is available and a translation exists for $messageKey,
the translation will be used.
inherited_from |
\Zend\Validator\AbstractValidator::createMessage() |
inherited_from |
\Zend\Captcha\AbstractAdapter::createMessage() |
Parameters
$messageKey
string
$value
stringarrayobject
Returns
string
error()
error(string $messageKey, string $value) : void
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::error() |
inherited_from |
\Zend\Captcha\AbstractAdapter::error() |
Parameters
$messageKey
string
Generate a random identifier
generateRandomId() : string
Generate new random word
generateWord() : string
Returns the validation value
getValue() : mixed
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::getValue() |
inherited_from |
\Zend\Captcha\AbstractAdapter::getValue() |
Returns
mixed
Value to be validated
Sets the value to be validated and clears the messages and errors arrays
setValue(mixed $value) : void
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::setValue() |
inherited_from |
\Zend\Captcha\AbstractAdapter::setValue() |
Parameters
$value
mixed
Translate a validation message
translateMessage(string $messageKey, string $message) : string
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::translateMessage() |
inherited_from |
\Zend\Captcha\AbstractAdapter::translateMessage() |
Parameters
$messageKey
string
$message
string
Returns
string
Properties
$abstractOptions
$abstractOptions
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::$$abstractOptions |
inherited_from |
\Zend\Captcha\AbstractAdapter::$$abstractOptions |
Default translation object for all validate objects
$defaultTranslator : \Zend\Validator\Translator\TranslatorInterface
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::$$defaultTranslator |
inherited_from |
\Zend\Captcha\AbstractAdapter::$$defaultTranslator |
Default text domain to be used with translator
$defaultTranslatorTextDomain : string
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::$$defaultTranslatorTextDomain |
inherited_from |
\Zend\Captcha\AbstractAdapter::$$defaultTranslatorTextDomain |
Random session ID
$id : string
Should generate() keep session or create a new one?
$keepSession : bool
Limits the maximum returned length of an error message
$messageLength : int
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::$$messageLength |
inherited_from |
\Zend\Captcha\AbstractAdapter::$$messageLength |
Error messages
$messageTemplates : array
Captcha name
$name : string
Inherited
Useful to generate/check form fields
inherited_from |
\Zend\Captcha\AbstractAdapter::$$name |
Captcha options
$options : array
Inherited
inherited_from |
\Zend\Captcha\AbstractAdapter::$$options |
Class name for sessions
$sessionClass : string
Options to skip when processing options
$skipOptions : array
Inherited
inherited_from |
\Zend\Captcha\AbstractAdapter::$$skipOptions |
Session lifetime for the captcha data
$timeout : int
Should the numbers be used or only letters
$useNumbers : bool
The value to be validated
$value : mixed
Inherited
inherited_from |
\Zend\Validator\AbstractValidator::$$value |
inherited_from |
\Zend\Captcha\AbstractAdapter::$$value |
Generated word
$word : string
Length of the word to generate
$wordlen : int
Constants
MISSING_VALUE
MISSING_VALUE