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

Breadcrumb

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

function ComposerRepository::findPackages

@inheritDoc

Overrides ArrayRepository::findPackages

File

vendor/composer/composer/src/Composer/Repository/ComposerRepository.php, line 250

Class

ComposerRepository
@author Jordi Boggiano <j.boggiano@seld.be>

Namespace

Composer\Repository

Code

public function findPackages(string $name, $constraint = null) {
    // this call initializes loadRootServerFile which is needed for the rest below to work
    $hasProviders = $this->hasProviders();
    $name = strtolower($name);
    if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
        $constraint = $this->versionParser
            ->parseConstraints($constraint);
    }
    if ($this->lazyProvidersUrl) {
        if ($this->hasPartialPackages() && isset($this->partialPackagesByName[$name])) {
            return $this->filterPackages($this->whatProvides($name), $constraint);
        }
        if ($this->hasAvailablePackageList && !$this->lazyProvidersRepoContains($name)) {
            return [];
        }
        $result = $this->loadAsyncPackages([
            $name => $constraint,
        ]);
        return $result['packages'];
    }
    if ($hasProviders) {
        foreach ($this->getProviderNames() as $providerName) {
            if ($name === $providerName) {
                return $this->filterPackages($this->whatProvides($providerName), $constraint);
            }
        }
        return [];
    }
    return parent::findPackages($name, $constraint);
}
RSS feed
Powered by Drupal