Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Plugin.php

function Plugin::updateComposerJson

1 call to Plugin::updateComposerJson()
Plugin::postUpdate in vendor/php-http/discovery/src/Composer/Plugin.php

File

vendor/php-http/discovery/src/Composer/Plugin.php, line 433

Class

Plugin
Auto-installs missing implementations.

Namespace

Http\Discovery\Composer

Code

private function updateComposerJson(array $missingRequires, bool $sortPackages) {
    $file = Factory::getComposerFile();
    $contents = file_get_contents($file);
    $manipulator = new JsonManipulator($contents);
    foreach ($missingRequires as $key => $packages) {
        foreach ($packages as $package => $constraint) {
            if ('remove' === $key) {
                $manipulator->removeSubNode('require-dev', $package);
            }
            else {
                $manipulator->addLink($key, $package, $constraint, $sortPackages);
            }
        }
    }
    file_put_contents($file, $manipulator->getContents());
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal