You are here

public static function Composer::getInstalledVersion in Markdown 8.2

Retrieves the installed version for a specific package.

@internal

Parameters

string $name: The package name for which to retrieve the installed version.

array $comparisonJson: Optional. The JSON array to look for if the specified name doesn't exist. This can happen if installing an older package version where it uses an older package name. Unless the user explicitly installed that older package name, Composer will default to the newer/current package name in its installed.json file.

Return value

string|void The installed version, NULL if not installed.

Deprecated

in markdown:8.x-2.0 and is removed from markdown:4.0.0. No replacement.

See also

https://www.drupal.org/project/markdown/issues/3200476

2 calls to Composer::getInstalledVersion()
Composer::getVersionFromClass in src/Util/Composer.php
Retrieves the version based on a provided class name.
ComposerPackage::detectVersion in src/Annotation/ComposerPackage.php
Detects the installed version of a Composer package.

File

src/Util/Composer.php, line 172

Class

Composer
Helper class used to deal with composer.

Namespace

Drupal\markdown\Util

Code

public static function getInstalledVersion($name, array $comparisonJson = []) {
  if ($name && ($installedJson = static::getInstalledJson($name, $comparisonJson)) && !empty($installedJson['version'])) {
    return $installedJson['version'];
  }
}