function ChangeLogger::recordRequestedPackageVersions

Records requested packages.

Parameters

\Drupal\package_manager\Event\PostRequireEvent $event: The event object.

File

core/modules/package_manager/src/EventSubscriber/ChangeLogger.php, line 78

Class

ChangeLogger
Event subscriber to log changes that happen during the stage life cycle.

Namespace

Drupal\package_manager\EventSubscriber

Code

public function recordRequestedPackageVersions(PostRequireEvent $event) : void {
    // There could be multiple 'require' operations, so overlay the requested
    // packages from the current operation onto the requested packages from any
    // previous 'require' operation.
    $requested_packages = array_merge($event->stage
        ->getMetadata(static::REQUESTED_PACKAGES_KEY) ?? [], $event->getRuntimePackages(), $event->getDevPackages());
    $event->stage
        ->setMetadata(static::REQUESTED_PACKAGES_KEY, $requested_packages);
}

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