コード例 #1
0
 private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
 {
     $support = $package->getSupport();
     $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
     if (!$url || $showHomepage) {
         $url = $package->getHomepage();
     }
     if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
         return false;
     }
     if ($showOnly) {
         $this->getIO()->write(sprintf('<info>%s</info>', $url));
     } else {
         $this->openBrowser($url);
     }
     return true;
 }
コード例 #2
0
ファイル: PackageConverter.php プロジェクト: tenside/core
 /**
  * Convert the data of a complete package to the passed json array.
  *
  * @param CompletePackageInterface $package The package to process.
  *
  * @param JsonArray                $data    The json array to push the data to.
  *
  * @return void
  */
 private function convertCompletePackage(CompletePackageInterface $package, $data)
 {
     $data->set('description', $package->getDescription());
     $data->set('license', $package->getLicense());
     if ($keywords = $package->getKeywords()) {
         $data->set('keywords', $keywords);
     }
     if ($homepage = $package->getHomepage()) {
         $data->set('homepage', $homepage);
     }
     if ($authors = $package->getAuthors()) {
         $data->set('authors', $authors);
     }
     if ($support = $package->getSupport()) {
         $data->set('support', $support);
     }
     if ($extra = $package->getExtra()) {
         $data->set('extra', $extra);
     }
     $data->set('abandoned', $package->isAbandoned());
     if ($package->isAbandoned()) {
         $data->set('replacement', $package->getReplacementPackage());
     }
 }