/** * @return Version */ public function getVersion() { if (false === isset(self::$m_versions[$this->m_component])) { self::$m_versions[$this->m_component] = Version::parse($this->initialized()->version); } return self::$m_versions[$this->m_component]; }
/** * Checks if the installation associated with the meta file or Installation object for * updates, if an update URL is specified. * @param string|Installation $meta * @return boolean */ public static function hasUpdate($meta) { if ($meta instanceof Installation) { $inst = $meta; } else { $meta = self::getMetaPath($meta); if (empty($meta)) { throw new InvalidArgumentException('Parameter $meta must be a path to an installation meta data file'); } $inst = Installation::getInstallation(json_decode(file_get_contents($meta), true)); } $updt = self::getUpdateData($inst); if (empty($updt)) { return false; } $localVersion = $inst->getVersion(); $remoteVersion = Version::parse($updt['version']); if (!$localVersion->lessThan($remoteVersion)) { return false; } return true; }
public function getProtocolVersion() { return Version::parse('1.0'); }
<?php defined('DIAMONDMVC') or die; $version1 = Version::parse('1.4.2'); $version2 = Version::parse('1.4.2.123'); $version3 = Version::parse('1.2.6'); $version4 = Version::parse('1.6.8'); $version5 = Version::parse('2'); ?> <div class="view view-unittest" id="unittest-versioning"> <table class="table table-striped"> <thead> <tr> <th>Test</th> <th>Expected result</th> <th>Actual result</th> <th>Pass?</th> </tr> </thead> <tbody> <tr> <td><?php echo "{$version1} < {$version2}"; ?> </td> <td>true</td> <td><?php echo ($result = $version1->lessThan($version2)) ? 'true' : 'false'; ?> </td> <td>