Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Problem.php

function Problem::getPlatformPackageVersion

Parameters

string $version the effective runtime version of the platform package:

Return value

?string a version string or null if it appears the package was artificially disabled

1 call to Problem::getPlatformPackageVersion()
Problem::getMissingPackageReason in vendor/composer/composer/src/Composer/DependencyResolver/Problem.php
@internal

File

vendor/composer/composer/src/Composer/DependencyResolver/Problem.php, line 486

Class

Problem
Represents a problem detected while solving dependencies

Namespace

Composer\DependencyResolver

Code

private static function getPlatformPackageVersion(Pool $pool, string $packageName, string $version) : ?string {
    $available = $pool->whatProvides($packageName);
    if (\count($available) > 0) {
        $selected = null;
        foreach ($available as $pkg) {
            if ($pkg->getRepository() instanceof PlatformRepository) {
                $selected = $pkg;
                break;
            }
        }
        if ($selected === null) {
            $selected = reset($available);
        }
        // must be a package providing/replacing and not a real platform package
        if ($selected->getName() !== $packageName) {
            
            /** @var Link $link */
            foreach (array_merge(array_values($selected->getProvides()), array_values($selected->getReplaces())) as $link) {
                if ($link->getTarget() === $packageName) {
                    return $link->getPrettyConstraint() . ' ' . substr($link->getDescription(), 0, -1) . 'd by ' . $selected->getPrettyString();
                }
            }
        }
        $version = $selected->getPrettyVersion();
        $extra = $selected->getExtra();
        if ($selected instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
            $version .= '; ' . str_replace('Package ', '', (string) $selected->getDescription());
        }
    }
    else {
        return null;
    }
    return $version;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal