Esempio n. 1
0
 /**
  * @param CompletePackageInterface $package
  *
  * @return Package
  */
 public static function createFromComposerPackage(CompletePackageInterface $package)
 {
     $class = new self();
     $class->type = $package->getType();
     $class->name = $package->getPrettyName();
     $class->description = $package->getDescription();
     $class->authors = $package->getAuthors();
     $class->keywords = $package->getKeywords();
     if ($package->getVersion() === '9999999-dev') {
         $class->version = sprintf('%s (%s)', $package->getPrettyVersion(), substr($package->getSourceReference(), 0, 6));
     } else {
         $class->version = $package->getPrettyVersion();
     }
     return $class;
 }
Esempio n. 2
0
 /**
  * prints all available versions of this package and highlights the installed one if any
  */
 protected function printVersions(InputInterface $input, OutputInterface $output, CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, RepositoryInterface $repos)
 {
     if ($input->getArgument('version')) {
         $output->writeln('<info>version</info>  : ' . $package->getPrettyVersion());
         return;
     }
     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);
     $output->writeln('<info>versions</info> : ' . $versions);
 }
Esempio n. 3
0
 /**
  * prints all available versions of this package and highlights the installed one if any
  */
 protected function printVersions(InputInterface $input, OutputInterface $output, CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, RepositoryInterface $repos)
 {
     if ($input->getArgument('version')) {
         $output->writeln('<info>version</info>  : ' . $package->getPrettyVersion());
         return;
     }
     uasort($versions, 'version_compare');
     $versions = implode(', ', array_keys(array_reverse($versions)));
     // highlight installed version
     if ($installedRepo->hasPackage($package)) {
         $versions = str_replace($package->getPrettyVersion(), '<info>* ' . $package->getPrettyVersion() . '</info>', $versions);
     }
     $output->writeln('<info>versions</info> : ' . $versions);
 }