InstalledVersions::getVersion( string $packageName )


Parameters Parameters

$packageName

(string) (Required)


Top ↑

Return Return

(string|null) If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present


Top ↑

Source Source

File: libraries/lifterlms-cli/vendor/composer/InstalledVersions.php

    public static function getVersion($packageName)
    {
        foreach (self::getInstalled() as $installed) {
            if (!isset($installed['versions'][$packageName])) {
                continue;
            }

            if (!isset($installed['versions'][$packageName]['version'])) {
                return null;
            }

            return $installed['versions'][$packageName]['version'];
        }

        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    }

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.