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

Breadcrumb

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

function CompletionTrait::suggestPlatformPackage

Suggest platform packages from the ones available on the currently-running PHP

File

vendor/composer/composer/src/Composer/Command/CompletionTrait.php, line 230

Class

CompletionTrait
Adds completion to arguments and options.

Namespace

Composer\Command

Code

private function suggestPlatformPackage() : \Closure {
    return function (CompletionInput $input) : array {
        $repos = new PlatformRepository([], $this->requireComposer()
            ->getConfig()
            ->get('platform'));
        $pattern = BasePackage::packageNameToRegexp($input->getCompletionValue() . '*');
        return array_filter(array_map(static function (PackageInterface $package) {
            return $package->getName();
        }, $repos->getPackages()), static function (string $name) use ($pattern) : bool {
            return Preg::isMatch($pattern, $name);
        });
    };
}

API Navigation

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