original_string: protected static function convertFiles($data, $files, $path = '')
      {
          foreach ($files as $key => $file) {
              $newPath = $path;
              if ($newPath === '') {
                  $newPath = $key;
              }
              if ($newPath !== $key) {
                  $newPath .= '.' . $key;
              }
  
              if (is_array($file)) {
                  $data = static::convertFiles($data, $file, $newPath);
              } else {
                  $data = Hash::insert($data, $newPath, static::convertFile($file));
              }
          }
  
          return $data;
      }
code: protected static function convertFiles($data, $files, $path = '')
      {
          foreach ($files as $key => $file) {
              $newPath = $path;
              if ($newPath === '') {
                  $newPath = $key;
              }
              if ($newPath !== $key) {
                  $newPath .= '.' . $key;
              }
  
              if (is_array($file)) {
                  $data = static::convertFiles($data, $file, $newPath);
              } else {
                  $data = Hash::insert($data, $newPath, static::convertFile($file));
              }
          }
  
          return $data;
      }
code_tokens: protected static function convertFiles ( $ data , $ files , $ path = '' ) { foreach ( $ files as $ key => $ file ) { $ newPath = $ path ; if ( $ newPath === '' ) { $ newPath = $ key ; } if ( $ newPath !== $ key ) { $ newPath .= '.' . $ key ; } if ( is_array ( $ file ) ) { $ data = static :: convertFiles ( $ data , $ file , $ newPath ) ; } else { $ data = Hash :: insert ( $ data , $ newPath , static :: convertFile ( $ file ) ) ; } } return $ data ; }
docstring: Convert a nested array of files to arrays.
  
  @param array $data The data to add files to.
  @param array $files The file objects to convert.
  @param string $path The current array path.
  @return array Converted file data
docstring_tokens: Convert a nested array of files to arrays .