Normalizes a nested array.

@param array $files The nested array

@return array Normalized array
431566
protected static function normalizeNested(array $files)
    {
        $normalized = [];
        foreach (array_keys($files['tmp_name']) as $key) {
            $spec = [
                'name'     => $files['name'][$key],
                'tmp_name' => $files['tmp_name'][$key],
                'type'     => $files['type'][$key],
                'size'     => $files['size'][$key],
                'error'    => $files['error'][$key],
            ];
            $normalized[$key] = static::build($spec);
        }

        return $normalized;
    }
717582
protected static function getFlattenFileData(array $files = [])
    {
        $return = [];

        foreach (array_keys($files['tmp_name']) as $key) {
            $file = [
                'tmp_name' => $files['tmp_name'][$key],
                'size' => $files['size'][$key],
                'error' => $files['error'][$key],
                'name' => $files['name'][$key],
                'type' => $files['type'][$key],
            ];

            $return[$key] = self::createUploadedFile($file);
        }

        return $return;
    }
934371
public static function normalizeMap($array)
    {
        $nested = array();

        foreach ((array) $array as $key=>$value) {
            if (is_numeric($key)) {
                $nested[$value] = array();
            } else {
                $nested[$key] = $value;
            }
        }

        return $nested;
    }
759871
public function createUploadedFiles(array $files){
        $instances = [];

        foreach($files as $name => $value){
            if($value instanceof UploadedFileInterface){
                $instances[$name]  = $value;
                continue;
            }

            if(!is_array($value)){
                $class  = UploadedFileInterface::class;

                throw new \InvalidArgumentException(
                    "The file list must be an associative array whose value is"
                    . " an instance of a class implementing {$class} or an array"
                    . " having file information."
                    . " But the value of index A does not apply to them."
                );
            }

            $instances[$name]  = isset($value["error"]) && isset($value["tmp_name"])
                ? $this->createUploadedFileWithNest($value)
                : $this->createUploadedFiles($value)
            ;
        }

        return $instances;
    }
1358817
public function ignoreFiles($files) {
		if (! is_array ( $files )) {
			$files = func_get_args ();
		}
		$this->begin ();
		$this->run ( 'git reset', NULL, [ "--" => $files ] );
		return $this->end ();
	}
428812
protected function filterFiles(array $files)
    {
        $files = parent::filterFiles($files);

        if (! class_exists('Illuminate\Http\UploadedFile')) {
            // The \Illuminate\Http\UploadedFile class was introduced in Laravel 5.2.15,
            // so don't change the $files array if it does not exist.
            return $files;
        }

        return $this->convertToTestFiles($files);
    }
1179985
public function requireFiles(array $files)
    {
        $path = $this->getPath();
        foreach ($files as $file) {
            $this->laravel['files']->requireOnce($path . '/' . $file . '.php');
        }
    }
1295210
public function setFiles(array $files)
    {
        $this->files = array();
        foreach ($files as $key => $file) {
            if (!is_array($file)) {
                $file = array('content' => $file);
            }

            $file = array_merge(array(
                'content' => null,
                'mtime' => null,
            ), $file);

            $this->setFile($key, $file['content'], $file['mtime']);
        }
    }
361799
protected static function normalize(array $files)
    {
        $normalized = [];
        foreach ($files as $key => $value) {
            if ($value instanceof UploadedFileInterface) {
                $normalized[$key] = $value;

                continue;
            }

            if (! is_array($value)) {
                throw new InvalidArgumentException(
                    'Invalid value in files specification.'
                );
            }

            if (isset($value['tmp_name'])) {
                $normalized[$key] = static::build($value);

                continue;
            }

            $normalized[$key] = static::normalize($value);
        }

        return $normalized;
    }
850044
private function loadFiles($files)
    {
        if (is_dir($files)) {
            $directory = realpath($files);
            $files     = [];
            $brains    = glob($directory.'/*.rive');

            foreach ($brains as $brain) {
                $files[] = $brain;
            }

            return $files;
        }

        return (array) $files;
    }
31950
public function load(array $files = array())
    {
        $loader = new YamlLoader(new FileLocator, new YamlParser);

        foreach ($files as $file) {
            $configValues = $loader->load($file);

            $configValues = $this->loadImports($loader, $file, $configValues);

            $this->params = array_replace_recursive($this->params, $configValues);
        }
    }
1359152
public function createUploadedFileFromServer(array $files)
        {
            $normalized = [];
            foreach ($files as $key => $value) {
                
                if (!isset($value['error'])) {
                    if (is_array($value)) {
                        $normalized[$key] = $this->createUploadedFileFromServer($value);
                    }
                    continue;
                }
                
                $normalized[$key] = [];
                if (!is_array($value['error'])) {

                    if ($value['error'] === 4) {
                        $stream = (new StreamFactory)->createStream('');
                    } else {
                        $stream = (new StreamFactory)->createStreamFromFile($value['tmp_name'], 'r');    
                    }
                    
                    $normalized[$key] = $this->createUploadedFile(
                        $stream,
                        $value['size'],
                        $value['error'],
                        $value['name'],
                        $value['type']
                    );

                } else {

                    $sub = [];
                    foreach ($value['error'] as $id => $error) {
   
                        $sub[$id]['name']     = $value['name'][$id];
                        $sub[$id]['type']     = $value['type'][$id];
                        $sub[$id]['tmp_name'] = $value['tmp_name'][$id];
                        $sub[$id]['error']    = $value['error'][$id];
                        $sub[$id]['size']     = $value['size'][$id];
                        
                        $normalized[$key] = $this->createUploadedFileFromServer($sub);
                    
                    }

                }

            }
            return $normalized;
        }
1232244
private function hydrateAll(array $files)
    {
        foreach ($files as $name => $file) {
            // Recursive protection
            if (!is_array($file)) {
                continue;
            }

            foreach ($file as $key => $value) {
                if (is_array($value)) {
                    // Recursive call
                    $files[$name] = call_user_func(array($this, __FUNCTION__), $files[$name]);
                } else {
                    $files[$name] = $this->hydrate($file);
                }
            }
        }

        return $files;
    }
625534
protected function prepareUploadedFiles($files)
    {
        $fileKeys = ['error', 'name', 'size', 'tmp_name', 'type'];
        $reformatFiles = new ReformatUploadedFiles($files);

        $output = [];
        foreach ($reformatFiles as $key => $value) {
            $keys = array_keys($value);
            sort($keys);

            if ($fileKeys == $keys && is_array($value['tmp_name'])) {
                $output[$key] = $this->prepareUploadedFiles($reformatFiles[$key]);
                continue;
            }

            $output[$key] = new UploadedFile(
                $value['tmp_name'],
                $value['error'],
                $value['name'],
                $value['type'],
                $value['size']
            );
        }

        return $output;
    }
1196557
private function isValidFileList(array $files)
    {
        Assertion::notEmpty($files, 'Files array can\'t be empty');

        $valid = false;

        foreach ($files as $file) {
            if ($this->isFileExisting($file)) {
                $valid = true;
            }
        }

        return $valid;
    }
347348
protected function getFiles(array $files)
    {
        $filesEntity = [];

        foreach ($files as $file) {
            $filesEntity[] = new File($file);
        }

        return $filesEntity;
    }
362379
protected function cleanup(array $files = array())
    {
        if (empty($files)) {
            return $this;
        }
        foreach ($files as $file) {
            if (!file_exists($file->name)) {
                continue;
            }
            unlink($file->name);
        }
        return $this;
    }