Public Member Functions | Data Fields | Protected Attributes

Zend_Validate_StringLength Class Reference

Inheritance diagram for Zend_Validate_StringLength:
Zend_Validate_Abstract Zend_Validate_Interface

Public Member Functions

 __construct ($min=0, $max=null, $encoding=null)
 getMin ()
 setMin ($min)
 getMax ()
 setMax ($max)
 getEncoding ()
 setEncoding ($encoding=null)
 isValid ($value)

Data Fields

const INVALID = 'stringLengthInvalid'
const TOO_SHORT = 'stringLengthTooShort'
const TOO_LONG = 'stringLengthTooLong'

Protected Attributes

 $_messageTemplates
 $_messageVariables
 $_min
 $_max
 $_encoding

Detailed Description

Definition at line 33 of file StringLength.php.


Constructor & Destructor Documentation

__construct ( min = 0,
max = null,
encoding = null 
)

Sets validator options

Parameters:
integer$min
integer$max
Returns:
void

Definition at line 86 of file StringLength.php.


Member Function Documentation

getEncoding (  )

Returns the actual encoding

Returns:
string

Definition at line 164 of file StringLength.php.

getMax (  )

Returns the max option

Returns:
integer|null

Definition at line 129 of file StringLength.php.

getMin (  )

Returns the min option

Returns:
integer

Definition at line 98 of file StringLength.php.

isValid ( value )

Defined by Zend_Validate_Interface

Returns true if and only if the string length of $value is at least the min option and no greater than the max option (when the max option is not null).

Parameters:
string$value
Returns:
boolean

Implements Zend_Validate_Interface.

Definition at line 201 of file StringLength.php.

setEncoding ( encoding = null )

Sets a new encoding to use

Parameters:
string$encoding
Returns:
Zend_Validate_StringLength

Definition at line 175 of file StringLength.php.

setMax ( max )

Sets the max option

Parameters:
integer | null$max
Exceptions:
Zend_Validate_Exception
Returns:
Zend_Validate_StringLength Provides a fluent interface

See also:
Zend_Validate_Exception

Definition at line 141 of file StringLength.php.

setMin ( min )

Sets the min option

Parameters:
integer$min
Exceptions:
Zend_Validate_Exception
Returns:
Zend_Validate_StringLength Provides a fluent interface

See also:
Zend_Validate_Exception

Definition at line 110 of file StringLength.php.


Field Documentation

$_messageTemplates [protected]
Initial value:
 array(
        self::INVALID   => "Invalid type given, value should be a string",
        self::TOO_SHORT => "'%value%' is less than %min% characters long",
        self::TOO_LONG  => "'%value%' is greater than %max% characters long"
    )

Reimplemented from Zend_Validate_Abstract.

Definition at line 42 of file StringLength.php.

$_messageVariables [protected]
Initial value:
 array(
        'min' => '_min',
        'max' => '_max'
    )

Reimplemented from Zend_Validate_Abstract.

Definition at line 51 of file StringLength.php.


The documentation for this class was generated from the following file: