當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Version::getPreRelease方法代碼示例

本文整理匯總了PHP中Version::getPreRelease方法的典型用法代碼示例。如果您正苦於以下問題:PHP Version::getPreRelease方法的具體用法?PHP Version::getPreRelease怎麽用?PHP Version::getPreRelease使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Version的用法示例。


在下文中一共展示了Version::getPreRelease方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: compareTo

 /**
  * Compares one version with another.
  *
  * @param Version $left  The left version to compare.
  * @param Version $right The right version to compare.
  *
  * @return integer Returns Comparator::EQUAL_TO if the two versions are
  *                 equal. If the left version is less than the right
  *                 version, Comparator::LESS_THAN is returned. If the left
  *                 version is greater than the right version,
  *                 Comparator::GREATER_THAN is returned.
  */
 public static function compareTo(Version $left, Version $right)
 {
     switch (true) {
         case $left->getMajor() < $right->getMajor():
             return self::LESS_THAN;
         case $left->getMajor() > $right->getMajor():
             return self::GREATER_THAN;
         case $left->getMinor() > $right->getMinor():
             return self::GREATER_THAN;
         case $left->getMinor() < $right->getMinor():
             return self::LESS_THAN;
         case $left->getPatch() > $right->getPatch():
             return self::GREATER_THAN;
         case $left->getPatch() < $right->getPatch():
             return self::LESS_THAN;
             // @codeCoverageIgnoreStart
     }
     // @codeCoverageIgnoreEnd
     return self::compareIdentifiers($left->getPreRelease(), $right->getPreRelease());
 }
開發者ID:joelleemann,項目名稱:CodifiedGeek.com,代碼行數:32,代碼來源:Comparator.php

示例2: toString

 /**
  * Returns the string representation of a Version instance.
  *
  * @param Version $version A version.
  *
  * @return string The string representation.
  */
 public static function toString(Version $version)
 {
     return sprintf('%d.%d.%d%s%s', $version->getMajor(), $version->getMinor(), $version->getPatch(), $version->getPreRelease() ? '-' . join('.', $version->getPreRelease()) : '', $version->getBuild() ? '+' . join('.', $version->getBuild()) : '');
 }
開發者ID:joelleemann,項目名稱:CodifiedGeek.com,代碼行數:11,代碼來源:Dumper.php


注:本文中的Version::getPreRelease方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。