TYPO3  7.6
Static Public Member Functions | List of all members
VersionNumberUtility Class Reference

Static Public Member Functions

static convertVersionNumberToInteger ($versionNumber)
 
static convertIntegerToVersionNumber ($versionInteger)
 
static splitVersionRange ($version)
 
static getNumericTypo3Version ()
 
static getCurrentTypo3Version ()
 
static convertVersionsStringToVersionNumbers ($versionsString)
 
static convertVersionStringToArray ($version)
 
static raiseVersionNumber ($raise, $version)
 

Detailed Description

Class with helper functions for version number handling

Definition at line 20 of file VersionNumberUtility.php.

Member Function Documentation

static convertIntegerToVersionNumber (   $versionInteger)
static

Returns the three part version number (string) from an integer, eg 4012003 -> '4.12.3'

Parameters
int$versionIntegerInteger representation of version number
Returns
string Version number as format x.x.x
Exceptions
\InvalidArgumentExceptionif $versionInteger is not an integer

Definition at line 41 of file VersionNumberUtility.php.

static convertVersionNumberToInteger (   $versionNumber)
static

Returns an integer from a three part version number, eg '4.12.3' -> 4012003

Parameters
string$versionNumberVersion number on format x.x.x
Returns
int Integer version of version number (where each part can count to 999)

Definition at line 28 of file VersionNumberUtility.php.

Referenced by GeneralUtility\compat_version(), ListUtility\getExtensionTerData(), DependencyUtility\getLowestAndHighestIntegerVersions(), UpgradeWizard\getUpdateObjectInstance(), and Typo3DependencyViewHelper\isVersionSuitable().

static convertVersionsStringToVersionNumbers (   $versionsString)
static

This function converts version range strings (like '4.2.0-4.4.99') to an array (like array('4.2.0', '4.4.99'). It also forces each version part to be between 0 and 999

Parameters
string$versionsString
Returns
array

Definition at line 119 of file VersionNumberUtility.php.

References MathUtility\forceIntegerInRange(), and GeneralUtility\trimExplode().

static convertVersionStringToArray (   $version)
static

Parses the version number x.x.x and returns an array with the various parts. It also forces each … 0 to 999

Parameters
string$versionVersion code, x.x.x
Returns
array

Definition at line 145 of file VersionNumberUtility.php.

References MathUtility\forceIntegerInRange(), and GeneralUtility\intExplode().

static getCurrentTypo3Version ( )
static

Wrapper function for TYPO3_version constant to make functions using the constant unit testable

Returns
string

Definition at line 106 of file VersionNumberUtility.php.

Referenced by CoreVersionService\getInstalledVersion().

static getNumericTypo3Version ( )
static

Removes -dev -alpha -beta -RC states (also without '-' prefix) from a version number and replaces them by .0 and normalizes to a three part version number

Returns
string

Definition at line 89 of file VersionNumberUtility.php.

References MathUtility\forceIntegerInRange(), and GeneralUtility\intExplode().

Referenced by DependencyUtility\checkTypo3Dependency(), and Typo3DependencyViewHelper\isVersionSuitable().

static raiseVersionNumber (   $raise,
  $version 
)
static

Method to raise a version number

Parameters
string$raiseone of "main", "sub", "dev" - the version part to raise by one
string$version(like 4.1.20)
Returns
string
Exceptions
\TYPO3\CMS\Core\Exception

Definition at line 168 of file VersionNumberUtility.php.

References MathUtility\forceIntegerInRange(), and GeneralUtility\intExplode().

static splitVersionRange (   $version)
static

Splits a version range into an array.

If a single version number is given, it is considered a minimum value. If a dash is found, the numbers left and right are considered as minimum and maximum. Empty values are allowed. If no version can be parsed "0.0.0" — "0.0.0" is the result

Parameters
string$versionA string with a version range.
Returns
array

Definition at line 65 of file VersionNumberUtility.php.