You are here

protected function SecurityAdvisoriesFetcher::getMatchingExtensionInfo in Drupal 10

Same name and namespace in other branches
  1. 9 core/modules/system/src/SecurityAdvisories/SecurityAdvisoriesFetcher.php \Drupal\system\SecurityAdvisories\SecurityAdvisoriesFetcher::getMatchingExtensionInfo()

Gets the information for an extension affected by the security advisory.

Parameters

\Drupal\system\SecurityAdvisories\SecurityAdvisory $sa: The security advisory.

Return value

mixed[]|null The information as set in the info.yml file and then processed by the corresponding extension list for the first extension found that matches the project name of the security advisory. If no matching extension is found NULL is returned.

2 calls to SecurityAdvisoriesFetcher::getMatchingExtensionInfo()
SecurityAdvisoriesFetcher::getProjectExistingVersion in core/modules/system/src/SecurityAdvisories/SecurityAdvisoriesFetcher.php
Gets the existing project version.
SecurityAdvisoriesFetcher::isApplicable in core/modules/system/src/SecurityAdvisories/SecurityAdvisoriesFetcher.php
Determines if a security advisory is applicable for the current site.

File

core/modules/system/src/SecurityAdvisories/SecurityAdvisoriesFetcher.php, line 242

Class

SecurityAdvisoriesFetcher
Defines a service to get security advisories.

Namespace

Drupal\system\SecurityAdvisories

Code

protected function getMatchingExtensionInfo(SecurityAdvisory $sa) : ?array {
  if (!isset($this->extensionLists[$sa
    ->getProjectType()])) {
    return NULL;
  }
  $project_info = new ProjectInfo();

  // The project name on the security advisory will not always match the
  // machine name for the extension, so we need to search through all
  // extensions of the expected type to find the matching project.
  foreach ($this->extensionLists[$sa
    ->getProjectType()]
    ->getList() as $extension) {
    if ($project_info
      ->getProjectName($extension) === $sa
      ->getProject()) {
      return $extension->info;
    }
  }
  return NULL;
}