You are here

public static function Updater::getProjectName in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Updater/Updater.php \Drupal\Core\Updater\Updater::getProjectName()
  2. 9 core/lib/Drupal/Core/Updater/Updater.php \Drupal\Core\Updater\Updater::getProjectName()

Gets the name of the project directory (basename).

@todo It would be nice, if projects contained an info file which could provide their canonical name.

Parameters

string $directory: The full directory path.

Return value

string The name of the project.

File

core/lib/Drupal/Core/Updater/Updater.php, line 163

Class

Updater
Defines the base class for Updaters used in Drupal.

Namespace

Drupal\Core\Updater

Code

public static function getProjectName($directory) {
  return \Drupal::service('file_system')
    ->basename($directory);
}