TYPO3CMS  6.2
 All Classes Namespaces Files Functions Variables Pages
Dispatcher Class Reference
Inheritance diagram for Dispatcher:
SingletonInterface

Public Member Functions

 initializeObject ()
 
 connect ($signalClassName, $signalName, $slotClassNameOrObject, $slotMethodName= '', $passSignalInformation=TRUE)
 
 dispatch ($signalClassName, $signalName, array $signalArguments=array())
 
 getSlots ($signalClassName, $signalName)
 

Protected Attributes

 $isInitialized = FALSE
 
 $objectManager
 
 $slots = array()
 

Detailed Description

This file is part of the TYPO3 CMS project.

It is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, either version 2 of the License, or any later version.

For the full copyright and license information, please read the LICENSE.txt file that was distributed with this source code.

The TYPO3 project - inspiring people to share! A dispatcher which dispatches signals by calling its registered slot methods and passing them the method arguments which were originally passed to the signal method.

Definition at line 23 of file SignalSlot/Dispatcher.php.

Member Function Documentation

connect (   $signalClassName,
  $signalName,
  $slotClassNameOrObject,
  $slotMethodName = '',
  $passSignalInformation = TRUE 
)

Connects a signal with a slot. One slot can be connected with multiple signals by calling this method multiple times.

Parameters
string$signalClassNameName of the class containing the signal
string$signalNameName of the signal
mixed$slotClassNameOrObjectName of the class containing the slot or the instantiated class or a Closure object
string$slotMethodNameName of the method to be used as a slot. If $slotClassNameOrObject is a Closure object, this parameter is ignored
boolean$passSignalInformationIf set to TRUE, the last argument passed to the slot will be information about the signal (EmitterClassName::signalName)
Exceptions
InvalidArgumentException
Returns
void

Definition at line 74 of file SignalSlot/Dispatcher.php.

dispatch (   $signalClassName,
  $signalName,
array  $signalArguments = array() 
)

Dispatches a signal by calling the registered Slot methods

Parameters
string$signalClassNameName of the class containing the signal
string$signalNameName of the signal
array$signalArgumentsarguments passed to the signal method
Returns
mixed
Exceptions
ExceptionInvalidSlotException if the slot is not valid
ExceptionInvalidSlotReturnException if a slot returns invalid arguments (too few or return value is not an array)

Definition at line 109 of file SignalSlot/Dispatcher.php.

References Dispatcher\initializeObject().

getSlots (   $signalClassName,
  $signalName 
)

Returns all slots which are connected with the given signal

Parameters
string$signalClassNameName of the class containing the signal
string$signalNameName of the signal
Returns
array An array of arrays with slot information

Definition at line 162 of file SignalSlot/Dispatcher.php.

initializeObject ( )

Initializes this object.

This methods needs to be used as alternative to inject aspects. Since this dispatches is used very early when the ObjectManager is not fully initialized (especially concerning caching framework), this is the only way.

Returns
void

Definition at line 54 of file SignalSlot/Dispatcher.php.

References GeneralUtility\makeInstance().

Referenced by Dispatcher\dispatch().

Member Data Documentation

$isInitialized = FALSE
protected

Definition at line 28 of file SignalSlot/Dispatcher.php.

$objectManager
protected

Definition at line 33 of file SignalSlot/Dispatcher.php.

$slots = array()
protected

Definition at line 42 of file SignalSlot/Dispatcher.php.