Event_SignalEmitter
[ class tree: Event_SignalEmitter ] [ index: Event_SignalEmitter ] [ all elements ]

Class: Event_SignalEmitter

Source Location: /Event_SignalEmitter-0.3.2/Event/SignalEmitter.php

Class Overview


Generic signal emitting class with the same API as GObject.


Author(s):

Variables

Methods


Child classes:

Event_SignalEmitter_Dispatcher
Dispatcher class that can be used as central hub for all signals. For this, it includes a singleton method and allows signals to be emitted from outside.

Inherited Variables

Inherited Methods


Class Details

[line 39]
Generic signal emitting class with the same API as GObject.

Since GObject doesn't allow classes to define or emit own signals, this class provides a PHP implementation with the same API.

Let your own class extend this one, and you have the following methods available:

  • connect
  • connect_simple
  • disconnect
  • block
  • unblock
  • emit
  • register_signal



[ Top ]


Class Variables

$arBlocked = array()

[line 42]

  • Access: protected

Type:   mixed


[ Top ]

$arListener = array()

[line 41]

  • Access: protected

Type:   mixed


[ Top ]

$nNextHandlerNumber =  1

[line 43]

  • Access: protected

Type:   mixed


[ Top ]



Method Detail

block   [line 155]

void block( int $nHandlerId)

Blocks a signal handler
  • Access: public

Parameters:

int   $nHandlerId   —  ID returned by connect()

[ Top ]

connect   [line 54]

int connect( string $strSignal, callback $callback)

Add a listener. Callbacks get the listener object as first parameter.

Also accepts user data as parameter.

  • Return: Signal handler id
  • Access: public

Parameters:

string   $strSignal   —  Signal name (e.g. "go")
callback   $callback   —  Function/Method that should be called

[ Top ]

connectImplementation   [line 107]

int connectImplementation( string $strSignal, callback $callback, boolean $bSimple, array $arUserData)

Internal implementation to add a listener.
  • Return: Signal handler id
  • Access: protected

Parameters:

string   $strSignal   —  Signal name (e.g. "go")
callback   $callback   —  Function/Method that should be called
boolean   $bSimple   —  If it's a simple listener or not
array   $arUserData   —  User defined data to pass to the callback

[ Top ]

connectSimple   [line 242]

int connectSimple( string $strSignal, callback $callback)

Alias of @link connect_simple()

Parameters:

string   $strSignal   —  Signal name (e.g. "go")
callback   $callback   —  Function/Method that should be called

[ Top ]

connect_simple   [line 80]

int connect_simple( string $strSignal, callback $callback)

Add a simple listener. Callbacks do not get the emitter object.

Also accepts user data as parameter.

  • Return: Signal handler id
  • Access: public

Parameters:

string   $strSignal   —  Signal name (e.g. "go")
callback   $callback   —  Function/Method that should be called

[ Top ]

disconnect   [line 134]

boolean disconnect( int $nHandlerId)

Disconnects a signal handler.
  • Return: true if the handler has been found and disconnected
  • Access: public

Parameters:

int   $nHandlerId   —  ID returned by connect()

[ Top ]

emit   [line 188]

void emit( string $strSignal, mixed $param1, ... 2)

Emit a signal to all listeners Takes any number of params.
  • Access: protected

Overridden in child classes as:

Event_SignalEmitter_Dispatcher::emit()
Emit a signal to all listeners.

Parameters:

string   $strSignal   —  Signal to emit (determines listener list)
mixed   $param1   —  Parameter to pass to the receiving functions
...   2   — 

[ Top ]

registerSignal   [line 258]

void registerSignal( string $strSignal)

Alias of @link register_signal()

Parameters:

string   $strSignal   —  Signal name

[ Top ]

register_signal   [line 217]

void register_signal( string $strSignal)

Registers a signal that can be emitted.
  • Access: public

Parameters:

string   $strSignal   —  Signal name

[ Top ]

unblock   [line 169]

void unblock( int $nHandlerId)

Unblocks a signal handler
  • Access: public

Parameters:

int   $nHandlerId   —  ID returned by connect()

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:41:22 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.