Utilities relating to PHP version numbers. This compares version numbers +using the algorithm followed by Composer (see +https://getcomposer.org/doc/04-schema.md#version).
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + + + + + + + +
Methods
+ + + + + + + +(inner) asciiVersionCompare(v1, v2) → {number}
+ + + + + + +Return a negative value if v1 < v2, +zero if v1 = v2, a positive value otherwise.
+Parameters:
+ + +| Name | + + +Type | + + + + + +Description | +
|---|---|---|
v1 |
+
+
+ + + +string + + + + | + + + + + +First version for comparison |
+
v2 |
+
+
+ + + +string + + + + | + + + + + +Second version for comparison |
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + + + + + + + +
Returns:
+ + +Comparison result (-1, 0 or 1)
+-
+
- + Type + +
- + +number + + + +
(inner) compare(v1, v2) → {number}
+ + + + + + +Compares two versions and return an interger based on the result. +See https://getcomposer.org/doc/04-schema.md#version +and https://github.com/badges/shields/issues/319#issuecomment-74411045
+Parameters:
+ + +| Name | + + +Type | + + + + + +Description | +
|---|---|---|
v1 |
+
+
+ + + +string + + + + | + + + + + +First version |
+
v2 |
+
+
+ + + +string + + + + | + + + + + +Second version |
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + + + + + + + +
Returns:
+ + +Negative value if v1 < v2, zero if v1 = v2, else a positive value
+-
+
- + Type + +
- + +number + + + +
(async, inner) getPhpReleases(githubApiProvider) → {Promise.<*>}
+ + + + + + +Fetches the PHP release versions from cache if exists, else fetch from the souce url and save in cache.
+Parameters:
+ + +| Name | + + +Type | + + + + + +Description | +
|---|---|---|
githubApiProvider |
+
+
+ + + +object + + + + | + + + + + +Github API provider |
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + + + + + + + +
Returns:
+ + +Promise that resolves to parsed response
+-
+
- + Type + +
- + +Promise.<*> + + + +
(inner) isStable(version) → {boolean}
+ + + + + + +Determines if a version is stable or not.
+Parameters:
+ + +| Name | + + +Type | + + + + + +Description | +
|---|---|---|
version |
+
+
+ + + +string + + + + | + + + + + +Version number |
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + + + + + + + +
Returns:
+ + +true if version is stable, else false
+-
+
- + Type + +
- + +boolean + + + +
(inner) latest(versions) → {string}
+ + + + + + +Determines the latest version from a list of versions.
+Parameters:
+ + +| Name | + + +Type | + + + + + +Description | +
|---|---|---|
versions |
+
+
+ + + +Array.<string> + + + + | + + + + + +List of versions |
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + + + + + + + +
Returns:
+ + +Latest version
+-
+
- + Type + +
- + +string + + + +
(inner) minorVersion(version) → {string}
+ + + + + + +Checks if a version is valid and returns the minor version.
+Parameters:
+ + +| Name | + + +Type | + + + + + +Description | +
|---|---|---|
version |
+
+
+ + + +string + + + + | + + + + + +Version number |
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + + + + + + + +
Returns:
+ + +Minor version
+-
+
- + Type + +
- + +string + + + +
(inner) numberedVersionData(version) → {object}
+ + + + + + +Take a version without the starting v. +eg, '1.0.x-beta' +Return { numbers: [1,0,something big], modifier: 2, modifierCount: 1 }
+Parameters:
+ + +| Name | + + +Type | + + + + + +Description | +
|---|---|---|
version |
+
+
+ + + +string + + + + | + + + + + +Version number string |
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + + + + + + + +
Returns:
+ + +Object containing version details
+-
+
- + Type + +
- + +object + + + +
(inner) versionReduction(versions, phpReleases) → {Array.<string>}
+ + + + + + +Reduces the list of php versions that intersect with release versions to a version range (for eg. '5.4 - 7.1', '>= 5.5').
+Parameters:
+ + +| Name | + + +Type | + + + + + +Description | +
|---|---|---|
versions |
+
+
+ + + +Array.<string> + + + + | + + + + + +List of php versions |
+
phpReleases |
+
+
+ + + +Array.<string> + + + + | + + + + + +List of php release versions |
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + + + + + + + +
Returns:
+ + +Reduced Version Range (for eg. ['5.4 - 7.1'], ['>= 5.5'])
+-
+
- + Type + +
- + +Array.<string> + + + +