Parcours de la variable superglobale $_FILES parsée pour remplacer
les informations de fichier en instances de UploadedFileInterface.

@param array $files Variable superglobale $_FILES parsée.

@return UploadedFileInterface[]
514221
private static function normaliseUplaod(array $files)
    {
        $output = [];
        foreach ($files as $key => $value) {
            if ($value instanceof UploadedFileInterface) {
                $output[ $key ] = $value;
            } elseif (is_array($value) && isset($value[ 'tmp_name' ])) {
                $output[ $key ] = UploadedFile::create($value);
            } elseif (is_array($value)) {
                $output[ $key ] = self::normaliseUplaod($value);
            } else {
                throw new \InvalidArgumentException('The input parameter is not in the correct format.');
            }
        }

        return $output;
    }
166798
public function registerFiles($files)
    {
        foreach ((array)$files as $file) {
            if (isset($this->_files[$file])) {
                continue;
            }

            if ($file[0] === '@') {
                $file = Di::getDefault()->getShared('alias')->resolve($file);
            }
            $this->_files[$file] = 1;

            /** @noinspection PhpIncludeInspection */
            require $file;
        }

        return $this;
    }
990561
public function createForDocumentation(array $files): array
    {
        if (in_array(Constants::TEST_TYPE_DOCUMENTATION, $this->types)) {
            $definitions = [];
            foreach ($files as $file) {
                $key = $this->getTestGroupNameForDocumentationFile($file);
                $definitions[$key] = $this->collectDefinitionsForFile($file);
            }

            return $definitions;
        }

        return [];
    }
1250536
public function setFiles($files = array())
    {
        if (count($files) === 0) {
            $this->_files = $_FILES;
        } else {
            $this->_files = $files;
        }
        return $this;
    }
437345
public function loadFiles($files)
    {
        $files = (array) $files;

        $success = true;
        foreach ($files as $file) {

            $this->loadFile($file);
        }
        return true;
    }
703478
public function getCombines(array $files)
    {
        $superset    = $files;
        $combinedSet = array();
        $combines    = array();

        $combinesInfo = $this->getCombinesInfo();
        foreach ($combinesInfo as $combine => $combineInfo) {
            $combinedFiles = array_keys($combineInfo['Includes']);

            // check if combine does not conflict with already added combines
            // and if combine contains one or more files in the required file
            // list
            if (count(array_intersect($combinedFiles, $combinedSet)) === 0
                && count(array_intersect($combinedFiles, $files)) > 0
            ) {
                $potentialSuperset = array_merge($superset, $combinedFiles);

                // make sure combining will not introduce conflicts
                if (count($this->getConflicts($potentialSuperset)) === 0) {
                    $combinedSet = array_merge($combinedSet, $combinedFiles);
                    $superset    = $potentialSuperset;
                    $combines[]   = $combine;
                }
            }

        }

        // remove dupes from superset caused by combines
        $superset = array_unique($superset);

        // exclude contents of combined sets from file list
        foreach ($combines as $combine) {
            $files = array_diff(
                $files,
                array_keys($combinesInfo[$combine]['Includes'])
            );

            $files[] = $combine;
        }

        $info = array(
            // 'combines' contains the combined files that will be included.
            'combines' => $combines,

            // 'superset' contains all original files plus files pulled in by
            // the combined sets. The content of these files will be included.
            'superset' => $superset,

            // 'files' contains combined files and files in the original set
            // that did not fit in any combined set. These are the actual files
            // that will be included.
            'files'    => $files,
        );

        return $info;
    }
896249
protected static function normalizeUploadedFiles(array $uploadedFiles)
    {
        $files = [];

        foreach ($uploadedFiles as $key => $value) {

            if ($value instanceof UploadedFileInterface) {

                $files[$key] = $value;

            } elseif (is_array($value) && isset($value['tmp_name'])) {

                $files[$key] = static::createUploadedFileFromSpec($value);

            } elseif (is_array($value)) {
                
                $files[$key]  = static::normalizeUploadedFiles($value);

            } else {

                throw new \InvalidArgumentException('Invalid uploaded files value');
            }
        }

        return $files;
    }
553050
public static function loadRoutingFiles(array $files)
    {
        $routing = new Structure();

        foreach ($files as $file) {
            if (!in_array(pathinfo($file, PATHINFO_EXTENSION), ['json', 'yml', 'yaml'])) {
                continue;
            }

            $routing = $routing->loadFile($file, pathinfo($file, PATHINFO_EXTENSION));
        }

        return $routing->toArray();
    }
607083
private function SortFilesByVersion(array $files)
    {
        $result = array();
        $foreignKeysFile = '';
        foreach ($files as $file)
        {
            if ($file == 'foreign-keys.sql')
            {
                $foreignKeysFile = $file;
                continue;
            }
            $version = Path::RemoveExtension($file);
            if ($this->installedVersion && version_compare($version, $this->installedVersion) <= 0)
            {
                continue;
            }
            $result[$version] = $file;
        }
        uksort($result, "version_compare");
        if ($foreignKeysFile)
        {
            $result[] = $foreignKeysFile;
        }
        return $result;
    }
614607
public function write(array $files)
    {
        $filesystem = $this->getFilesystem($this->field, $this->settings);
        $results = [];
        foreach ($files as $file => $path) {
            $results[] = $this->writeFile($filesystem, $file, $path);
        }

        return $results;
    }
1152698
private static function normalizeSuperglobal(array $files) : array
    {
        $result = [];

        foreach ($files as $file) {
            $keys = array_keys($file);

            if (is_array($keys)) {
                foreach ($keys as $key) {
                    $result[$key] = [];
                    foreach ($files as $index => $file) {
                        $result[$key][$index] = $file[$key];
                    }
                }
            }

            // Only one of the entries was needed to get the PHP upload keys (name, tmp_name, etc.).
            break;
        }

        return $result;
    }
486880
protected function setFiles(array $files)
    {
        foreach ($files as $associativeName => $details) {
            foreach ($details as $fileKey => $detail) {
                $this->files[$fileKey][$associativeName] = $detail;
            }
        }
    }
33810
public function decodeFiles(array $files)
    {
        // combine into one document.
        //
        $suiteDocument = new Document('phpbench');
        $rootEl = $suiteDocument->createRoot('phpbench');

        foreach ($files as $file) {
            $fileDom = new Document();
            $fileDom->load($file);

            foreach ($fileDom->query('./suite') as $suiteEl) {
                $importedEl = $suiteDocument->importNode($suiteEl, true);
                $rootEl->appendChild($importedEl);
            }
        }

        return $this->decode($suiteDocument);
    }
181189
public static function normalizeFilesArray(array $files): array
    {
        $return = [];
        foreach ($files as $i => $file) {
            foreach ($file as $key => $value) {
                $return[$key][$i] = $value;
            }
        }

        return $return;
    }
1310988
private function getFiles(array $uploadedFiles)
    {
        $files = [];

        foreach ($uploadedFiles as $key => $value) {
            if (null === $value) {
                $files[$key] = new DiactorosUploadedFile(null, 0, UPLOAD_ERR_NO_FILE, null, null);
                continue;
            }
            if ($value instanceof UploadedFile) {
                $files[$key] = $this->createUploadedFile($value);
            } else {
                $files[$key] = $this->getFiles($value);
            }
        }

        return $files;
    }
1144220
public function attach(array $files)
    {
        foreach ($files as $key => $file) {
            if (is_array($file)) {
                $file = new UploadedFile($file['path'], basename($file['path']), $file['mime'], $file['size']);
            } elseif (is_string($file)) {
                $finfo = finfo_open(FILEINFO_MIME_TYPE);

                $file = new UploadedFile($file, basename($file), finfo_file($finfo, $file), $this->files->size($file));
            } elseif (! $file instanceof UploadedFile) {
                continue;
            }

            $this->uploads[$key] = $file;
        }

        return $this;
    }
126813
public function build(array $files)
    {
        $processed = array();

        foreach ($files as $file) {
            if ($this->parser->supports($file)) {
                $metadata = $this->parser->parse($file);
                $map = $this->buildMap($metadata);

                $processed[$map->getClass()] = $map;
            }
        }

        return $processed;
    }