function ComposerRepository::findPackage
@inheritDoc
Overrides ArrayRepository::findPackage
File
-
vendor/
composer/ composer/ src/ Composer/ Repository/ ComposerRepository.php, line 206
Class
- ComposerRepository
- @author Jordi Boggiano <j.boggiano@seld.be>
Namespace
Composer\RepositoryCode
public function findPackage(string $name, $constraint) {
// this call initializes loadRootServerFile which is needed for the rest below to work
$hasProviders = $this->hasProviders();
$name = strtolower($name);
if (!$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, true);
}
if ($this->hasAvailablePackageList && !$this->lazyProvidersRepoContains($name)) {
return null;
}
$packages = $this->loadAsyncPackages([
$name => $constraint,
]);
if (count($packages['packages']) > 0) {
return reset($packages['packages']);
}
return null;
}
if ($hasProviders) {
foreach ($this->getProviderNames() as $providerName) {
if ($name === $providerName) {
return $this->filterPackages($this->whatProvides($providerName), $constraint, true);
}
}
return null;
}
return parent::findPackage($name, $constraint);
}