updated-packages

This commit is contained in:
RafficMohammed
2023-01-08 00:13:22 +05:30
parent 3ff7df7487
commit da241bacb6
12659 changed files with 563377 additions and 510538 deletions

View File

@@ -11,12 +11,15 @@ namespace Zend\Validator\File;
use Zend\Validator\AbstractValidator;
use Zend\Validator\Exception;
use Zend\Validator\File\FileInformationTrait;
/**
* Validator which checks if the file already exists in the directory
*/
class Exists extends AbstractValidator
{
use FileInformationTrait;
/**
* @const string Error constants
*/
@@ -144,31 +147,15 @@ class Exists extends AbstractValidator
*/
public function isValid($value, $file = null)
{
if (is_string($value) && is_array($file)) {
// Legacy Zend\Transfer API support
$filename = $file['name'];
$file = $file['tmp_name'];
$this->setValue($filename);
} elseif (is_array($value)) {
if (! isset($value['tmp_name']) || ! isset($value['name'])) {
throw new Exception\InvalidArgumentException(
'Value array must be in $_FILES format'
);
}
$file = $value['tmp_name'];
$filename = basename($file);
$this->setValue($value['name']);
} else {
$file = $value;
$filename = basename($file);
$this->setValue($filename);
}
$fileInfo = $this->getFileInfo($value, $file, false, true);
$this->setValue($fileInfo['filename']);
$check = false;
$directories = $this->getDirectory(true);
if (! isset($directories)) {
$check = true;
if (! file_exists($file)) {
if (! file_exists($fileInfo['file'])) {
$this->error(self::DOES_NOT_EXIST);
return false;
}
@@ -179,7 +166,7 @@ class Exists extends AbstractValidator
}
$check = true;
if (! file_exists($directory . DIRECTORY_SEPARATOR . $filename)) {
if (! file_exists($directory . DIRECTORY_SEPARATOR . $fileInfo['basename'])) {
$this->error(self::DOES_NOT_EXIST);
return false;
}