XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
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...]);

Definition at line 551 of file XCube_Delegate.class.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

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

Definition at line 556 of file XCube_Delegate.class.php.

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.

Definition at line 692 of file XCube_Delegate.class.php.

◆ applyStringFilter()

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

Definition at line 661 of file XCube_Delegate.class.php.

◆ call()

static call ( )
static

Definition at line 559 of file XCube_Delegate.class.php.

◆ 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.

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.
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();

Definition at line 639 of file XCube_Delegate.class.php.


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