Moodle  2.2.1
http://www.collinsharper.com
Zend_Validate_File_Size Class Reference
Inheritance diagram for Zend_Validate_File_Size:
Collaboration diagram for Zend_Validate_File_Size:

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.

Here is the call graph for this function:


Member Function Documentation

_fromByteString ( size) [protected]

Returns the unformatted size

Parameters:
string$size
Returns:
integer

Definition at line 343 of file Size.php.

Here is the caller graph for this function:

_getSize ( ) [protected]

Retrieve current detected file size

Returns:
int

Definition at line 247 of file Size.php.

Here is the caller graph for this function:

_setSize ( size) [protected]

Set current size

Parameters:
int$size
Returns:
Zend_Validate_File_Size

Definition at line 258 of file Size.php.

Here is the caller graph for this function:

_throw ( file,
errorType 
) [protected]

Throws an error of the given type

Parameters:
string$file
string$errorType
Returns:
false

Definition at line 395 of file Size.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_toByteString ( size) [protected]

Returns the formatted size

Parameters:
integer$size
Returns:
string

Definition at line 327 of file Size.php.

Here is the caller graph for this function:

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 206 of file Size.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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 164 of file Size.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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 274 of file Size.php.

Here is the call graph for this function:

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 223 of file Size.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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 181 of file Size.php.

Here is the call graph for this function:

Here is the caller graph for this function:

setUseByteString ( byteString = true)

Returns the minimum filesize

Parameters:
boolean$byteStringUse bytestring ?
Returns:
integer

Definition at line 142 of file Size.php.

Here is the caller graph for this function:

Will bytestring be used?

Returns:
boolean

Definition at line 153 of file Size.php.

Here is the caller graph for this function:


Field Documentation

$_max [protected]

Definition at line 76 of file Size.php.

$_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 => "File '%value%' could not be found",
    )

Reimplemented from Zend_Validate_Abstract.

Reimplemented in Zend_Validate_File_FilesSize.

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.

$_min [protected]

Definition at line 67 of file Size.php.

$_size [protected]

Definition at line 83 of file Size.php.

$_useByteString = true [protected]

Definition at line 90 of file Size.php.

const NOT_FOUND = 'fileSizeNotFound'

Definition at line 42 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.

const TOO_SMALL = 'fileSizeTooSmall'

Reimplemented in Zend_Validate_File_FilesSize.

Definition at line 41 of file Size.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations