protected function Client::filterFiles in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/http-kernel/Client.php \Symfony\Component\HttpKernel\Client::filterFiles()
Filters an array of files.
This method created test instances of UploadedFile so that the move() method can be called on those instances.
If the size of a file is greater than the allowed size (from php.ini) then an invalid UploadedFile is returned with an error set to UPLOAD_ERR_INI_SIZE.
Parameters
array $files An array of files:
Return value
array An array with all uploaded files marked as already moved
See also
1 call to Client::filterFiles()
- Client::filterRequest in vendor/
symfony/ http-kernel/ Client.php - Converts the BrowserKit request to a HttpKernel request.
File
- vendor/
symfony/ http-kernel/ Client.php, line 169
Class
- Client
- Client simulates a browser and makes requests to a Kernel object.
Namespace
Symfony\Component\HttpKernelCode
protected function filterFiles(array $files) {
$filtered = array();
foreach ($files as $key => $value) {
if (is_array($value)) {
$filtered[$key] = $this
->filterFiles($value);
}
elseif ($value instanceof UploadedFile) {
if ($value
->isValid() && $value
->getSize() > UploadedFile::getMaxFilesize()) {
$filtered[$key] = new UploadedFile('', $value
->getClientOriginalName(), $value
->getClientMimeType(), 0, UPLOAD_ERR_INI_SIZE, true);
}
else {
$filtered[$key] = new UploadedFile($value
->getPathname(), $value
->getClientOriginalName(), $value
->getClientMimeType(), $value
->getClientSize(), $value
->getError(), true);
}
}
}
return $filtered;
}