Symfony\Component\HttpFoundation\FileBag::convertFileInformation PHP Méthode

convertFileInformation() protected méthode

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
Résultat array A (multi-dimensional) array of UploadedFile instances
    protected function convertFileInformation($file)
    {
        if ($file instanceof UploadedFile) {
            return $file;
        }

        $file = $this->fixPhpFilesArray($file);
        if (is_array($file)) {
            $keys = array_keys($file);
            sort($keys);

            if ($keys == self::$fileKeys) {
                if (UPLOAD_ERR_NO_FILE == $file['error']) {
                    $file = null;
                } else {
                    $file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error']);
                }
            } else {
                $file = array_map(array($this, 'convertFileInformation'), $file);
            }
        }

        return $file;
    }