org-puremvc-php-multicore
[ class tree: org-puremvc-php-multicore ] [ index: org-puremvc-php-multicore ] [ all elements ]

Class: Notifier

Source Location: /org/puremvc/php/multicore/patterns/observer/Notifier.php

Class Overview


A Base
implementation.


Author(s):

Implements interfaces:

Variables

Constants

Methods


Child classes:

MacroCommand
A base ICommand implementation that executes other ICommands.
SimpleCommand
A base ICommand implementation.
Mediator
A base IMediator implementation.
Proxy
A base IProxy implementation.

Class Details

[line 64]
A Base
implementation.

MacroCommand, SimpleCommand, Mediator and Proxy all have a need to send Notifications.

The INotifier interface provides a common method called sendNotification that relieves implementation code of the necessity to actually construct Notifications.

The Notifier class, which all of the above mentioned classes extend, also provides an initialized reference to the Facade Singleton, which is required for the convienience method for sending Notifications, but also eases implementation as these classes have frequent Facade interactions and usually require access to the facade anyway.

NOTE:
In the MultiCore version of the framework, there is one caveat to notifiers, they cannot send notifications or reach the facade until they have a valid multitonKey.

The multitonKey is set:

  • on a Command when it is executed by the Controller
  • on a Mediator is registered with the View
  • on a Proxy is registered with the Model.




Tags:

see:  SimpleCommand
see:  MacroCommand
see:  Mediator
see:  Facade
see:  Proxy


[ Top ]


Class Variables

$multitonKey =  null

[line 76]

The Multiton Key for this Core



Tags:

access:  protected

Type:   string


[ Top ]



Class Methods


constructor __construct [line 78]

Notifier __construct( )



Tags:

access:  public


Overridden in child classes as:

MacroCommand::__construct()
Constructor.
SimpleCommand::__construct()
Constructor.
Mediator::__construct()
Constructor.
Proxy::__construct()
Constructor

[ Top ]

method facade [line 130]

Facade facade( )

Return the Multiton Facade instance



Tags:

return:  The Facade instance for this Notifier multitonKey.
throws:  Exception if multitonKey for this Notifier is not yet initialized.
access:  protected


[ Top ]

method initializeNotifier [line 119]

void initializeNotifier( string $key)

Initialize this INotifier instance.

This is how a Notifier gets its multitonKey. Calls to sendNotification or to access the facade will fail until after this method has been called.

Mediators, Commands or Proxies may override this method in order to send notifications or access the Multiton Facade instance as soon as possible. They CANNOT access the facade in their constructors, since this method will not yet have been called.




Tags:

access:  public



Implementation of:
INotifier::initializeNotifier()
Initialize this INotifier instance.

Parameters:

string   $key   The multitonKey for this INotifier to use.

[ Top ]

method sendNotification [line 93]

void sendNotification( string $notificationName, [mixed $body = null], [string $type = null])

Send a INotification.

Convenience method to prevent having to construct new notification instances in our implementation code.




Tags:

access:  public



Implementation of:
INotifier::sendNotification()
Send a INotification.

Parameters:

string   $notificationName   The name of the notification to send.
mixed   $body   The body of the notification (optional).
string   $type   The type of the notification (optional).

[ Top ]


Class Constants

MULTITON_MSG =  "multitonKey for this Notifier not yet initialized!"

[line 70]

Define the message content for the inexistant instance exception


[ Top ]



Documentation generated on Mon, 03 Aug 2009 04:58:01 +0000 by phpDocumentor 1.4.2