102 lines
1.8 KiB
YAML
102 lines
1.8 KiB
YAML
name: Version
|
|
class_comment: '# * Facilitates the comparison of version strings.
|
|
|
|
# *
|
|
|
|
# * @author Bernhard Schussek <bschussek@gmail.com>'
|
|
dependencies: []
|
|
properties: []
|
|
methods:
|
|
- name: compare
|
|
visibility: public
|
|
parameters:
|
|
- name: version1
|
|
- name: version2
|
|
- name: operator
|
|
- name: precision
|
|
default: 'null'
|
|
comment: '# * Facilitates the comparison of version strings.
|
|
|
|
# *
|
|
|
|
# * @author Bernhard Schussek <bschussek@gmail.com>
|
|
|
|
# */
|
|
|
|
# class Version
|
|
|
|
# {
|
|
|
|
# /**
|
|
|
|
# * Compares two versions with an operator.
|
|
|
|
# *
|
|
|
|
# * This method is identical to {@link version_compare()}, except that you
|
|
|
|
# * can pass the number of regarded version components in the last argument
|
|
|
|
# * $precision.
|
|
|
|
# *
|
|
|
|
# * Examples:
|
|
|
|
# *
|
|
|
|
# * Version::compare(''1.2.3'', ''1.2.4'', ''=='')
|
|
|
|
# * // => false
|
|
|
|
# *
|
|
|
|
# * Version::compare(''1.2.3'', ''1.2.4'', ''=='', 2)
|
|
|
|
# * // => true
|
|
|
|
# *
|
|
|
|
# * @param int|null $precision The number of components to compare. Pass
|
|
|
|
# * NULL to compare the versions unchanged.
|
|
|
|
# *
|
|
|
|
# * @see normalize()'
|
|
- name: normalize
|
|
visibility: public
|
|
parameters:
|
|
- name: version
|
|
- name: precision
|
|
comment: '# * Normalizes a version string to the number of components given in the
|
|
|
|
# * parameter $precision.
|
|
|
|
# *
|
|
|
|
# * Examples:
|
|
|
|
# *
|
|
|
|
# * Version::normalize(''1.2.3'', 1);
|
|
|
|
# * // => ''1''
|
|
|
|
# *
|
|
|
|
# * Version::normalize(''1.2.3'', 2);
|
|
|
|
# * // => ''1.2''
|
|
|
|
# *
|
|
|
|
# * @param int|null $precision The number of components to include. Pass
|
|
|
|
# * NULL to return the version unchanged.'
|
|
- name: __construct
|
|
visibility: private
|
|
parameters: []
|
|
comment: '# * Must not be instantiated.'
|
|
traits: []
|
|
interfaces: []
|