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

Breadcrumb

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

function ComposerRepository::initializePartialPackages

This initializes the packages key of a partial packages.json that contain some packages inlined + a providers-lazy-url

This should only be called once

1 call to ComposerRepository::initializePartialPackages()
ComposerRepository::hasPartialPackages in vendor/composer/composer/src/Composer/Repository/ComposerRepository.php

File

vendor/composer/composer/src/Composer/Repository/ComposerRepository.php, line 1744

Class

ComposerRepository
@author Jordi Boggiano <j.boggiano@seld.be>

Namespace

Composer\Repository

Code

private function initializePartialPackages() : void {
    $rootData = $this->loadRootServerFile();
    if ($rootData === true) {
        return;
    }
    $this->partialPackagesByName = [];
    foreach ($rootData['packages'] as $package => $versions) {
        foreach ($versions as $version) {
            $versionPackageName = strtolower((string) ($version['name'] ?? ''));
            $this->partialPackagesByName[$versionPackageName][] = $version;
            if (!$this->displayedWarningAboutNonMatchingPackageIndex && $versionPackageName !== strtolower($package)) {
                $this->io
                    ->writeError(sprintf("<warning>Warning: the packages key '%s' doesn't match the name defined in the package metadata '%s' in repository %s</warning>", $package, $version['name'] ?? '', $this->baseUrl));
                $this->displayedWarningAboutNonMatchingPackageIndex = true;
            }
        }
    }
    // wipe rootData as it is fully consumed at this point and this saves some memory
    $this->rootData = true;
}
RSS feed
Powered by Drupal