original_string: protected function _processFiles($post, $files)
      {
          if (!is_array($files)) {
              return $post;
          }
          $fileData = [];
          foreach ($files as $key => $value) {
              if ($value instanceof UploadedFileInterface) {
                  $fileData[$key] = $value;
                  continue;
              }
  
              if (is_array($value) && isset($value['tmp_name'])) {
                  $fileData[$key] = $this->_createUploadedFile($value);
                  continue;
              }
  
              throw new InvalidArgumentException(sprintf(
                  'Invalid value in FILES "%s"',
                  json_encode($value)
              ));
          }
          $this->uploadedFiles = $fileData;
  
          // Make a flat map that can be inserted into $post for BC.
          $fileMap = Hash::flatten($fileData);
          foreach ($fileMap as $key => $file) {
              $error = $file->getError();
              $tmpName = '';
              if ($error === UPLOAD_ERR_OK) {
                  $tmpName = $file->getStream()->getMetadata('uri');
              }
              $post = Hash::insert($post, $key, [
                  'tmp_name' => $tmpName,
                  'error' => $error,
                  'name' => $file->getClientFilename(),
                  'type' => $file->getClientMediaType(),
                  'size' => $file->getSize(),
              ]);
          }
  
          return $post;
      }
code: protected function _processFiles($post, $files)
      {
          if (!is_array($files)) {
              return $post;
          }
          $fileData = [];
          foreach ($files as $key => $value) {
              if ($value instanceof UploadedFileInterface) {
                  $fileData[$key] = $value;
                  continue;
              }
  
              if (is_array($value) && isset($value['tmp_name'])) {
                  $fileData[$key] = $this->_createUploadedFile($value);
                  continue;
              }
  
              throw new InvalidArgumentException(sprintf(
                  'Invalid value in FILES "%s"',
                  json_encode($value)
              ));
          }
          $this->uploadedFiles = $fileData;
  
          // Make a flat map that can be inserted into $post for BC.
          $fileMap = Hash::flatten($fileData);
          foreach ($fileMap as $key => $file) {
              $error = $file->getError();
              $tmpName = '';
              if ($error === UPLOAD_ERR_OK) {
                  $tmpName = $file->getStream()->getMetadata('uri');
              }
              $post = Hash::insert($post, $key, [
                  'tmp_name' => $tmpName,
                  'error' => $error,
                  'name' => $file->getClientFilename(),
                  'type' => $file->getClientMediaType(),
                  'size' => $file->getSize(),
              ]);
          }
  
          return $post;
      }
code_tokens: protected function _processFiles ( $ post , $ files ) { if ( ! is_array ( $ files ) ) { return $ post ; } $ fileData = [ ] ; foreach ( $ files as $ key => $ value ) { if ( $ value instanceof UploadedFileInterface ) { $ fileData [ $ key ] = $ value ; continue ; } if ( is_array ( $ value ) && isset ( $ value [ 'tmp_name' ] ) ) { $ fileData [ $ key ] = $ this -> _createUploadedFile ( $ value ) ; continue ; } throw new InvalidArgumentException ( sprintf ( 'Invalid value in FILES "%s"' , json_encode ( $ value ) ) ) ; } $ this -> uploadedFiles = $ fileData ; // Make a flat map that can be inserted into $post for BC. $ fileMap = Hash :: flatten ( $ fileData ) ; foreach ( $ fileMap as $ key => $ file ) { $ error = $ file -> getError ( ) ; $ tmpName = '' ; if ( $ error === UPLOAD_ERR_OK ) { $ tmpName = $ file -> getStream ( ) -> getMetadata ( 'uri' ) ; } $ post = Hash :: insert ( $ post , $ key , [ 'tmp_name' => $ tmpName , 'error' => $ error , 'name' => $ file -> getClientFilename ( ) , 'type' => $ file -> getClientMediaType ( ) , 'size' => $ file -> getSize ( ) , ] ) ; } return $ post ; }
docstring: Process uploaded files and move things onto the post data.
  
  @param array $post Post data to merge files onto.
  @param array $files Uploaded files to merge in.
  @return array merged post + file data.
docstring_tokens: Process uploaded files and move things onto the post data .