PHP Class PAGI\Node\NodeActionCommand

Author: Marcelo Gornstein ([email protected])
Datei anzeigen Open project: marcelog/pagi Class Usage Examples

Protected Properties

Property Type Description
$action
$data
$nodeName
$result

Public Methods

Method Description
appliesTo ( Node $node ) : boolean True if the given node (already executed) matches with the specs defined in this action command.
execute ( Closure $callback ) : NodeActionCommand As an action, execute the given callback.
getActionData ( ) : array Returns the action information.
hangup ( integer $cause ) : NodeActionCommand As an action, hangup the call with the given cause.
isActionExecute ( ) : boolean True if a callback should be executed as an action.
isActionHangup ( ) : boolean True if hangup should be done as an action.
isActionJumpTo ( ) : boolean True if we have to jump to another node as an action.
jumpAfterEval ( Closure $callback ) : NodeActionCommand As an action, evaluate the given callback and jump to the node (name) returned by it.
jumpTo ( string $name ) : NodeActionCommand As an action, jump to the given node (name).
onCancel ( ) : NodeActionCommand Do the configured action when the node has been cancelled.
onComplete ( ) : NodeActionCommand Do the configured action when the node has completed successfully.
onMaxAttemptsReached ( ) : NodeActionCommand Do the configured action when the node finished without a valid input from the user.
whenNode ( string $name ) : NodeActionCommand Sets the controlled node.
withInput ( string $input ) : NodeActionCommand Do the configured action when the node has completed successfully with this specific input from the user. Very useful for menues.

Method Details

appliesTo() public method

True if the given node (already executed) matches with the specs defined in this action command.
public appliesTo ( Node $node ) : boolean
$node Node
return boolean

execute() public method

As an action, execute the given callback.
public execute ( Closure $callback ) : NodeActionCommand
$callback Closure
return NodeActionCommand

getActionData() public method

Returns the action information.
public getActionData ( ) : array
return array

hangup() public method

As an action, hangup the call with the given cause.
public hangup ( integer $cause ) : NodeActionCommand
$cause integer
return NodeActionCommand

isActionExecute() public method

True if a callback should be executed as an action.
public isActionExecute ( ) : boolean
return boolean

isActionHangup() public method

True if hangup should be done as an action.
public isActionHangup ( ) : boolean
return boolean

isActionJumpTo() public method

True if we have to jump to another node as an action.
public isActionJumpTo ( ) : boolean
return boolean

jumpAfterEval() public method

As an action, evaluate the given callback and jump to the node (name) returned by it.
public jumpAfterEval ( Closure $callback ) : NodeActionCommand
$callback Closure A string MUST be returned that is the name of the node to jump to.
return NodeActionCommand

jumpTo() public method

As an action, jump to the given node (name).
public jumpTo ( string $name ) : NodeActionCommand
$name string The node name where to jump to.
return NodeActionCommand

onCancel() public method

Do the configured action when the node has been cancelled.
public onCancel ( ) : NodeActionCommand
return NodeActionCommand

onComplete() public method

Do the configured action when the node has completed successfully.
public onComplete ( ) : NodeActionCommand
return NodeActionCommand

onMaxAttemptsReached() public method

Do the configured action when the node finished without a valid input from the user.
public onMaxAttemptsReached ( ) : NodeActionCommand
return NodeActionCommand

whenNode() public method

Sets the controlled node.
public whenNode ( string $name ) : NodeActionCommand
$name string The name of the controlled node.
return NodeActionCommand

withInput() public method

Do the configured action when the node has completed successfully with this specific input from the user. Very useful for menues.
public withInput ( string $input ) : NodeActionCommand
$input string The expected input from the user.
return NodeActionCommand

Property Details

$action protected_oe property

protected $action

$data protected_oe property

protected $data

$nodeName protected_oe property

protected $nodeName

$result protected_oe property

protected $result