Definition at line 35 of file Extension.php.
◆ __construct()
Sets validator options
- Parameters
-
Definition at line 76 of file Extension.php.
82 if (1 < func_num_args()) {
83 $case = func_get_arg(1);
◆ _throw()
_throw |
( |
|
$file, |
|
|
|
$errorType |
|
) |
| |
|
protected |
Throws an error of the given type
- Parameters
-
string | $file | |
string | $errorType | |
- Returns
- false
Definition at line 228 of file Extension.php.
230 if (
null !== $file) {
231 $this->_value = $file[
'name'];
234 $this->
_error($errorType);
_error($messageKey, $value=null)
◆ addExtension()
addExtension |
( |
|
$extension | ) |
|
Adds the file extensions
- Parameters
-
string | array | $extension | The extensions to add for validation |
- Returns
- Zend_Validate_File_Extension Provides a fluent interface
Definition at line 148 of file Extension.php.
162 $extensions = array_unique($extensions);
165 foreach ($extensions as $key => $ext) {
167 unset($extensions[$key]);
171 $this->_extension = implode(
',', $extensions);
◆ getCase()
Returns the case option
- Returns
- boolean
Definition at line 100 of file Extension.php.
◆ getExtension()
Returns the set file extension
- Returns
- array
Definition at line 122 of file Extension.php.
◆ isValid()
isValid |
( |
|
$value, |
|
|
|
$file = null |
|
) |
| |
Defined by Zend_Validate_Interface
Returns true if and only if the fileextension of $value is included in the set extension list
- Parameters
-
- Returns
- boolean
Definition at line 186 of file Extension.php.
189 #require_once 'Zend/Loader.php'; 191 return $this->
_throw($file, self::NOT_FOUND);
194 if ($file !==
null) {
195 $info[
'extension'] = substr($file[
'name'], strrpos($file[
'name'],
'.') + 1);
198 if (!array_key_exists(
'extension',
$info)) {
208 if ($this->_case && (in_array(
$info[
'extension'], $extensions))) {
210 }
else if (!$this->
getCase()) {
218 return $this->
_throw($file, self::FALSE_EXTENSION);
static isReadable($filename)
_throw($file, $errorType)
foreach( $_productCollection as $_product)() ?>" class $info
◆ setCase()
◆ setExtension()
setExtension |
( |
|
$extension | ) |
|
Sets the file extensions
- Parameters
-
string | array | $extension | The extensions to validate |
- Returns
- Zend_Validate_File_Extension Provides a fluent interface
Definition at line 135 of file Extension.php.
137 $this->_extension =
null;
◆ $_case
◆ $_extension
◆ $_messageTemplates
Initial value:= array(
self::FALSE_EXTENSION => "File '%value%' has a false extension",
self::NOT_FOUND => "File '%value%' is not readable or does not exist",
)
Definition at line 46 of file Extension.php.
◆ $_messageVariables
Initial value:= array(
'extension' => '_extension'
)
Definition at line 67 of file Extension.php.
◆ FALSE_EXTENSION
const FALSE_EXTENSION = 'fileExtensionFalse' |
◆ NOT_FOUND
const NOT_FOUND = 'fileExtensionNotFound' |
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Validate/File/Extension.php