You are here

protected function MergePlugin::mergeFile in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/wikimedia/composer-merge-plugin/src/MergePlugin.php \Wikimedia\Composer\MergePlugin::mergeFile()

Read a JSON file and merge its contents

Parameters

RootPackageInterface $root:

string $path:

1 call to MergePlugin::mergeFile()
MergePlugin::mergeFiles in vendor/wikimedia/composer-merge-plugin/src/MergePlugin.php
Find configuration files matching the configured glob patterns and merge their contents with the master package.

File

vendor/wikimedia/composer-merge-plugin/src/MergePlugin.php, line 197

Class

MergePlugin
Composer plugin that allows merging multiple composer.json files.

Namespace

Wikimedia\Composer

Code

protected function mergeFile(RootPackageInterface $root, $path) {
  if (isset($this->loadedFiles[$path])) {
    $this->logger
      ->debug("Already merged <comment>{$path}</comment>");
    return;
  }
  else {
    $this->loadedFiles[$path] = true;
  }
  $this->logger
    ->info("Loading <comment>{$path}</comment>...");
  $package = new ExtraPackage($path, $this->composer, $this->logger);
  $package
    ->mergeInto($root, $this->state);
  if ($this->state
    ->recurseIncludes()) {
    $this
      ->mergeFiles($package
      ->getIncludes(), false);
    $this
      ->mergeFiles($package
      ->getRequires(), true);
  }
}