function RootComposer::checkRootPackage

Checks that the composer content and root package match.

Parameters

string $composer_content: The root composer content.

\Composer\Package\RootPackageInterface $root_package: The root package.

Return value

bool TRUE if the composer content and root package match, FALSE if not.

1 call to RootComposer::checkRootPackage()
RootComposer::writeFiles in composer/Plugin/RecipeUnpack/RootComposer.php
Writes the root composer files.

File

composer/Plugin/RecipeUnpack/RootComposer.php, line 156

Class

RootComposer
Provides access to and manipulation of the root composer files.

Namespace

Drupal\Composer\Plugin\RecipeUnpack

Code

private static function checkRootPackage(string $composer_content, RootPackageInterface $root_package) : bool {
    $composer = JsonFile::parseJson($composer_content);
    return empty(array_diff_key($root_package->getRequires(), $composer['require'] ?? [])) && empty(array_diff_key($root_package->getDevRequires(), $composer['require-dev'] ?? []));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.