public function extract(
        Composer $composer,
        SymbolIteratorInterface $symbols
    ): iterable {
        $repository = $composer->getRepositoryManager()->getLocalRepository();
        $vendorPath = str_replace('\\', '/', $composer->getConfig()->get('vendor-dir', 0));

        $packages = [];

        foreach ($symbols as $symbol) {
            $package = $this->extractPackage($vendorPath, $symbol);

            if ($package === null) {
                continue;
            }

            if (!array_key_exists($package, $packages)) {
                $packages[$package] = [];
            }

            $packages[$package][] = $symbol;
        }

        $installed = $repository->getPackages();

        $candidates = [];

        foreach ($packages as $name => $symbols) {
            $package = $this->getPackageByName($installed, $name);

            if ($package === null) {
                continue;
            }

            $candidates[] = new Candidate(
                $package,
                new SymbolIterator(...$symbols)
            );
        }

        return $candidates;
    }
public function extract(
        Composer $composer,
        SymbolIteratorInterface $symbols
    ): iterable {
        $repository = $composer->getRepositoryManager()->getLocalRepository();
        $vendorPath = str_replace('\\', '/', $composer->getConfig()->get('vendor-dir', 0));

        $packages = [];

        foreach ($symbols as $symbol) {
            $package = $this->extractPackage($vendorPath, $symbol);

            if ($package === null) {
                continue;
            }

            if (!array_key_exists($package, $packages)) {
                $packages[$package] = [];
            }

            $packages[$package][] = $symbol;
        }

        $installed = $repository->getPackages();

        $candidates = [];

        foreach ($packages as $name => $symbols) {
            $package = $this->getPackageByName($installed, $name);

            if ($package === null) {
                continue;
            }

            $candidates[] = new Candidate(
                $package,
                new SymbolIterator(...$symbols)
            );
        }

        return $candidates;
    }
public function extract ( Composer $ composer , SymbolIteratorInterface $ symbols ) : iterable { $ repository = $ composer -> getRepositoryManager ( ) -> getLocalRepository ( ) ; $ vendorPath = str_replace ( '\\' , '/' , $ composer -> getConfig ( ) -> get ( 'vendor-dir' , 0 ) ) ; $ packages = [ ] ; foreach ( $ symbols as $ symbol ) { $ package = $ this -> extractPackage ( $ vendorPath , $ symbol ) ; if ( $ package === null ) { continue ; } if ( ! array_key_exists ( $ package , $ packages ) ) { $ packages [ $ package ] = [ ] ; } $ packages [ $ package ] [ ] = $ symbol ; } $ installed = $ repository -> getPackages ( ) ; $ candidates = [ ] ; foreach ( $ packages as $ name => $ symbols ) { $ package = $ this -> getPackageByName ( $ installed , $ name ) ; if ( $ package === null ) { continue ; } $ candidates [ ] = new Candidate ( $ package , new SymbolIterator ( ... $ symbols ) ) ; } return $ candidates ; }
Extract violation candidates from the given Composer instance and symbols.

@param Composer                $composer
@param SymbolIteratorInterface $symbols

@return iterable|CandidateInterface[]
Extract violation candidates from the given Composer instance and symbols .