src/Bundle/Common/File/FileBag.php
private function convertFileInformation($file)
    {
        if ($file instanceof FileUpload) {
            return $file;
        }

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

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

        return $file;
    }
private function convertFileInformation($file)
    {
        if ($file instanceof FileUpload) {
            return $file;
        }

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

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

        return $file;
    }
private function convertFileInformation ( $ file ) { if ( $ file instanceof FileUpload ) { return $ file ; } $ file = $ this -> fixPhpFilesArray ( $ file ) ; if ( is_array ( $ file ) ) { $ keys = array_keys ( $ file ) ; sort ( $ keys ) ; if ( $ keys == [ 'error' , 'name' , 'size' , 'tmp_name' , 'type' ] ) { if ( UPLOAD_ERR_NO_FILE == $ file [ 'error' ] ) { $ file = null ; } else { $ file = new FileUpload ( $ file [ 'tmp_name' ] , $ file [ 'name' ] , $ file [ 'size' ] , $ file [ 'type' ] , $ file [ 'error' ] ) ; } } else { $ file = array_map ( [ $ this , 'convertFileInformation' ] , $ file ) ; } } return $ file ; }
Converts uploaded files to FileUpload instances.

@param array|FileUpload $file A (multi-dimensional) array of uploaded file information
@return array A (multi-dimensional) array of FileUpload instances
Converts uploaded files to FileUpload instances .