xplo.re Medusa Core Framework 3.1
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Event
  • Todo
  • Download

Namespaces

  • Core
    • Authentication
      • Auto
        • Driver
      • Driver
    • Cache
      • Driver
    • Charset
      • Driver
    • Configuration
    • Controller
    • Converter
      • Driver
    • Decoder
      • Driver
    • Encoder
      • Driver
    • Env
      • Authentication
      • Locale
      • Proxy
      • Server
        • HTTP
        • Redirect
        • X
    • Exception
    • Exchange
      • Driver
    • Field
    • Filter
      • Driver
    • Formatter
      • Driver
        • coreuimarkup
          • Token
    • Hash
    • Loader
    • Locale
    • Log
      • Driver
    • Module
      • Dependency
        • Requirement
          • Core
          • PHP
      • Linkage
        • Driver
    • PDF
    • Plugin
    • Query
      • Driver
    • Server
      • Driver
    • Session
      • Driver
    • Set
    • Storage
      • Driver
      • Field
        • Element
    • Stream
      • Driver
    • String
    • Translation
      • Driver
      • Language
        • Driver
    • URI
      • Driver
    • Version
    • View
      • Driver
        • coreui
          • Control
            • Button
            • Table
          • Element
        • htmlbuilder
          • Tags
        • yui
          • Modules
  • None
  • PHP

Classes

  • Authentication
  • Authentication_Token
  • Autoloader
  • Cache
  • Charset
  • ClassDescriptor
  • Closure
  • Controller
  • Converter
  • Date
  • Decoder
  • Delegate
  • Dispatcher
  • Encoder
  • Env
  • Env_Field
  • Env_File
  • Env_FileList
  • Env_Request
  • Env_SERVER
  • Exchange
  • Fault
  • Field
  • Filter
  • Filter_Value
  • Formatter
  • Hash
  • IP
  • Loader
  • Locale
  • Locale_Iterator
  • Locale_Node
  • Log
  • Module
  • Module_Iterator
  • Nothing
  • Object
  • OS
  • Plugin
  • Profiler
  • Query
  • Registry
  • Resource
  • Server
  • Session
  • Session_Token
  • Set
  • Storage
  • Storage_Result
  • Storage_Statement
  • Stream
  • String
  • Translation
  • URI
  • URI_Parameters
  • UUID
  • Value
  • Version
  • View

Interfaces

  • Accessor
  • Chainable
  • Comparable
  • Configurable
  • Equality
  • Identity
  • Inquiry
  • Masquerade
  • Mutator
  • SeekableStream
  • Storable
  • Variator

Exceptions

  • Exception

Constants

  • Copyright
  • ProductName
  • UseVersion
  • Version

Functions

  • ns_expand
  • ns_file_exists
  • ns_get_version
  • ns_resolve

Class Version

Version parsing and comparison helper.

Core\Object implements Core\Chainable
Extended by Core\Set implements Core\Accessor
Extended by Core\Set\Mutable implements Core\Mutator
Extended by Core\Field implements Core\Inquiry
Extended by Core\Version implements Core\Comparable, Core\Equality
Namespace: Core
Package: Core\Version
Since: 3.0
Requires: PHP 5.3
Version: 1.0
Located at Version.inc.php

Methods summary

public
# __construct( string $version )

Initialises a new Version instance.

Initialises a new Version instance.

Beside generic version strings, this method also supports parsing of several SCM keyword strings, e.g. Revision and Id expansions.

Parameters

$version

Version instance to copy values from or a generic version string to parse.

Since

3.0
public string
# __toString( )

Returns a normalised version string.

Returns a normalised version string.

A normalized version string contains either a version hierarchy with an optional revision number or is a standalone revision number.

The hierarchy part contains the major and minor version plus optionally a release number and an extra version string in the following format: MajorV.MinorV[.ReleaseNumber][-ExtraString]. Example of a version 1.2.3 with developer release marker and the revision number 9 is 1.2.3-dev1 (9).

A standalone revision number uses the alternate revision identifier in the following form: r.RevisionNumber, e.g. r.9.

Returns

string
Normalised version string.

Since

3.0

Overrides

Core\Object::__toString
protected array
# _parseVersion( string $versionString )

Internal version parser.

Internal version parser.

Parameters

$versionString
Version string to parse.

Returns

array

Associative array with identified version components extracted from the source version string. Contains the following entries:

  • major

    Major version number.

  • minor

    Minor version number.

  • release

    Release or patch version number.

  • extra

    Additional version information string, such as alpha, beta or dev extensions.

  • revision

    Numeric revision number (hashes are not supported).

  • date

    Date of release.

  • editor

    Arbitrary editor information string.

Since

3.0
public static integer
# compare( Core\Version|string $versionA, Core\Version|string $versionB )

Compares two versions. See Core\Version::compareTo() for details on how versions are compared.

Compares two versions. See Core\Version::compareTo() for details on how versions are compared.

Parameters

$versionA

A Version instance or a generic version string to compare against the second argument.

$versionB

A Version instance or a generic version string to compare against the first argument.

Returns

integer

Returns < 0 if the first version is less than the second; > 0 if the first version is greater than the second, and 0 if both are equal.

See

Core\Version::compareTo()

Since

3.0
public integer
# compareTo( Core\Version|string $version )

Compares the current version again another version. During comparison, both versions are normalised and its segments are compared against each other in the following order; the first difference is reported:

Compares the current version again another version. During comparison, both versions are normalised and its segments are compared against each other in the following order; the first difference is reported:

  1. Major, minor and release numbers are compared against each other; any extra version string is scanned for common identifiers and compared accordingly: unknown_identifier < dev < alpha = a < beta = b < RC = rc < # < pl = p

  2. Any revision number is numerically compared; if no revision number is given, it is considered zero (0);

  3. Any parsed UNIX date stamps are compared against each other.

Extended version comparison as provided by the Version interface is quite expensive; if possible, scalar version IDs should be used whenever available.

Parameters

$version

Another Version instance or a generic version string to compare with the current version.

Returns

integer

Returns < 0 if the current version is less than the argument; > 0 if the current version is greater than the argument, and 0 if both are equal.

Since

3.0

Implementation of

Core\Comparable::compareTo()
public static Core\Version
# createWithComponents( integer $major = null, integer $minor = null, integer $release = null, string $extra = null, integer $revision = null, string|integer $date = null, string $editor = null )

Creates a new Version instance from a set of version components.

Creates a new Version instance from a set of version components.

Parameters

$major
Major version number.
$minor
Minor version number.
$release
Release version number.
$extra
Extra version information string.
$revision
Revision number.
$date
Date string or integer UNIX timestamp.
$editor
Editor name string.

Returns

Core\Version
New Version instance created from the fields provided.

Since

3.1
public string
# hash( )

Returns a hash value based on the stored version data.

Returns a hash value based on the stored version data.

Hash codes of version instances are equal if and only if both instances are equal according to the specifications of the Core\Version::isEqualTo() method.

Returns

string
Hash value of the object.

See

Core\Version::isEqualTo()

Since

3.0

Overrides

Core\Object::hash
public boolean
# isEqualTo( Core\Version|string $version )

Tests, whether two versions are equal. Two versions are considered equal if and only if all version components are equal. This does not include any editor name stored with the Version instance.

Tests, whether two versions are equal. Two versions are considered equal if and only if all version components are equal. This does not include any editor name stored with the Version instance.

Versions are compared based on their version components. A component is considered equal regardless of its existence; therefore if a version component is explicitly stated as zero (0) or omitted, both expressions test equal.

To test whether two versions are equal without doing a binary comparison on extra information, the Core\Version::compareTo() method should be used instead:

if (0 == $v1->compareTo($v2)) { // Versions v1 and v2 are equal, including a non-binary extra // version information test. ...
}

Parameters

$version

Another Version instance or a generic version string to compare with the current version.

Returns

boolean

Returns true, if the provided version and the current Version are equal, otherwise false.

Since

3.0

Implementation of

Core\Equality::isEqualTo()
public Core\Version
# mergeWith( Core\Version|string $version )

Returns a new combined Version instance of the current and given version. Version are merged by overwriting all segment in the current version set with segments of the argument, if a segment of the argument is set.

Returns a new combined Version instance of the current and given version. Version are merged by overwriting all segment in the current version set with segments of the argument, if a segment of the argument is set.

Parameters

$version
Version instance of version string to merge with current version.

Returns

Core\Version

A new Version instance with the merged data of both the current and argument version.

Since

3.0
protected
# versionID( )

Returns the version ID. The returned value is an integer expressing the version number based purely on the major, minor and release version components. It is defined by the following expression:

Returns the version ID. The returned value is an integer expressing the version number based purely on the major, minor and release version components. It is defined by the following expression:

MajorVersion * 10000 + MinorVersion * 100 + ReleaseNumber

Version data with release number greater than 99 will lead to a corrupt version ID by modifying minor or even major version segments. Usage of the version ID should therefore be restricted to controlled version numbers, e.g. environments with a known version numbering scheme.

Since

3.0

Methods inherited from Core\Field

getDataForKey(), getDataForKeys(), getDataForUndefinedKey(), issetDataForKey(), offsetExists(), offsetGet(), offsetSet(), offsetUnset()

Methods inherited from Core\Set\Mutable

__set(), __unset()

Methods inherited from Core\Set

__get(), __isset()

Methods inherited from Core\Object

__autocreateFactory(), __call(), __processParameters(), attachMethod(), chain(), getValueForKey(), getValueForKeyPath(), getValueForUndefinedKey(), issetValueForKey(), setValueForKey(), setValueForKeyPath(), setValueForUndefinedKey(), uuid()

Constants summary

Constants inherited from Core\Object

AnyParameterType, AutochainParameterType, AutocreateParameterType, BooleanParameterType, CharParameterType, EnumParameterType, IntegerParameterType, RealParameterType, StringParameterType, UserParameterType

Properties summary

Properties inherited from Core\Field

$_v_data

Magic properties inherited from Core\Field

$data

Magic properties inherited from Core\Object

$hash, $uuid

xplo.re Medusa Core Framework 3.1 API documentation generated by ApiGen