Ejemplo n.º 1
0
 /**
  * Creates a new in memory package.
  *
  * @param string $name        The package's name
  * @param string $version     The package's version
  * @param string $prettyVersion The package's non-normalized version
  */
 public function __construct($name, $version, $prettyVersion)
 {
     parent::__construct($name);
     $this->version = $version;
     $this->prettyVersion = $prettyVersion;
     $this->dev = 'dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4);
 }
 public function populateGraphTemplate(&$tpl)
 {
     if (!is_array($tpl)) {
         throw new Exception('Invalid template argument, array expected');
     }
     parent::populateGraphTemplate($tpl);
     if ($this->hasDirectDownloadUri()) {
         $tpl['direct_download_uri'] = $this->directDownloadUri();
     }
     if ($this->hasDirectDownloadFallbackUri()) {
         $tpl['direct_download_fallback_uri'] = $this->directDownloadFallbackUri();
     }
     if ($this->hasReleaseChangeLogUri()) {
         $tpl['release_changeloguri'] = $this->releaseChangeLogUri;
     }
     if ($this->hasReleaseNotesUri()) {
         $tpl['release_notesuri'] = $this->releaseNotesUri;
     }
     if ($this->hasReleaseDate()) {
         $tpl['release_date'] = date(DATE_RFC1123, $this->releaseDate);
     }
     if ($this->hasCompileLogUri()) {
         $tpl['compile_loguri'] = $this->compileLogUri;
     }
     if ($this->hasCompileErrorCount()) {
         $tpl['compile_errorcount'] = $this->compileErrorCount;
     }
     if ($this->hasCompileWarnCount()) {
         $tpl['compile_warncount'] = $this->compileWarnCount;
     }
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  *
  * Gets library version using `phpversion()` function if possible, an empty
  * string will be returned if no version could be found (library not installed).
  *
  * @return string Package's version, for instance `1.2.x-dev`
  */
 public function version()
 {
     if (parent::version() !== null) {
         return parent::version();
     }
     $this->_version = '';
     $lib = strtolower($this->_packageName);
     if ($lib === 'lib-icu') {
         $lib = 'intl';
     } elseif (stripos($lib, 'ext-') === 0) {
         $lib = substr($lib, 4);
     }
     if ($lib === 'php') {
         $this->_version = PHP_VERSION;
     } elseif (function_exists('phpversion')) {
         $version = phpversion($lib);
         $this->_version = $version === false ? '' : $version;
     } elseif (function_exists('extension_loaded')) {
         $this->_version = extension_loaded($lib) ? '99999' : '';
     }
     return $this->_version;
 }