Documentation

rex_version
in package

Tags
author

staabm

Table of Contents

Methods

compare()  : bool
Compares two version number strings.
gitHash()  : string|null
Returns the current git version hash for the given path.
isUnstable()  : bool
matchesConstraints()  : bool
Checks the version of the requirement.
split()  : array<int, string>
Splits a version string into its parts.

Methods

compare()

Compares two version number strings.

public static compare(string $version1, string $version2[, "="|"=="|"!="|"<>"|"<"|"<="|">"|">="|null $comparator = '<' ]) : bool

In contrast to version_compare() it treats "1.0" and "1.0.0" as equal and it supports a space as separator for the version parts, e.g. "1.0 beta1"

Parameters
$version1 : string

First version number

$version2 : string

Second version number

$comparator : "="|"=="|"!="|"<>"|"<"|"<="|">"|">="|null = '<'

Optional comparator

Tags
see
https://www.php.net/manual/en/function.version-compare.php
Return values
bool

gitHash()

Returns the current git version hash for the given path.

public static gitHash(string $path[, string|null $repo = null ]) : string|null
Parameters
$path : string

A local filesystem path

$repo : string|null = null

If given, the version hash is returned only if the remote repository matches the given github repo (e.g. redaxo/redaxo)

Return values
string|null

isUnstable()

public static isUnstable(string $version) : bool
Parameters
$version : string
Return values
bool

matchesConstraints()

Checks the version of the requirement.

public static matchesConstraints(string $version, string $constraints) : bool
Parameters
$version : string

Version

$constraints : string

Constraint list, separated by comma

Tags
throws
rex_exception
Return values
bool

split()

Splits a version string into its parts.

public static split(string $version) : array<int, string>
Parameters
$version : string
Return values
array<int, string>

        
On this page

Search results