You are here

public function PluginHandler::createMergeFiles in Database Sanitize 7

Creates the merge files.

File

vendor/edisonlabs/merge-yaml/src/PluginHandler.php, line 99

Class

PluginHandler
Class PluginHandler.

Namespace

EdisonLabs\MergeYaml

Code

public function createMergeFiles() {
  if (!$this->isConfigured) {
    $this->io
      ->write('> WARNING: merge-yaml is not configured', true);
    return;
  }
  $mergeYaml = new MergeYaml($this->fileNamePatterns, $this->sourcePaths, $this->outputDir);
  $processedFiles = $mergeYaml
    ->createMergeFiles();
  if (empty($processedFiles)) {
    $this->io
      ->write('> merge-yaml: No merge files have been created', true);
    return;
  }
  foreach ($processedFiles as $fileName => $filePaths) {
    foreach ($filePaths as $filePath) {
      $this->io
        ->write("> merge-yaml: Merging {$filePath}", true);
    }
    $outputDir = $this->outputDir;
    $this->io
      ->write("> merge-yaml: Merged in {$outputDir}/{$fileName}.merge.yml", true);
  }
}