/** * @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; }