src/Composer/Search/RepositorySearch.php
protected function filter($packageNames, $filters)
    {
        if (empty($filters)) {
            return $packageNames;
        }

        $packages = [];
        foreach ($packageNames as $packageName) {
            if (count($package = $this->repository->findPackages($packageName)) > 0) {
                foreach ($filters as $filter) {
                    $package = array_filter($package, $filter);
                }
                if ($package = current($package)) {
                    $packages[$packageName] = $package;
                }
            }
        }

        return array_map(
            function ($package) {
                /** @var PackageInterface $package */
                return $package->getName();
            },
            $packages
        );
    }
protected function filter($packageNames, $filters)
    {
        if (empty($filters)) {
            return $packageNames;
        }

        $packages = [];
        foreach ($packageNames as $packageName) {
            if (count($package = $this->repository->findPackages($packageName)) > 0) {
                foreach ($filters as $filter) {
                    $package = array_filter($package, $filter);
                }
                if ($package = current($package)) {
                    $packages[$packageName] = $package;
                }
            }
        }

        return array_map(
            function ($package) {
                /** @var PackageInterface $package */
                return $package->getName();
            },
            $packages
        );
    }
protected function filter ( $ packageNames , $ filters ) { if ( empty ( $ filters ) ) { return $ packageNames ; } $ packages = [ ] ; foreach ( $ packageNames as $ packageName ) { if ( count ( $ package = $ this -> repository -> findPackages ( $ packageName ) ) > 0 ) { foreach ( $ filters as $ filter ) { $ package = array_filter ( $ package , $ filter ) ; } if ( $ package = current ( $ package ) ) { $ packages [ $ packageName ] = $ package ; } } } return array_map ( function ( $ package ) { /** @var PackageInterface $package */ return $ package -> getName ( ) ; } , $ packages ) ; }
Filter the passed list of package names.

@param string[]   $packageNames The package names.

@param \Closure[] $filters      The filters to apply.

@return string[]
Filter the passed list of package names .