src/Composer/Command/ShowCommand.php
protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
    {
        uasort($versions, 'version_compare');
        $versions = array_keys(array_reverse($versions));

        // highlight installed version
        if ($installedRepo->hasPackage($package)) {
            $installedVersion = $package->getPrettyVersion();
            $key = array_search($installedVersion, $versions);
            if (false !== $key) {
                $versions[$key] = '<info>* ' . $installedVersion . '</info>';
            }
        }

        $versions = implode(', ', $versions);

        $this->getIO()->write('<info>versions</info> : ' . $versions);
    }
protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
    {
        uasort($versions, 'version_compare');
        $versions = array_keys(array_reverse($versions));

        // highlight installed version
        if ($installedRepo->hasPackage($package)) {
            $installedVersion = $package->getPrettyVersion();
            $key = array_search($installedVersion, $versions);
            if (false !== $key) {
                $versions[$key] = '<info>* ' . $installedVersion . '</info>';
            }
        }

        $versions = implode(', ', $versions);

        $this->getIO()->write('<info>versions</info> : ' . $versions);
    }
protected function printVersions ( CompletePackageInterface $ package , array $ versions , RepositoryInterface $ installedRepo ) { uasort ( $ versions , 'version_compare' ) ; $ versions = array_keys ( array_reverse ( $ versions ) ) ; // highlight installed version if ( $ installedRepo -> hasPackage ( $ package ) ) { $ installedVersion = $ package -> getPrettyVersion ( ) ; $ key = array_search ( $ installedVersion , $ versions ) ; if ( false !== $ key ) { $ versions [ $ key ] = '<info>* ' . $ installedVersion . '</info>' ; } } $ versions = implode ( ', ' , $ versions ) ; $ this -> getIO ( ) -> write ( '<info>versions</info> : ' . $ versions ) ; }
Prints all available versions of this package and highlights the installed one if any.

@param CompletePackageInterface $package
@param array                    $versions
@param RepositoryInterface      $installedRepo
Prints all available versions of this package and highlights the installed one if any .