Airship\Engine\Continuum\Version::isPatchUpgrade PHP Méthode

isPatchUpgrade() public méthode

Is this a patch upgrade? (Semantic versioning)
public isPatchUpgrade ( string $nextVersion ) : boolean
$nextVersion string
Résultat boolean
    public function isPatchUpgrade(string $nextVersion) : bool
    {
        $curr = \Airship\expand_version($this->currentVersion);
        $next = \Airship\expand_version($nextVersion);
        return self::getGroup($next, self::GROUP_MAJOR) === self::getGroup($curr, self::GROUP_MAJOR) && self::getGroup($next, self::GROUP_MINOR) === self::getGroup($curr, self::GROUP_MINOR) && self::getGroup($next, self::GROUP_PATCH) > self::getGroup($curr, self::GROUP_PATCH);
    }

Usage Example

Exemple #1
0
 /**
  * Should this automatic update be permitted?
  *
  * @param UpdateInfo $info
  * @param string $currentVersion
  * @return bool
  */
 protected function checkVersionSettings(UpdateInfo $info, string $currentVersion) : bool
 {
     $state = State::instance();
     $nextVersion = $info->getVersion();
     $version = new Version($currentVersion);
     // If this isn't an upgrade at all, don't apply it.
     if (!$version->isUpgrade($nextVersion)) {
         return false;
     }
     if ($version->isMajorUpgrade($nextVersion)) {
         return !empty($state->universal['auto-update']['major']);
     }
     if ($version->isMinorUpgrade($nextVersion)) {
         return !empty($state->universal['auto-update']['minor']);
     }
     if ($version->isPatchUpgrade($nextVersion)) {
         return !empty($state->universal['auto-update']['patch']);
     }
     return false;
 }