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

Zend_Validate_File_Size Class Reference

Inheritance diagram for Zend_Validate_File_Size:
Zend_Validate_Abstract Zend_Validate_Interface Zend_Validate_File_FilesSize

Public Member Functions

 __construct ($options)
 setUseByteString ($byteString=true)
 useByteString ()
 getMin ($raw=false)
 setMin ($min)
 getMax ($raw=false)
 setMax ($max)
 isValid ($value, $file=null)

Data Fields

const TOO_BIG = 'fileSizeTooBig'
const TOO_SMALL = 'fileSizeTooSmall'
const NOT_FOUND = 'fileSizeNotFound'

Protected Member Functions

 _getSize ()
 _setSize ($size)
 _toByteString ($size)
 _fromByteString ($size)
 _throw ($file, $errorType)

Protected Attributes

 $_messageTemplates
 $_messageVariables
 $_min
 $_max
 $_size
 $_useByteString = true

Detailed Description

Definition at line 35 of file Size.php.


Constructor & Destructor Documentation

__construct ( options )

Sets validator options

If $options is a integer, it will be used as maximum filesize As Array is accepts the following keys: 'min': Minimum filesize 'max': Maximum filesize 'bytestring': Use bytestring or real size for messages

Parameters:
integer | array$optionsOptions for the adapter

Reimplemented in Zend_Validate_File_FilesSize.

Definition at line 103 of file Size.php.


Member Function Documentation

_fromByteString ( size ) [protected]

Returns the unformatted size

Parameters:
string$size
Returns:
integer

Definition at line 344 of file Size.php.

_getSize (  ) [protected]

Retrieve current detected file size

Returns:
int

Definition at line 249 of file Size.php.

_setSize ( size ) [protected]

Set current size

Parameters:
int$size
Returns:
Zend_Validate_File_Size

Definition at line 260 of file Size.php.

_throw ( file,
errorType 
) [protected]

Throws an error of the given type

Parameters:
string$file
string$errorType
Returns:
false

Definition at line 396 of file Size.php.

_toByteString ( size ) [protected]

Returns the formatted size

Parameters:
integer$size
Returns:
string

Definition at line 328 of file Size.php.

getMax ( raw = false )

Returns the maximum filesize

Parameters:
bool$rawWhether or not to force return of the raw value (defaults off)
Returns:
integer|string

Definition at line 208 of file Size.php.

getMin ( raw = false )

Returns the minimum filesize

Parameters:
bool$rawWhether or not to force return of the raw value (defaults off)
Returns:
integer|string

Definition at line 166 of file Size.php.

isValid ( value,
file = null 
)

Defined by Zend_Validate_Interface

Returns true if and only if the filesize of $value is at least min and not bigger than max (when max is not null).

Parameters:
string$valueReal file to check for size
array$fileFile data from Zend_File_Transfer
Returns:
boolean

Reimplemented in Zend_Validate_File_FilesSize.

Definition at line 276 of file Size.php.

setMax ( max )

Sets the maximum filesize

Parameters:
integer$maxThe maximum filesize
Exceptions:
Zend_Validate_ExceptionWhen max is smaller than min
Returns:
Zend_Validate_StringLength Provides a fluent interface

Definition at line 225 of file Size.php.

setMin ( min )

Sets the minimum filesize

Parameters:
integer$minThe minimum filesize
Exceptions:
Zend_Validate_ExceptionWhen min is greater than max
Returns:
Zend_Validate_File_Size Provides a fluent interface

Definition at line 183 of file Size.php.

setUseByteString ( byteString = true )

Returns the minimum filesize

Parameters:
boolean$byteStringUse bytestring ?
Returns:
integer

Definition at line 144 of file Size.php.

useByteString (  )

Will bytestring be used?

Returns:
boolean

Definition at line 155 of file Size.php.


Field Documentation

$_messageTemplates [protected]
Initial value:
 array(
        self::TOO_BIG   => "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected",
        self::TOO_SMALL => "Minimum expected size for file '%value%' is '%min%' but '%size%' detected",
        self::NOT_FOUND => "The file '%value%' could not be found"
    )

Reimplemented from Zend_Validate_Abstract.

Definition at line 48 of file Size.php.

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

Reimplemented from Zend_Validate_Abstract.

Definition at line 57 of file Size.php.

const TOO_BIG = 'fileSizeTooBig'

#@+ string Error constants

Reimplemented in Zend_Validate_File_FilesSize.

Definition at line 40 of file Size.php.


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