Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes

Zend_Validate_File_Count Class Reference

Inheritance diagram for Zend_Validate_File_Count:
Zend_Validate_Abstract Zend_Validate_Interface Zend_Validate_File_WordCount

Public Member Functions

 __construct ($options)
 getMin ()
 setMin ($min)
 getMax ()
 setMax ($max)
 addFile ($file)
 isValid ($value, $file=null)

Data Fields

const TOO_MUCH = 'fileCountTooMuch'
const TOO_LESS = 'fileCountTooLess'

Protected Member Functions

 _throw ($file, $errorType)

Protected Attributes

 $_messageTemplates
 $_messageVariables
 $_min
 $_max
 $_count
 $_files

Detailed Description

Definition at line 35 of file Count.php.


Constructor & Destructor Documentation

__construct ( options )

Sets validator options

Min limits the file count, when used with max=null it is the maximum file count It also accepts an array with the keys 'min' and 'max'

If $options is a integer, it will be used as maximum file count As Array is accepts the following keys: 'min': Minimum filecount 'max': Maximum filecount

Parameters:
integer | array | Zend_Config$optionsOptions for the adapter
Returns:
void

Definition at line 106 of file Count.php.


Member Function Documentation

_throw ( file,
errorType 
) [protected]

Throws an error of the given type

Parameters:
string$file
string$errorType
Returns:
false

Reimplemented in Zend_Validate_File_WordCount.

Definition at line 266 of file Count.php.

addFile ( file )

Adds a file for validation

Parameters:
string | array$file

Definition at line 216 of file Count.php.

getMax (  )

Returns the maximum file count

Returns:
integer

Definition at line 177 of file Count.php.

getMin (  )

Returns the minimum file count

Returns:
integer

Definition at line 138 of file Count.php.

isValid ( value,
file = null 
)

Defined by Zend_Validate_Interface

Returns true if and only if the file count of all checked files is at least min and not bigger than max (when max is not null). Attention: When checking with set min you must give all files with the first call, otherwise you will get an false.

Parameters:
string | array$valueFilenames to check for count
array$fileFile data from Zend_File_Transfer
Returns:
boolean

Reimplemented in Zend_Validate_File_WordCount.

Definition at line 244 of file Count.php.

setMax ( max )

Sets the maximum file count

Parameters:
integer | array$maxThe maximum file count
Returns:
Zend_Validate_StringLength Provides a fluent interface
Exceptions:
Zend_Validate_ExceptionWhen max is smaller than min

Definition at line 189 of file Count.php.

setMin ( min )

Sets the minimum file count

Parameters:
integer | array$minThe minimum file count
Returns:
Zend_Validate_File_Count Provides a fluent interface
Exceptions:
Zend_Validate_ExceptionWhen min is greater than max

Definition at line 150 of file Count.php.


Field Documentation

$_messageTemplates [protected]
Initial value:
 array(
        self::TOO_MUCH => "Too much files, maximum '%max%' are allowed but '%count%' are given",
        self::TOO_LESS => "Too less files, minimum '%min%' are expected but '%count%' are given"
    )

Reimplemented from Zend_Validate_Abstract.

Definition at line 47 of file Count.php.

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

Reimplemented from Zend_Validate_Abstract.

Definition at line 55 of file Count.php.

const TOO_MUCH = 'fileCountTooMuch'

#@+ string Error constants

Reimplemented in Zend_Validate_File_WordCount.

Definition at line 40 of file Count.php.


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