Copied!

Version parser.

CloneableInstantiable
Methods
public normalize( $version, $fullVersion = NULL)
 

Normalizes a version string to be able to perform comparisons on it.

public normalizeBranch( $name)
 

Normalizes a branch name to be able to perform comparisons on it.

public normalizeDefaultBranch( $name)
 

Normalizes a default branch name (i.e. master on git) to 9999999-dev.

public static normalizeStability( $stability)
public parseConstraints( $constraints)
 

Parses a constraint string into MultiConstraint and/or Constraint objects.

public parseNumericAliasPrefix( $branch)
 

Extract numeric prefix from alias, if it is in numeric format, suitable for version comparison.

public static parseStability( $version)
 

Returns the stability of a version.

Properties
private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?'
 

Regex to match pre-release data (sort of).

Due to backwards compatibility:

  • Instead of enforcing hyphen, an underscore, dot or nothing at all are also accepted.
  • Only stabilities as recognized by Composer are allowed to precede a numerical identifier.
  • Numerical-only pre-release identifiers are not supported, see tests.

                   |--------------|
    

    [major].[minor].[patch] -[pre-release] +[build-metadata]

private static $stabilitiesRegex = 'stable|RC|beta|alpha|dev'
Methods
private expandStability( $stability)
 

Expand shorthand stability string to long version.

private manipulateVersionString(array $matches, $position, $increment = 0, $pad = '0')
 

Increment, decrement, or simply pad a version number.

Support function for {@link parseConstraint()}

private parseConstraint( $constraint)
Properties
private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?'
 

Regex to match pre-release data (sort of).

Due to backwards compatibility:

  • Instead of enforcing hyphen, an underscore, dot or nothing at all are also accepted.
  • Only stabilities as recognized by Composer are allowed to precede a numerical identifier.
  • Numerical-only pre-release identifiers are not supported, see tests.

                   |--------------|
    

    [major].[minor].[patch] -[pre-release] +[build-metadata]

private static $stabilitiesRegex = 'stable|RC|beta|alpha|dev'
Methods
public static normalizeStability( $stability)
public static parseStability( $version)
 

Returns the stability of a version.

© 2023 Bruce Wells
Search Namespaces \ Classes
Configuration