PHP Class Symfony\Component\HttpFoundation\FileBag

Author: Fabien Potencier ([email protected])
Author: Bulat Shakirzyanov ([email protected])
Inheritance: extends Symfony\Component\HttpFoundation\ParameterBag
Mostra file Open project: pmjones/php-framework-benchmarks Class Usage Examples

Public Methods

Method Description
__construct ( array $parameters = [] ) Constructor.
add ( array $files = [] ) (non-PHPdoc)
replace ( array $files = [] ) (non-PHPdoc)
set ( $key, $value ) (non-PHPdoc)

Protected Methods

Method Description
convertFileInformation ( array | Symfony\Component\HttpFoundation\File\UploadedFile $file ) : array Converts uploaded files to UploadedFile instances.
fixPhpFilesArray ( array $data ) : array Fixes a malformed PHP $_FILES array.

Method Details

__construct() public method

Constructor.
public __construct ( array $parameters = [] )
$parameters array An array of HTTP files

add() public method

(non-PHPdoc)
See also: Symfony\Component\HttpFoundation\ParameterBag::add()
public add ( array $files = [] )
$files array

convertFileInformation() protected method

Converts uploaded files to UploadedFile instances.
protected convertFileInformation ( array | Symfony\Component\HttpFoundation\File\UploadedFile $file ) : array
$file array | Symfony\Component\HttpFoundation\File\UploadedFile A (multi-dimensional) array of uploaded file information
return array A (multi-dimensional) array of UploadedFile instances

fixPhpFilesArray() protected method

PHP has a bug that the format of the $_FILES array differs, depending on whether the uploaded file fields had normal field names or array-like field names ("normal" vs. "parent[child]"). This method fixes the array to look like the "normal" $_FILES array. It's safe to pass an already converted array, in which case this method just returns the original array unmodified.
protected fixPhpFilesArray ( array $data ) : array
$data array
return array

replace() public method

(non-PHPdoc)
See also: Symfony\Component\HttpFoundation\ParameterBag::replace()
public replace ( array $files = [] )
$files array

set() public method

(non-PHPdoc)
See also: Symfony\Component\HttpFoundation\ParameterBag::set()
public set ( $key, $value )