TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
VersionNumberUtility Class Reference
Inheritance diagram for VersionNumberUtility:
VersionNumberUtilityFixture

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
InvalidArgumentException if $versionInteger is not an integer

Definition at line 49 of file VersionNumberUtility.php.

Referenced by VersionNumberUtilityTest\convertIntegerToVersionNumberConvertsIntegerToVersionNumber(), and VersionNumberUtilityTest\convertIntegerToVersionNumberConvertsOtherTypesAsIntegerToVersionNumber().

static convertVersionNumberToInteger (   $versionNumber)
static
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 127 of file VersionNumberUtility.php.

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

Referenced by VersionNumberUtilityTest\convertVersionsStringToVersionNumbersForcesVersionNumberInRange().

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 153 of file VersionNumberUtility.php.

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

Referenced by ExtensionListUtility\loadIntoDatabase().

static getCurrentTypo3Version ( )
static

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

Returns
string

Definition at line 114 of file VersionNumberUtility.php.

Referenced by CoreVersionService\getInstalledVersion(), and SystemInformationToolbarItem\getTypo3Version().

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 97 of file VersionNumberUtility.php.

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

Referenced by DependencyUtility\checkTypo3Dependency(), VersionNumberUtilityTest\getNumericTypo3VersionNumber(), 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

Definition at line 176 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 73 of file VersionNumberUtility.php.