PHP Class Prado\Util\TCallChain

Since: 3.2.3
Author: Brad Anderson ([email protected])
Inheritance: extends Prado\Collections\TList, implements Prado\Util\IDynamicMethods
显示文件 Open project: pradosoft/prado Class Usage Examples

Public Methods

Method Description
__construct ( $method ) This initializes the list and the name of the method to be called
__dycall ( $method, $args ) This catches all the unpatched dynamic events. When the method call matches the call chain method, it passes the arguments to the original __call (of the dynamic event being unspecified in TCallChain) and funnels into the method {@link call}, so the next dynamic event handler can be called.
addCall ( $method, $args ) This initializes the list and the name of the method to be called
call ( ) This method calls the next Callable in the list. All of the method arguments coming into this method are substituted into the original method argument of call in the chain.

Method Details

__construct() public method

This initializes the list and the name of the method to be called
public __construct ( $method )

__dycall() public method

If the original method call has these parameters $originalobject->dyExampleMethod('param1', 'param2', 'param3') and within the chained dynamic events, this can be called class DyBehavior extends TBehavior { public function dyExampleMethod($param1, $param2, $param3, $callchain) $callchain->dyExampleMethod($param1, $param2, $param3) } { to call the next event in the chain.
public __dycall ( $method, $args )

addCall() public method

This initializes the list and the name of the method to be called
public addCall ( $method, $args )

call() public method

If the original method call has these parameters $originalobject->dyExampleMethod('param1', 'param2', 'param3') $callchain->dyExampleMethod('alt1', 'alt2') then the next call in the call chain will recieve the parameters as if this were called $behavior->dyExampleMethod('alt1', 'alt2', 'param3', $callchainobject) When dealing with {@link IClassBehaviors}, the first parameter of the stored argument list in 'dy' event calls is always the object containing the behavior. This modifies the parameter replacement mechanism slightly to leave the object containing the behavior alone and only replacing the other parameters in the argument list. As per {@link __call}, any calls to a 'dy' event do not need the object containing the behavior as the addition of the object to the argument list as the first element is automatic for IClassBehaviors. The last parameter of the method parameter list for any callable in the call chain will be the TCallChain object itself. This is so that any behavior implementing these calls will have access to the call chain. Each callable should either call the TCallChain call method internally for direct chaining or call the method being chained (in which case the dynamic handler will pass through to this call method). If the dynamic intra object/behavior event is not called in the behavior implemented dynamic method, it will return to this method and call the following behavior implementation so as no behavior with an implementation of the dynamic event is left uncalled. This does break the call chain though and will not act as a "parameter filter". When there are no handlers or no handlers left, it returns the first parameter of the argument list.
public call ( )