You are here

protected function ProjectInfoTrait::getProjectName in Automatic Updates 8

Get the extension's project name.

Parameters

string $extension_name: The extension name.

array $info: The extension's info.

Return value

string The project name or fallback to extension name if project is undefined.

3 calls to ProjectInfoTrait::getProjectName()
ProjectInfoTestClass::getProjectName in tests/src/Kernel/ProjectInfoTraitTest.php
ProjectInfoTrait::getInfos in src/ProjectInfoTrait.php
Returns an array of info files information of available extensions.
TestMissingProjectInfo::getInfos in tests/src/Kernel/ReadinessChecker/MissingProjectInfoTest.php
Returns an array of info files information of available extensions.

File

src/ProjectInfoTrait.php, line 97

Class

ProjectInfoTrait
Provide a helper to get project info.

Namespace

Drupal\automatic_updates

Code

protected function getProjectName($extension_name, array $info) {
  $project_name = $extension_name;
  if (isset($info['project'])) {
    $project_name = $info['project'];
  }
  elseif ($composer_json = $this
    ->getComposerJson($extension_name, $info)) {
    if (isset($composer_json['name'])) {
      $project_name = $this
        ->getSuffix($composer_json['name'], '/', $extension_name);
    }
  }
  if (strpos($info['install path'], 'core') === 0) {
    $project_name = 'drupal';
  }
  return $project_name;
}