XCube
The foundational Core of XoopsCube Legacy
 
Loading...
Searching...
No Matches
XCube_DelegateUtils Class Reference

Utility class which collects utility functions for delegates. More...

Public Member Functions

 __construct ()
 Private Construct. In other words, it's possible to create an instance of this class.
 

Static Public Member Functions

static call ()
 
static raiseEvent ()
 [Static] Utility method for calling event-delegates.
 
static applyStringFilter ()
 
static _compareCallback ( $callback1, $callback2)
 

Detailed Description

Utility class which collects utility functions for delegates.

XCube_DelegateUtils\call("Delegate Name"[, function args...]);
XCube_DelegateUtils\raiseEvent("Event Name"[, function params...]);
$string = XCube_DelegateUtils\applyStringFilter("Filter Name", $string, [, option params...]);

Member Function Documentation

◆ _compareCallback()

static _compareCallback ( $callback1,
$callback2 )
static
Parameters
$callback1callback
$callback2callback
Returns
bool
Attention
Only XCube_Delegate, XCube_DelegateManager and sub-classes of them should use this method.

◆ applyStringFilter()

static applyStringFilter ( )
static
Parameters
1ststring - Delegate Name
2ndstring
3rdand more - Optional function parameters
Returns
string

◆ raiseEvent()

static raiseEvent ( )
static

[Static] Utility method for calling event-delegates.

Parameters
1stDelegate Name
2ndand more : Delegate function parameters
Returns
bool
Deprecated
Use call()

This method is a shortcut for calling delegates without actual delegate objects. If there is not the delegate specified by the 1st parameter, the delegate will be made right now. Therefore, this method is helpful for events.

Note
XCube_DelegateUtils::raiseEvent("Module.A.Exception.Null");
static raiseEvent()
[Static] Utility method for calling event-delegates.
Definition XCube_Delegate.class.php:639

The upper code equals the following code;

{
$local =new XCube_Delegate();
$local->register("Module.A.Exception.Null");
$local->call();
}
[Final] Used for the simple mechanism for common delegation in XCube.
Definition XCube_Delegate.class.php:101
Attention
Only event-owners should use this method. Outside program never calls other's events. This is a kind of XCube_Delegate rules. There is the following code;
ClassA::check()
{
if ($this->mThing == null)
XCube_DelegateUtils::raiseEvent("Module.A.Exception.Null");
}

In this case, another class never calls the event.

//
// NEVER writes the following code;
//
$obj = new ClassA();
if ($obj->mThing == null)
XCube_DelegateUtils::raiseEvent("Module.A.Exception.Null");

Other classes may call only ClassA::check();


The documentation for this class was generated from the following file: