You are here

protected function SidecarMetadataDestinationTrait::arrayToIni in Backup and Migrate 5.0.x

Parameters

$data:

string $prefix:

Return value

string

1 call to SidecarMetadataDestinationTrait::arrayToIni()
SidecarMetadataDestinationTrait::saveTheFileMetadata in src/Core/Destination/SidecarMetadataDestinationTrait.php

File

src/Core/Destination/SidecarMetadataDestinationTrait.php, line 107

Class

SidecarMetadataDestinationTrait
Store extended meta data in a sidecar file.

Namespace

Drupal\backup_migrate\Core\Destination

Code

protected function arrayToIni($data, $prefix = '') {
  $content = "";
  foreach ($data as $key => $val) {
    if ($prefix) {
      $key = $prefix . '[' . $key . ']';
    }
    if (is_array($val)) {
      $content .= $this
        ->arrayToIni($val, $key);
    }
    else {
      $content .= $key . " = \"" . $val . "\"\n";
    }
  }
  return $content;
}