update2
This commit is contained in:
parent
98419bd18d
commit
8a69e45efa
4919 changed files with 28311 additions and 224136 deletions
17
pfosten/vendor/symfony/http-foundation/FileBag.php
vendored
Executable file → Normal file
17
pfosten/vendor/symfony/http-foundation/FileBag.php
vendored
Executable file → Normal file
|
|
@ -24,8 +24,6 @@ class FileBag extends ParameterBag
|
|||
private static $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type');
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $parameters An array of HTTP files
|
||||
*/
|
||||
public function __construct(array $parameters = array())
|
||||
|
|
@ -47,7 +45,7 @@ class FileBag extends ParameterBag
|
|||
*/
|
||||
public function set($key, $value)
|
||||
{
|
||||
if (!is_array($value) && !$value instanceof UploadedFile) {
|
||||
if (!\is_array($value) && !$value instanceof UploadedFile) {
|
||||
throw new \InvalidArgumentException('An uploaded file must be an array or an instance of UploadedFile.');
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +67,7 @@ class FileBag extends ParameterBag
|
|||
*
|
||||
* @param array|UploadedFile $file A (multi-dimensional) array of uploaded file information
|
||||
*
|
||||
* @return UploadedFile|UploadedFile[] A (multi-dimensional) array of UploadedFile instances
|
||||
* @return UploadedFile[]|UploadedFile|null A (multi-dimensional) array of UploadedFile instances
|
||||
*/
|
||||
protected function convertFileInformation($file)
|
||||
{
|
||||
|
|
@ -78,7 +76,7 @@ class FileBag extends ParameterBag
|
|||
}
|
||||
|
||||
$file = $this->fixPhpFilesArray($file);
|
||||
if (is_array($file)) {
|
||||
if (\is_array($file)) {
|
||||
$keys = array_keys($file);
|
||||
sort($keys);
|
||||
|
||||
|
|
@ -90,6 +88,9 @@ class FileBag extends ParameterBag
|
|||
}
|
||||
} else {
|
||||
$file = array_map(array($this, 'convertFileInformation'), $file);
|
||||
if (array_keys($keys) === $keys) {
|
||||
$file = array_filter($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -108,20 +109,18 @@ class FileBag extends ParameterBag
|
|||
* It's safe to pass an already converted array, in which case this method
|
||||
* just returns the original array unmodified.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function fixPhpFilesArray($data)
|
||||
{
|
||||
if (!is_array($data)) {
|
||||
if (!\is_array($data)) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
$keys = array_keys($data);
|
||||
sort($keys);
|
||||
|
||||
if (self::$fileKeys != $keys || !isset($data['name']) || !is_array($data['name'])) {
|
||||
if (self::$fileKeys != $keys || !isset($data['name']) || !\is_array($data['name'])) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue