Beispiel #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;
 }
Beispiel #2
0
 /**
  * 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());
     }
 }