Documentation

Version
in package

Converts between different version schemes.

Tags
category

Horde

author

Gunnar Wrobel wrobel@pardus.de

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

Table of Contents

$buildInfo  : string
$changed  : bool
Flip to true if anything was changed from the original string
$major  : int
$minor  : int
$original  : string
$other  : string
$patch  : int
$prefix  : string
$stability  : string
$stabilityVersion  : int
$subpatch  : int
__construct()  : mixed
changed()  : bool
Reveal if the version is still as originally constructed
composerToPear()  : array<string|int, mixed>
Converts (a limited set of) Composer version constraints to PEAR version constraints.
fromComposerString()  : Version
getBuildInfo()  : string
getMajor()  : int
getMinor()  : int
getOriginal()  : string
getOther()  : string
getPatch()  : int
getPrefix()  : string
getStability()  : string
getStabilityVersion()  : int
getSubPatch()  : int
nextMinorVersion()  : string
Increments the minor version number by one.
nextPearVersion()  : string
Increments the last part of a version number by one.
nextVersion()  : string
Increments the last part of a version number by one.
nextVersionByPart()  : string
Increments a version part number by one.
normalizeComposerVersion()  : string
Reconstruct a normalized string representation from parts.
parsePearVersion()  : object
Converts the PEAR package version number to descriptive information.
pearToHordeWithBranch()  : string
Convert the PEAR package version number to Horde style and take the branch name into account.
pearToTicketDescription()  : string
Converts the PEAR package version number to a descriptive tag used on bugs.horde.org.
setSubPatch()  : self
validateApiStability()  : void
Validates the version and api stability tuple.
validatePear()  : string
Validates and normalizes a version to be a valid PEAR version.
validateReleaseStability()  : void
Validates the version and release stability tuple.
change()  : self

Properties

$buildInfo

private string $buildInfo = ''

$changed

Flip to true if anything was changed from the original string

private bool $changed = false

$stability

private string $stability = ''

$stabilityVersion

private int $stabilityVersion = 0

Methods

__construct()

public __construct(string $original, string $prefix, int $major, int $minor, int $patch, int $subpatch[, string $stability = '' ], int $stabilityVersion[, string $buildInfo = '' ][, string $other = '' ]) : mixed
Parameters
$original : string
$prefix : string
$major : int
$minor : int
$patch : int
$subpatch : int
$stability : string = ''
$stabilityVersion : int
$buildInfo : string = ''
$other : string = ''
Return values
mixed

changed()

Reveal if the version is still as originally constructed

public changed() : bool
Return values
bool

composerToPear()

Converts (a limited set of) Composer version constraints to PEAR version constraints.

public static composerToPear(string $version) : array<string|int, mixed>
Parameters
$version : string

Version constraints like '*', '^x.y.z', or '^x || ^y.z'.

Return values
array<string|int, mixed>

Version constraints with possible keys 'min', 'max', and 'exclude'.

fromComposerString()

public static fromComposerString(string $version) : Version
Parameters
$version : string
Return values
Version

getBuildInfo()

public getBuildInfo() : string
Return values
string

getMajor()

public getMajor() : int
Return values
int

getMinor()

public getMinor() : int
Return values
int

getOriginal()

public getOriginal() : string
Return values
string

getOther()

public getOther() : string
Return values
string

getPatch()

public getPatch() : int
Return values
int

getPrefix()

public getPrefix() : string
Return values
string

getStability()

public getStability() : string
Return values
string

getStabilityVersion()

public getStabilityVersion() : int
Return values
int

getSubPatch()

public getSubPatch() : int
Return values
int

nextMinorVersion()

Increments the minor version number by one.

public static nextMinorVersion(string $version) : string

If there is a release state suffix on the current version, this will be removed on the next version. The patch version will always be set to 0 for the next version.

Parameters
$version : string

A version number.

Tags
throws
Exception

on invalid version string.

Return values
string

The incremented version number.

nextPearVersion()

Increments the last part of a version number by one.

public static nextPearVersion(string $version) : string

Only increments if the old version is a stable version. Increments the release state suffix instead otherwise.

Parameters
$version : string

A version number.

Tags
throws
Exception

on invalid version string.

Return values
string

The incremented version number.

nextVersion()

Increments the last part of a version number by one.

public static nextVersion(string $version) : string

Also attaches -git suffix and increments only if the old version is a stable version.

Parameters
$version : string

A version number.

Tags
throws
Exception

on invalid version string.

Return values
string

The incremented version number.

nextVersionByPart()

Increments a version part number by one.

public static nextVersionByPart(string $version[, string $versionPart = 'patch' ]) : string
Parameters
$version : string

A version number.

$versionPart : string = 'patch'

The part of the version that should be incremented.

Tags
throws
Exception

on invalid version string.

Return values
string

The incremented version number.

normalizeComposerVersion()

Reconstruct a normalized string representation from parts.

public normalizeComposerVersion() : string

Always format to major.minor.patch without leading zero. Only show fourth version part if greater than 0. Append stability with a hyphen unless it is empty or 'stable' Append stability version only if it is 2 or higher and stability != stable Append buildinfo with + if present

This will lose any "other" that cannot be parsed to stability and buildinfo This will lose the prefix

Return values
string

parsePearVersion()

Converts the PEAR package version number to descriptive information.

public static parsePearVersion(string $version) : object

1.1.0RC2 would become: { version: '1.1.0', description: 'Release Candidate', subversion: '2' }

Parameters
$version : string

The PEAR package version.

Tags
throws
Exception

on invalid version string.

Return values
object

An object with the properties:

  • version: The base version string.
  • description: A stability description.
  • subversion: The sub version within the stability level.

pearToHordeWithBranch()

Convert the PEAR package version number to Horde style and take the branch name into account.

public static pearToHordeWithBranch(string $version, string $branch) : string
Parameters
$version : string

The PEAR package version.

$branch : string

The Horde branch name.

Return values
string

The Horde style version.

pearToTicketDescription()

Converts the PEAR package version number to a descriptive tag used on bugs.horde.org.

public static pearToTicketDescription(string $version) : string
Parameters
$version : string

The PEAR package version.

Tags
throws
Exception

on invalid version string.

Return values
string

The description for bugs.horde.org.

setSubPatch()

public setSubPatch(int $subpatch) : self
Parameters
$subpatch : int
Return values
self

validateApiStability()

Validates the version and api stability tuple.

public static validateApiStability(string $version, string $stability) : void
Parameters
$version : string

A version string.

$stability : string

Api stability information.

Tags
throws
Exception

on invalid version string.

Return values
void

validatePear()

Validates and normalizes a version to be a valid PEAR version.

public static validatePear(string $version) : string
Parameters
$version : string

A version string.

Tags
throws
Exception

on invalid version string.

Return values
string

The normalized version string.

validateReleaseStability()

Validates the version and release stability tuple.

public static validateReleaseStability(string $version, string $stability) : void
Parameters
$version : string

A version string.

$stability : string

Release stability information.

Tags
throws
Exception

on invalid version string.

Return values
void

change()

private change() : self
Return values
self

Search results