Definition at line 35 of file FilesSize.php.
◆ __construct()
Sets validator options
Min limits the used diskspace for all files, when used with max=null it is the maximum filesize It also accepts an array with the keys 'min' and 'max'
- Parameters
-
integer | array | Zend_Config | $options | Options for this validator |
- Exceptions
-
Definition at line 69 of file FilesSize.php.
71 $this->_files = array();
79 #require_once 'Zend/Validate/Exception.php'; 83 if (1 < func_num_args()) {
84 $argv = func_get_args();
86 $options[
'max'] = array_shift($argv);
88 $options[
'bytestring'] = array_shift($argv);
elseif(isset( $params[ 'redirect_parent']))
◆ isValid()
isValid |
( |
|
$value, |
|
|
|
$file = null |
|
) |
| |
Defined by Zend_Validate_Interface
Returns true if and only if the disk usage of all files is at least min and not bigger than max (when max is not null).
- Parameters
-
string | array | $value | Real file to check for size |
array | $file | File data from Zend_File_Transfer |
- Returns
- boolean
Definition at line 105 of file FilesSize.php.
107 #require_once 'Zend/Loader.php'; 112 $min = $this->
getMin(
true);
113 $max = $this->
getMax(
true);
118 $this->
_throw($file, self::NOT_READABLE);
122 if (!isset($this->_files[
$files])) {
131 $this->_size = $size;
132 if (($max !==
null) && ($max < $size)) {
136 $this->
_throw($file, self::TOO_BIG);
138 $this->_size = $size;
140 $this->
_throw($file, self::TOO_BIG);
146 if (($min !==
null) && ($size < $min)) {
150 $this->
_throw($file, self::TOO_SMALL);
152 $this->_size = $size;
154 $this->
_throw($file, self::TOO_SMALL);
158 return empty($this->_messages);
static isReadable($filename)
_throw($file, $errorType)
foreach($appDirs as $dir) $files
◆ $_files
◆ $_messageTemplates
Initial value:= array(
self::TOO_BIG => "All files in sum should have a maximum size of '%max%' but '%size%' were detected",
self::TOO_SMALL => "All files in sum should have a minimum size of '%min%' but '%size%' were detected",
self::NOT_READABLE => "One or more files can not be read",
)
Definition at line 47 of file FilesSize.php.
◆ NOT_READABLE
const NOT_READABLE = 'fileFilesSizeNotReadable' |
◆ TOO_BIG
const TOO_BIG = 'fileFilesSizeTooBig' |
◆ TOO_SMALL
const TOO_SMALL = 'fileFilesSizeTooSmall' |
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Validate/File/FilesSize.php