You are here

public function MergeYaml::createMergeFiles in Database Sanitize 7

Create the merge files.

Return value

array Returns the processed files.

File

vendor/edisonlabs/merge-yaml/src/MergeYaml.php, line 106

Class

MergeYaml
Main class for merge-yaml.

Namespace

EdisonLabs\MergeYaml

Code

public function createMergeFiles() {

  // Check if the output directory exists and try to create it if it doesn't.
  $this
    ->prepareOutputDir();
  $ymlFilesPaths = $this
    ->getYamlFiles();
  if (empty($ymlFilesPaths)) {

    // No valid Yaml files were found.
    return array();
  }
  foreach ($ymlFilesPaths as $fileName => $filePaths) {
    $outputFileName = $fileName . '.merge.yml';
    $yaml = $this
      ->getMergedYmlContent($filePaths);

    // Save file.
    file_put_contents($this->outputDir . '/' . $outputFileName, $yaml);
  }
  return $ymlFilesPaths;
}