PHP Class PucFactory, bp-reply-by-email

When multiple versions of the same class have been loaded (e.g. PluginUpdateChecker 1.2 and 1.3), this factory will always use the latest available version. Register class versions by calling {@link PucFactory::addVersion()}. At the moment it can only build instances of the PluginUpdateChecker class. Other classes are intended mainly for internal use and refer directly to specific implementations. If you want to instantiate one of them anyway, you can use {@link PucFactory::getLatestClassVersion()} to get the class name and then create it with new $class(...).
Exibir arquivo Open project: r-a-y/bp-reply-by-email Class Usage Examples

Protected Properties

Property Type Description
$classVersions
$sorted

Public Methods

Method Description
addVersion ( string $generalClass, string $versionedClass, string $version ) Register a version of a class.
buildUpdateChecker ( $metadataUrl, $pluginFile, string $slug = '', integer $checkPeriod = 12, string $optionName = '' ) : PluginUpdateChecker Create a new instance of PluginUpdateChecker.
getLatestClassVersion ( string $class ) : string | null Get the specific class name for the latest available version of a class.

Protected Methods

Method Description
compareVersions ( $a, $b )
sortVersions ( ) Sort available class versions in descending order (i.e. newest first).

Method Details

addVersion() public static method

Register a version of a class.
public static addVersion ( string $generalClass, string $versionedClass, string $version )
$generalClass string Class name without version numbers, e.g. 'PluginUpdateChecker'.
$versionedClass string Actual class name, e.g. 'PluginUpdateChecker_1_2'.
$version string Version number, e.g. '1.2'.

buildUpdateChecker() public static method

Create a new instance of PluginUpdateChecker.
See also: PluginUpdateChecker::__construct()
public static buildUpdateChecker ( $metadataUrl, $pluginFile, string $slug = '', integer $checkPeriod = 12, string $optionName = '' ) : PluginUpdateChecker
$metadataUrl
$pluginFile
$slug string
$checkPeriod integer
$optionName string
return PluginUpdateChecker

compareVersions() protected static method

protected static compareVersions ( $a, $b )

getLatestClassVersion() public static method

Get the specific class name for the latest available version of a class.
public static getLatestClassVersion ( string $class ) : string | null
$class string
return string | null

sortVersions() protected static method

Sort available class versions in descending order (i.e. newest first).
protected static sortVersions ( )

Property Details

$classVersions protected_oe static_oe property

protected static $classVersions

$sorted protected_oe static_oe property

protected static $sorted