VersionTools
in package
Table of Contents
Methods
- dropBuildId() : string
- Drop the build ID from a semantic version name.
- intVersionToHumanString() : string
- Transform int formatted version to a human readable string (remove useless 0 if needed), optionnaly remove patch version.
- intVersionToSortableString() : string
- Transform int formatted version (from 5 or 6 integer) to a sortable string.
- qgisMajMinHumanVersion() : string
- Transform integer QGIS version major minor to the human name.
- qgisVersionWithNameToInt() : int
- Transform a QGIS version with its name to a sortable int version.
Methods
dropBuildId()
Drop the build ID from a semantic version name.
public
static dropBuildId(string $version) : string
For instance, 3.10.0-pre.8697 → 3.10.0-pre.
Parameters
- $version : string
-
The version to clean
Return values
string —The cleaned version
intVersionToHumanString()
Transform int formatted version to a human readable string (remove useless 0 if needed), optionnaly remove patch version.
public
static intVersionToHumanString(string $intVersion[, bool $stripPatch = false ]) : string
! short version (342 for 3.42) are not handled.
Transform "59000" into "5.90.00" Transform "059000" into "5.90.00" Transform "250208" into "25.2.8" Transform "250208" into "25.2" (strip patch set to true) Transform "031400" into "3.14" (strip patch set to true)
Parameters
- $intVersion : string
-
a version number as int (major version on 1 or 2 digit, min and patch version on 2 digit)
- $stripPatch : bool = false
-
remove the patch version (default false)
Return values
string —the version as human readable string
intVersionToSortableString()
Transform int formatted version (from 5 or 6 integer) to a sortable string.
public
static intVersionToSortableString(string $intVersion) : string
Transform "10102" into "01.01.02" Transform "050912" into "05.09.12"
Parameters
- $intVersion : string
-
the lizmap QGIS plugin version (not always int !!)
Return values
string —the version as sortable string
qgisMajMinHumanVersion()
Transform integer QGIS version major minor to the human name.
public
static qgisMajMinHumanVersion(mixed $qgisIntVersion) : string
For instance, 0340 → 3.40.
Parameters
- $qgisIntVersion : mixed
Return values
string —The cleaned version
qgisVersionWithNameToInt()
Transform a QGIS version with its name to a sortable int version.
public
static qgisVersionWithNameToInt(string $versionString) : int
Transform "3.34.12-Prizren" into "33412"
Parameters
- $versionString : string
-
Name of the version