Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcSignalCollection

SignalSlot::ezcSignalCollection

Class ezcSignalCollection

ezcSignalCollection implements a mechanism for inter and intra object communication.

See the tutorial for extensive examples on how to use this class.

Source for this file: /SignalSlot/src/signal_collection.php

Version:   //autogen//

Properties

string read $identifier
The identifier of this signal collection. Usually the class name of the object containing the collection.
bool read/write $signalsBlocked
If set to true emits will not cause any slots to be called.

Method Summary

public static ezcSignalStaticConnectionsBase getStaticConnectionsHolder( )
Returns the current provider of static connections or null if there is none.
public static void setStaticConnectionsHolder( $holder )
If set, $holder will be used to fetch static connections instead of ezcSignalStaticConnections.
public ezcSignalCollection __construct( [ $identifier = "default"] , [ $options = array()] )
Constructs a new signal collection with the identifier $identifier.
public void connect( $signal , $slot , [ $priority = 1000] )
Connects the signal $signal to the slot $slot.
public void disconnect( $signal , $slot , [ $priority = null] )
Disconnects the $slot from the $signal.
public void emit( $signal , $signal_parameters )
Emits the signal with the name $signal
public ezcSignalCollectionOptions getOptions( )
Returns the options for this class.
public bool isConnected( $signal )
Returns true if any slots have been connected to the signal $signal.
public void setOptions( $options )
Sets the options of this class.
public mixed __get( $name )
Returns the property $name.
public void __set( $name , $value )
Sets the property $name to $value.

Methods

getStaticConnectionsHolder

static ezcSignalStaticConnectionsBase getStaticConnectionsHolder( )

Returns the current provider of static connections or null if there is none.

setStaticConnectionsHolder

static void setStaticConnectionsHolder( ezcSignalStaticConnectionsBase $holder )

If set, $holder will be used to fetch static connections instead of ezcSignalStaticConnections.

Parameters:
Name Type Description
$holder ezcSignalStaticConnectionsBase

__construct

ezcSignalCollection __construct( [string $identifier = "default"] , [ $options = array()] )

Constructs a new signal collection with the identifier $identifier.

The identifier can be used to connect to signals statically using ezcSignalStaticConnections.

Through the associative array options you can specify the options for this class in the format array( 'optionName' => value ). See the documentation of ezcSignalCollectionOptions for information on the available options.

Parameters:
Name Type Description
$identifier string
$options array

connect

void connect( string $signal , callback $slot , [int $priority = 1000] )

Connects the signal $signal to the slot $slot.

To control the order in which slots are called you can set a priority from 1 - 65 536. The lower the number the higher the priority. The default priority is 1000. Slots with the same priority may be called with in any order.

A slot will be called once for every time it is connected. It is possible to connect a slot more than once.

See the PHP documentation for examples on the callback type. http://php.net/callback.

We recommend avoiding excessive usage of the $priority parameter since it makes it much harder to track how your program works.

Parameters:
Name Type Description
$signal string
$slot callback
$priority int
Exceptions:
Type Description
ezcSignalSlotException if the signals options has been set and $signal is not in the list of signals.

disconnect

void disconnect( string $signal , callback $slot , [int $priority = null] )

Disconnects the $slot from the $signal.

If the priority is given it will try to disconnect a slot with that priority. If no such slot is found no slot will be disconnected.

If no priority is given it will disconnect the matching slot with the lowest priority.

Parameters:
Name Type Description
$signal string
$slot callback
$priority int
Exceptions:
Type Description
ezcSignalSlotException if the signals options has been set and $signal is not in the list of signals.

emit

void emit( string $signal , ... $signal_parameters )

Emits the signal with the name $signal

Any additional parameters are sent as parameters to the slot.

Parameters:
Name Type Description
$signal string
$signal_parameters ...
Exceptions:
Type Description
ezcSignalSlotException if the signals options has been set and $signal is not in the list of signals.

getOptions

Returns the options for this class.

isConnected

bool isConnected( string $signal )

Returns true if any slots have been connected to the signal $signal.

False is returned if no slots have been connected to the $signal.

Note: Emitting the signal $signal may still not call any slots if the property signalsBlocked has been set.

Parameters:
Name Type Description
$signal string
Exceptions:
Type Description
ezcSignalSlotException if the signals options has been set and $signal is not in the list of signals.

setOptions

void setOptions( ezcSignalCollectionOptions|array(string=>value) $options )

Sets the options of this class.

Parameters:
Name Type Description
$options ezcSignalCollectionOptions|array(string=>value) The options to set either as an associative array in the form array(optionName=>value) or a ezcSignalCollectionOptions object.
Exceptions:
Type Description
ezcBaseSettingNotFoundException If you tried to set a non-existent option value.
ezcBaseSettingValueException If the value is not valid for the desired option.
ezcBaseValueException If you submit neither an array nor an instance of ezcSignalCollectionOptions.

__get

mixed __get( string $name )

Returns the property $name.

Parameters:
Name Type Description
$name string
Exceptions:
Type Description
ezcBasePropertyNotFoundException if the property does not exist.

__set

void __set( string $name , mixed $value )

Sets the property $name to $value.

Parameters:
Name Type Description
$name string
$value mixed
Exceptions:
Type Description
ezcBasePropertyNotFoundException if the property does not exist.
Documentation generated by phpDocumentor 1.4.3