当前位置: 首页>>代码示例>>PHP>>正文


PHP Version::getMajor方法代码示例

本文整理汇总了PHP中Version::getMajor方法的典型用法代码示例。如果您正苦于以下问题:PHP Version::getMajor方法的具体用法?PHP Version::getMajor怎么用?PHP Version::getMajor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Version的用法示例。


在下文中一共展示了Version::getMajor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: complies

 /**
  * @param Version $version
  *
  * @return bool
  */
 public function complies(Version $version)
 {
     if ($version->getMajor()->getValue() != $this->major) {
         return false;
     }
     return $version->getMinor()->getValue() == $this->minor;
 }
开发者ID:paul-schulleri,项目名称:phive,代码行数:12,代码来源:SpecificMajorAndMinorVersionConstraint.php

示例2: testParsesVersionNumbers

 /**
  * @dataProvider versionProvider
  *
  * @param string $versionString
  * @param string $expectedMajor
  * @param string $expectedMinor
  * @param string $expectedPatch
  * @param string $expectedLabel
  * @param string $expectedMetadata
  */
 public function testParsesVersionNumbers($versionString, $expectedMajor, $expectedMinor, $expectedPatch, $expectedLabel = '', $expectedMetadata = '')
 {
     $version = new Version($versionString);
     $this->assertSame($expectedMajor, $version->getMajor()->getValue());
     $this->assertSame($expectedMinor, $version->getMinor()->getValue());
     $this->assertSame($expectedPatch, $version->getPatch()->getValue());
     $this->assertSame($expectedLabel, $version->getLabel());
     $this->assertSame($expectedMetadata, $version->getBuildMetadata());
     $this->assertSame($versionString, $version->getVersionString());
 }
开发者ID:paul-schulleri,项目名称:phive,代码行数:20,代码来源:VersionTest.php

示例3: parse

 /**
  * @param string $value
  *
  * @return ExactVersionConstraint
  */
 public function parse($value)
 {
     switch ($value[0]) {
         case '~':
             $version = new Version(substr($value, 1));
             return new VersionConstraintGroup($value, [new GreaterThanOrEqualToVersionConstraint($value, $version), new SpecificMajorVersionConstraint($value, $version->getMajor()->getValue())]);
     }
     $version = new Version($value);
     if ($version->getMajor()->isAny()) {
         return new AnyVersionConstraint();
     }
     if ($version->getMinor()->isAny()) {
         return new SpecificMajorVersionConstraint($value, $version->getMajor()->getValue());
     }
     if ($version->getPatch()->isAny()) {
         return new SpecificMajorAndMinorVersionConstraint($value, $version->getMajor()->getValue(), $version->getMinor()->getValue());
     }
     return new ExactVersionConstraint($value);
 }
开发者ID:paul-schulleri,项目名称:phive,代码行数:24,代码来源:VersionConstraintParser.php

示例4: 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

示例5: isGreaterThan

 /**
  * @param Version $version
  *
  * @return bool
  */
 public function isGreaterThan(Version $version)
 {
     if ($version->getMajor()->getValue() > $this->getMajor()->getValue()) {
         return false;
     }
     if ($version->getMajor()->getValue() < $this->getMajor()->getValue()) {
         return true;
     }
     if ($version->getMinor()->getValue() > $this->getMinor()->getValue()) {
         return false;
     }
     if ($version->getMinor()->getValue() < $this->getMinor()->getValue()) {
         return true;
     }
     if ($version->getPatch()->getValue() >= $this->getPatch()->getValue()) {
         return false;
     }
     if ($version->getPatch()->getValue() < $this->getPatch()->getValue()) {
         return true;
     }
     return false;
 }
开发者ID:paul-schulleri,项目名称:phive,代码行数:27,代码来源:Version.php

示例6: complies

 /**
  * @param Version $version
  *
  * @return bool
  */
 public function complies(Version $version)
 {
     return $version->getMajor()->getValue() == $this->major;
 }
开发者ID:paul-schulleri,项目名称:phive,代码行数:9,代码来源:SpecificMajorVersionConstraint.php

示例7: 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::getMajor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。