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;
    }
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;
    }
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 ; }
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
Convert a nested array of files to arrays .