src/Composer/Command/HomeCommand.php
protected function getPackage(RepositoryInterface $repos, $name)
    {
        $name = strtolower($name);
        $pool = new Pool('dev');
        $pool->addRepository($repos);
        $matches = $pool->whatProvides($name);

        foreach ($matches as $index => $package) {
            // skip providers/replacers
            if ($package->getName() !== $name) {
                unset($matches[$index]);
                continue;
            }

            return $package;
        }
    }
protected function getPackage(RepositoryInterface $repos, $name)
    {
        $name = strtolower($name);
        $pool = new Pool('dev');
        $pool->addRepository($repos);
        $matches = $pool->whatProvides($name);

        foreach ($matches as $index => $package) {
            // skip providers/replacers
            if ($package->getName() !== $name) {
                unset($matches[$index]);
                continue;
            }

            return $package;
        }
    }
protected function getPackage ( RepositoryInterface $ repos , $ name ) { $ name = strtolower ( $ name ) ; $ pool = new Pool ( 'dev' ) ; $ pool -> addRepository ( $ repos ) ; $ matches = $ pool -> whatProvides ( $ name ) ; foreach ( $ matches as $ index => $ package ) { // skip providers/replacers if ( $ package -> getName ( ) !== $ name ) { unset ( $ matches [ $ index ] ) ; continue ; } return $ package ; } }
finds a package by name

@param  RepositoryInterface      $repos
@param  string                   $name
@return CompletePackageInterface
finds a package by name