Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Attributes
Zend_Validate_File_NotExists Class Reference
Inheritance diagram for Zend_Validate_File_NotExists:
Zend_Validate_File_Exists Zend_Validate_Abstract Zend_Validate_Interface

Public Member Functions

 isValid ($value, $file=null)
 
- Public Member Functions inherited from Zend_Validate_File_Exists
 __construct ($directory=array())
 
 getDirectory ($asArray=false)
 
 setDirectory ($directory)
 
 addDirectory ($directory)
 
 isValid ($value, $file=null)
 
- Public Member Functions inherited from Zend_Validate_Abstract
 getMessages ()
 
 getMessageVariables ()
 
 getMessageTemplates ()
 
 setMessage ($messageString, $messageKey=null)
 
 setMessages (array $messages)
 
 __get ($property)
 
 getErrors ()
 
 setObscureValue ($flag)
 
 getObscureValue ()
 
 setTranslator ($translator=null)
 
 getTranslator ()
 
 hasTranslator ()
 
 setDisableTranslator ($flag)
 
 translatorIsDisabled ()
 
- Public Member Functions inherited from Zend_Validate_Interface
 isValid ($value)
 

Data Fields

const DOES_EXIST = 'fileNotExistsDoesExist'
 
- Data Fields inherited from Zend_Validate_File_Exists
const DOES_NOT_EXIST = 'fileExistsDoesNotExist'
 

Protected Attributes

 $_messageTemplates
 
- Protected Attributes inherited from Zend_Validate_File_Exists
 $_messageTemplates
 
 $_directory = ''
 
 $_messageVariables
 
- Protected Attributes inherited from Zend_Validate_Abstract
 $_value
 
 $_messageVariables = array()
 
 $_messageTemplates = array()
 
 $_messages = array()
 
 $_obscureValue = false
 
 $_errors = array()
 
 $_translator
 
 $_translatorDisabled = false
 

Additional Inherited Members

- Static Public Member Functions inherited from Zend_Validate_Abstract
static setDefaultTranslator ($translator=null)
 
static getDefaultTranslator ()
 
static hasDefaultTranslator ()
 
static getMessageLength ()
 
static setMessageLength ($length=-1)
 
- Protected Member Functions inherited from Zend_Validate_File_Exists
 _throw ($file, $errorType)
 
- Protected Member Functions inherited from Zend_Validate_Abstract
 _createMessage ($messageKey, $value)
 
 _implodeRecursive (array $pieces)
 
 _error ($messageKey, $value=null)
 
 _setValue ($value)
 
- Static Protected Attributes inherited from Zend_Validate_Abstract
static $_defaultTranslator
 
static $_messageLength = -1
 

Detailed Description

Definition at line 35 of file NotExists.php.

Member Function Documentation

◆ isValid()

isValid (   $value,
  $file = null 
)

Defined by Zend_Validate_Interface

Returns true if and only if the file does not exist in the set destinations

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

Definition at line 58 of file NotExists.php.

59  {
60  $directories = $this->getDirectory(true);
61  if (($file !== null) and (!empty($file['destination']))) {
62  $directories[] = $file['destination'];
63  } else if (!isset($file['name'])) {
64  $file['name'] = $value;
65  }
66 
67  foreach ($directories as $directory) {
68  if (empty($directory)) {
69  continue;
70  }
71 
72  $check = true;
73  if (file_exists($directory . DIRECTORY_SEPARATOR . $file['name'])) {
74  return $this->_throw($file, self::DOES_EXIST);
75  }
76  }
77 
78  if (!isset($check)) {
79  return $this->_throw($file, self::DOES_EXIST);
80  }
81 
82  return true;
83  }
$value
Definition: gender.phtml:16
getDirectory($asArray=false)
Definition: Exists.php:88
_throw($file, $errorType)
Definition: Exists.php:195

Field Documentation

◆ $_messageTemplates

$_messageTemplates
protected
Initial value:
= array(
self::DOES_EXIST => "File '%value%' exists",
)

Definition at line 45 of file NotExists.php.

◆ DOES_EXIST

const DOES_EXIST = 'fileNotExistsDoesExist'

@const string Error constants

Definition at line 40 of file NotExists.php.


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