-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added SemanticComparatorInterface and SemanticVersionInterface
- Loading branch information
Showing
6 changed files
with
133 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
/** | ||
* (c) Dennis Meckel | ||
* | ||
* For the full copyright and license information, | ||
* please view the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Rayne\SemanticVersioning; | ||
|
||
/** | ||
* Semantic Versioning Comparator. | ||
* | ||
* @since 1.0.0-rc.3 | ||
* @see http://semver.org | ||
*/ | ||
interface SemanticComparatorInterface | ||
{ | ||
/** | ||
* @param SemanticVersionInterface $left | ||
* @param SemanticVersionInterface $right | ||
* @return int | ||
* @see compare() | ||
*/ | ||
public function __invoke(SemanticVersionInterface $left, SemanticVersionInterface $right); | ||
|
||
/** | ||
* Build metadata is ignored when determining version precedence. | ||
* | ||
* @param SemanticVersionInterface $left | ||
* @param SemanticVersionInterface $right | ||
* @return int `0` if both versions are equal, `< 0` if `$left` is smaller and `> 0` if `$left` is greater. | ||
*/ | ||
public function compare(SemanticVersionInterface $left, SemanticVersionInterface $right); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
/** | ||
* (c) Dennis Meckel. | ||
* | ||
* For the full copyright and license information, | ||
* please view the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Rayne\SemanticVersioning; | ||
|
||
/** | ||
* Interprets the semantic versioning format `MAJOR.MINOR.PATCH-PRE+META`. | ||
* | ||
* @since 1.0.0-rc.3 | ||
* @see http://semver.org | ||
*/ | ||
interface SemanticVersionInterface | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
public function __toString(); | ||
|
||
/** | ||
* @return int Non-negative integer without leading zeroes. | ||
*/ | ||
public function getMajor(); | ||
|
||
/** | ||
* @return int Non-negative integer without leading zeroes. | ||
*/ | ||
public function getMinor(); | ||
|
||
/** | ||
* @return int Non-negative integer without leading zeroes. | ||
*/ | ||
public function getPatch(); | ||
|
||
/** | ||
* @return string Optional pre-release information. | ||
*/ | ||
public function getPre(); | ||
|
||
/** | ||
* @return string[] | ||
* | ||
* @since 1.0.0-rc.2 | ||
*/ | ||
public function getPreStack(); | ||
|
||
/** | ||
* @return string Optional metadata. | ||
*/ | ||
public function getMeta(); | ||
|
||
/** | ||
* @return string[] | ||
* | ||
* @since 1.0.0-rc.2 | ||
*/ | ||
public function getMetaStack(); | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getVersion(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters