VersionParser
in package
Version parser.
Tags
Table of Contents
Methods
- normalize() : string
- Normalizes a version string to be able to perform comparisons on it.
- normalizeBranch() : string
- Normalizes a branch name to be able to perform comparisons on it.
- normalizeDefaultBranch() : string
- Normalizes a default branch name (i.e. master on git) to 9999999-dev.
- normalizeStability() : string
- parseConstraints() : ConstraintInterface
- Parses a constraint string into MultiConstraint and/or Constraint objects.
- parseNumericAliasPrefix() : string|false
- Extract numeric prefix from alias, if it is in numeric format, suitable for version comparison.
- parseStability() : string
- Returns the stability of a version.
Methods
normalize()
Normalizes a version string to be able to perform comparisons on it.
public
normalize(string $version[, string|null $fullVersion = null ]) : string
Parameters
- $version : string
- $fullVersion : string|null = null
-
optional complete version string to give more context
Tags
Return values
stringnormalizeBranch()
Normalizes a branch name to be able to perform comparisons on it.
public
normalizeBranch(string $name) : string
Parameters
- $name : string
Return values
stringnormalizeDefaultBranch()
Normalizes a default branch name (i.e. master on git) to 9999999-dev.
public
normalizeDefaultBranch(string $name) : string
No need to use this anymore in theory, Composer 2 does not normalize any branch names to 9999999-dev anymore
Parameters
- $name : string
Return values
stringnormalizeStability()
public
static normalizeStability(string $stability) : string
Parameters
- $stability : string
Tags
Return values
stringparseConstraints()
Parses a constraint string into MultiConstraint and/or Constraint objects.
public
parseConstraints(string $constraints) : ConstraintInterface
Parameters
- $constraints : string
Return values
ConstraintInterfaceparseNumericAliasPrefix()
Extract numeric prefix from alias, if it is in numeric format, suitable for version comparison.
public
parseNumericAliasPrefix(string $branch) : string|false
Parameters
- $branch : string
-
Branch name (e.g. 2.1.x-dev)
Return values
string|false —Numeric prefix if present (e.g. 2.1.) or false
parseStability()
Returns the stability of a version.
public
static parseStability(string $version) : string
Parameters
- $version : string