SymfonyComponentHttpFoundationFileBag

FileBag is a container for HTTP headers.

File
vendorSymfonyComponentHttpFoundationFileBag.php
Package
Default
Class hierarchy
SymfonyComponentHttpFoundationFileBag

Tags

author

Fabien Potencier fabien@symfony.com

Bulat Shakirzyanov mallluhuct@gmail.com

api

Properties

$parameters

$parameters : array

Parameter storage.

Type

array

Inherited from
SymfonyComponentHttpFoundationParameterBag

Tags

None found

$fileKeys

$fileKeys : 

Type

Tags

None found

Methods

__construct()

__construct(array  $parameters = array()) 

Constructor.

Parameters

array $parameters

An array of HTTP files

Tags

api

all()

all() : array

Returns the parameters.

Returns

array —

An array of parameters

keys()

keys() : array

Returns the parameter keys.

Returns

array —

An array of parameter keys

replace()

replace(array  $files = array()) 

Replaces the current parameters by a new set.

Parameters

array $files

Tags

api

add()

add(array  $files = array()) 

Adds parameters.

Parameters

array $files

Tags

api

get()

get(string  $path, mixed  $default = null, boolean  $deep = false) : mixed

Returns a parameter by name.

Parameters

string $path

The key

mixed $default

The default value if the parameter key does not exist

boolean $deep

If true, a path like foo[bar] will find deeper items

Throws

InvalidArgumentException

Returns

mixed

set()

set(string  $key, mixed  $value) 

Sets a parameter by name.

Parameters

string $key

The key

mixed $value

The value

Tags

api

has()

has(string  $key) : Boolean

Returns true if the parameter is defined.

Parameters

string $key

The key

Returns

Boolean —

true if the parameter exists, false otherwise

remove()

remove(string  $key) 

Removes a parameter.

Parameters

string $key

The key

getAlpha()

getAlpha(string  $key, mixed  $default = '', boolean  $deep = false) : string

Returns the alphabetic characters of the parameter value.

Parameters

string $key

The parameter key

mixed $default

The default value if the parameter key does not exist

boolean $deep

If true, a path like foo[bar] will find deeper items

Returns

string —

The filtered value

getAlnum()

getAlnum(string  $key, mixed  $default = '', boolean  $deep = false) : string

Returns the alphabetic characters and digits of the parameter value.

Parameters

string $key

The parameter key

mixed $default

The default value if the parameter key does not exist

boolean $deep

If true, a path like foo[bar] will find deeper items

Returns

string —

The filtered value

getDigits()

getDigits(string  $key, mixed  $default = '', boolean  $deep = false) : string

Returns the digits of the parameter value.

Parameters

string $key

The parameter key

mixed $default

The default value if the parameter key does not exist

boolean $deep

If true, a path like foo[bar] will find deeper items

Returns

string —

The filtered value

getInt()

getInt(string  $key, mixed  $default, boolean  $deep = false) : integer

Returns the parameter value converted to integer.

Parameters

string $key

The parameter key

mixed $default

The default value if the parameter key does not exist

boolean $deep

If true, a path like foo[bar] will find deeper items

Returns

integer —

The filtered value

filter()

filter(string  $key, mixed  $default = null, boolean  $deep = false, integer  $filter = FILTER_DEFAULT, mixed  $options = array()) : mixed

Filter key.

Parameters

string $key

Key.

mixed $default

Default = null.

boolean $deep

Default = false.

integer $filter

FILTER_* constant.

mixed $options

Filter options.

Returns

mixed

Inherited from
SymfonyComponentHttpFoundationParameterBag
See also

Tags

None found

getIterator()

getIterator() : \ArrayIterator

Returns an iterator for parameters.

Returns

ArrayIterator —

An ArrayIterator instance

Inherited from
SymfonyComponentHttpFoundationParameterBag

Tags

None found

count()

count() : integer

Returns the number of parameters.

Returns

integer —

The number of parameters

Inherited from
SymfonyComponentHttpFoundationParameterBag

Tags

None found

convertFileInformation()

convertFileInformation(array|\Symfony\Component\HttpFoundation\File\UploadedFile  $file) : array

Converts uploaded files to UploadedFile instances.

Parameters

array|SymfonyComponentHttpFoundationFileUploadedFile $file

A (multi-dimensional) array of uploaded file information

Returns

array —

A (multi-dimensional) array of UploadedFile instances

Tags

None found

fixPhpFilesArray()

fixPhpFilesArray(array  $data) : array

Fixes a malformed PHP $_FILES array.

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.

Parameters

array $data

Returns

array

Tags

None found