src/Composer/Repository/RepositoryManager.php
public function findPackage($name, $constraint)
    {
        foreach ($this->repositories as $repository) {
            /** @var RepositoryInterface $repository */
            if ($package = $repository->findPackage($name, $constraint)) {
                return $package;
            }
        }

        return null;
    }
public function findPackage($name, $constraint)
    {
        foreach ($this->repositories as $repository) {
            /** @var RepositoryInterface $repository */
            if ($package = $repository->findPackage($name, $constraint)) {
                return $package;
            }
        }

        return null;
    }
Searches for a package by it's name and version in managed repositories.

@param string                                                 $name       package name
@param string|\Composer\Semver\Constraint\ConstraintInterface $constraint package version or version constraint to match against

@return PackageInterface|null