Definition at line 35 of file Exists.php.
◆ __construct()
__construct |
( |
|
$directory = array() | ) |
|
Sets validator options
- Parameters
-
- Exceptions
-
Definition at line 68 of file Exists.php.
71 $directory = $directory->toArray();
72 }
else if (is_string($directory)) {
73 $directory = explode(
',', $directory);
74 }
else if (!is_array($directory)) {
75 #require_once 'Zend/Validate/Exception.php';
◆ _throw()
_throw |
( |
|
$file, |
|
|
|
$errorType |
|
) |
| |
|
protected |
Throws an error of the given type
- Parameters
-
string | $file | |
string | $errorType | |
- Returns
- false
Definition at line 195 of file Exists.php.
197 if ($file !==
null) {
198 $this->_value = $file[
'name'];
201 $this->
_error($errorType);
_error($messageKey, $value=null)
◆ addDirectory()
addDirectory |
( |
|
$directory | ) |
|
Adds the file directory which will be checked
- Parameters
-
string | array | $directory | The directory to add for validation |
- Exceptions
-
- Returns
- Zend_Validate_File_Extension Provides a fluent interface
Definition at line 119 of file Exists.php.
123 if (is_string($directory)) {
124 $directory = explode(
',', $directory);
125 }
else if (!is_array($directory)) {
126 #require_once 'Zend/Validate/Exception.php'; 137 $directories = array_unique($directories);
140 foreach ($directories as $key => $dir) {
142 unset($directories[$key]);
146 $this->_directory = implode(
',', $directories);
getDirectory($asArray=false)
◆ getDirectory()
getDirectory |
( |
|
$asArray = false | ) |
|
Returns the set file directories which are checked
- Parameters
-
boolean | $asArray | Returns the values as array, when false an concated string is returned |
- Returns
- string
Definition at line 88 of file Exists.php.
90 $asArray = (bool) $asArray;
91 $directory = (string) $this->_directory;
93 $directory = explode(
',', $directory);
◆ isValid()
isValid |
( |
|
$value, |
|
|
|
$file = null |
|
) |
| |
Defined by Zend_Validate_Interface
Returns true if and only if the file already exists in the set directories
- Parameters
-
- Returns
- boolean
Definition at line 160 of file Exists.php.
163 if (($file !==
null) and (!empty($file[
'destination']))) {
164 $directories[] = $file[
'destination'];
165 }
else if (!isset($file[
'name'])) {
170 foreach ($directories as $directory) {
171 if (empty($directory)) {
176 if (!file_exists($directory . DIRECTORY_SEPARATOR . $file[
'name'])) {
177 return $this->
_throw($file, self::DOES_NOT_EXIST);
182 return $this->
_throw($file, self::DOES_NOT_EXIST);
getDirectory($asArray=false)
_throw($file, $errorType)
◆ setDirectory()
setDirectory |
( |
|
$directory | ) |
|
Sets the file directory which will be checked
- Parameters
-
string | array | $directory | The directories to validate |
- Returns
- Zend_Validate_File_Extension Provides a fluent interface
Definition at line 105 of file Exists.php.
107 $this->_directory =
null;
◆ $_directory
◆ $_messageTemplates
Initial value:= array(
self::DOES_NOT_EXIST => "File '%value%' does not exist",
)
Definition at line 45 of file Exists.php.
◆ $_messageVariables
Initial value:= array(
'directory' => '_directory'
)
Definition at line 58 of file Exists.php.
◆ DOES_NOT_EXIST
const DOES_NOT_EXIST = 'fileExistsDoesNotExist' |
@const string Error constants
Definition at line 40 of file Exists.php.
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Validate/File/Exists.php