MMO\core\versions
MMO\core\versions · 15 symbols · generated 5 Oct 2026
check
versions.php:358Test a version string against a Composer-style constraint string.
- Namespace
MMO\core\versions- See
https://getcomposer.org/doc/articles/versions.md# Exact Version Constraint Example: 1.0.2
clean
versions.php:208Normalize a version string to its canonical split()+join() round-tripped form.
- Namespace
MMO\core\versions
compare
versions.php:246Compare two versions per Semantic Versioning precedence rules (numeric identifiers compared numerically, alphabetic ones lexically, a shorter prerelease set precedes a longer one that's otherwise identical, ...).
- Namespace
MMO\core\versions
| $v1 | array | string | |
| $v2 | array | string | |
| $op = '' | string | the operator to use: '<', '<=', '>', '>=', '=', '!=', or '' for no operator |
| returns | int | bool | a bool if $op is given (whether the comparison holds); otherwise an int: >0 if $v1 > $v2, =0 if $v1 == $v2 (or either is a matching wildcard), <0 if $v1 < $v2 |
Call graph
Uses (1)
Used by (2)
findVersion
versions.php:453Find the version(s) in $versions that satisfy $constraint.
- Namespace
MMO\core\versions
| $versions | array | a list of version strings |
| $constraint | string | a Composer-style constraint, check() |
| $single = true | bool | if true, return only the single highest matching version (or null if none match); if false, return every matching version, highest first |
| returns | array | string | null |
hasAny
versions.php:128Test if a version (string, or already-split() array) has a wildcard in any of its first 3 (major/ minor/patch) positions -- unlike isAny(), a partial wildcard like '1.*' counts.
- Namespace
MMO\core\versions
Call graph
Uses (1)
inc
versions.php:224Increment one component (major/minor/patch) of a version, returning the new version string.
- Namespace
MMO\core\versions
| $version | string | |
| $where = MMO\core\versions\PATCH | int | one of the MAJOR/MINOR/PATCH constants: which component to increment |
| $inc = 1 | int | the amount to increment by (can be negative to decrement) |
| returns | string | |
| throws | if $where is not MAJOR/MINOR/PATCH |
Call graph
Uses (3)
Used by (1)
isAny
versions.php:115Test if a version (string, or already-split() array) is a bare wildcard: '*', or a split version whose first 3 elements are all '*' (i.e. it matches literally anything).
- Namespace
MMO\core\versions
Call graph
Used by (2)
join
versions.php:192Reverse of split(): join a split version back into a string, replacing a negative stability int back into its word form (the first STABILITY key with that value -- STABILITY).
- Namespace
MMO\core\versions
ksort
versions.php:472Sort an array by its KEYS, treating them as version numbers (sortCompare()).
- Namespace
MMO\core\versions
Call graph
Used by (1)
loopVersions
versions.php:432Lazily yield every version in $versions that satisfies $constraint, from highest to lowest (sort()).
- Namespace
MMO\core\versions
| $versions | array | a list of version strings |
| $constraint | string | a Composer-style constraint, check() |
| returns | Generator |
Call graph
metadata
versions.php:139Extract a version's build metadata (the part after '+'), without normalizing the rest of the string.
- Namespace
MMO\core\versions
normalize
versions.php:95Normalize a version string: strip its build metadata (the +... suffix, captured into &$metadata), and turn separators (_, -, +, spaces) plus letter/digit boundaries into ., so it can be cleanly exploded on . afterwards (split()).
- Namespace
MMO\core\versions
Call graph
Used by (3)
sort
versions.php:484Sort an array by its VALUES, treating them as version numbers (sortCompare()).
- Namespace
MMO\core\versions
| $versions | array | a list of version strings |
| $asc = true | bool | if false, sort highest-first instead of lowest-first |
| returns | array |
Call graph
Used by (2)
sortCompare
versions.php:302Same as compare() (with no operator), except a wildcard version always sorts BEFORE the versions it matches (so 1.* sorts before 1.2.3) rather than comparing equal to them -- this is what makes sort() a stable, total ordering instead of treating every wildcard-matching version as interchangeable.
- Namespace
MMO\core\versions
split
versions.php:155Split a version string into an array of at least 3 elements [major, minor, patch, ...prerelease], per Semantic Versioning. Numeric parts become int, a recognized stability word (STABILITY) becomes its (negative) int, anything else stays a string, and * stays the literal string '*' (a wildcard).
- Namespace
MMO\core\versions