You are here

private static function ServerRequestFactory::normalizeNestedFileSpec in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-diactoros/src/ServerRequestFactory.php \Zend\Diactoros\ServerRequestFactory::normalizeNestedFileSpec()

Normalize an array of file specifications.

Loops through all nested files and returns a normalized array of UploadedFileInterface instances.

Parameters

array $files:

Return value

UploadedFileInterface[]

1 call to ServerRequestFactory::normalizeNestedFileSpec()
ServerRequestFactory::createUploadedFileFromSpec in vendor/zendframework/zend-diactoros/src/ServerRequestFactory.php
Create and return an UploadedFile instance from a $_FILES specification.

File

vendor/zendframework/zend-diactoros/src/ServerRequestFactory.php, line 443

Class

ServerRequestFactory
Class for marshaling a request object from the current PHP environment.

Namespace

Zend\Diactoros

Code

private static function normalizeNestedFileSpec(array $files = []) {
  $normalizedFiles = [];
  foreach (array_keys($files['tmp_name']) as $key) {
    $spec = [
      'tmp_name' => $files['tmp_name'][$key],
      'size' => $files['size'][$key],
      'error' => $files['error'][$key],
      'name' => $files['name'][$key],
      'type' => $files['type'][$key],
    ];
    $normalizedFiles[$key] = self::createUploadedFileFromSpec($spec);
  }
  return $normalizedFiles;
}