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

Class: Facade

Source Location: /org/puremvc/php/multicore/patterns/facade/Facade.php

Class Overview


A base Multiton IFacade implementation.


Author(s):

Implements interfaces:

Variables

Constants

Methods



Class Details

[line 49]
A base Multiton IFacade implementation.

The Facade Pattern suggests providing a single class to act as a central point of communication for a subsystem.

In PureMVC, the Facade acts as an interface between the core MVC actors ( Model, View, Controller) and the rest of your application.




Tags:

see:  Controller
see:  View
see:  Model


[ Top ]


Class Variables

static $instanceMap = array()

[line 85]

The Multiton Facade instances stack.



Tags:

access:  protected

Type:   array


[ Top ]

$controller =

[line 61]

The controller instance for this Core



Tags:

access:  protected

Type:   Controller


[ Top ]

$model =

[line 67]

The model instance for this Core



Tags:

access:  protected

Type:   Model


[ Top ]

$multitonKey =

[line 79]

The Multiton Key for this Core



Tags:

access:  protected

Type:   string


[ Top ]

$view =

[line 73]

The view instance for this Core



Tags:

access:  protected

Type:   View


[ Top ]



Class Methods


static method getInstance [line 141]

static IFacade getInstance( string $key)

Facade Multiton Factory method

This IFacade implementation is a Multiton, so you MUST not call the constructor directly, but instead call this static Factory method, passing the unique key for this instance




Tags:

return:  Instance for this key
access:  public


Parameters:

string   $key   Unique key for this instance.

[ Top ]

static method hasCore [line 451]

static bool hasCore( string $key)

Check if a Core is registered or not



Tags:

return:  Whether a Core is registered with the given
.
access:  public


Parameters:

string   $key   the multiton key for the Core in question

[ Top ]

static method removeCore [line 465]

static void removeCore( string $key)

Remove a Core.

Remove the Model, View, Controller and Facade instances for the given key.




Tags:

access:  public


Parameters:

string   $key   MultitonKey of the Core to remove

[ Top ]

constructor __construct [line 103]

IFacade __construct( string $key)

Instance constructor

This IFacade implementation is a Multiton, so you should not call the constructor directly, but instead call the static Factory method, passing the unique key for this instance

  1.  Facade::getInstance'multitonKey' )




Tags:

return:  Instance for this key
throws:  Exception if instance for this key has already been constructed.
access:  protected


Parameters:

string   $key   Unique key for this instance.

[ Top ]

method hasCommand [line 332]

bool hasCommand( string $notificationName)

Has Command

Check if a Command is registered for a given Notification




Tags:

return:  Whether a Command is currently registered for the given notificationName.
access:  public



Implementation of:
IFacade::hasCommand()
Has Command

Parameters:

string   $notificationName   Name of the INotification to check for.

[ Top ]

method hasMediator [line 386]

bool hasMediator( string $mediatorName)

Has Mediator

Check if a IMediator is registered or not.




Tags:

return:  Boolean: Whether a IMediator is registered with the given mediatorName.
access:  public



Implementation of:
IFacade::hasMediator()
Has Mediator

Parameters:

string   $mediatorName   The name of the IMediator to check for.

[ Top ]

method hasProxy [line 288]

bool hasProxy( string $proxyName)

Has Proxy

Check if a Proxy is registered for the given proxyName.




Tags:

return:  Boolean: Whether a Proxy is currently registered with the given proxyName.
access:  public



Implementation of:
IFacade::hasProxy()
Has Proxy

Parameters:

string   $proxyName   Name of the Proxy to check for.

[ Top ]

method initializeController [line 167]

void initializeController( )

Initialize the Controller.

Called by the initializeFacade() method.

Override this method in your subclass of Facade if one or both of the following are true:

  • You wish to initialize a different Controller.
  • You have Commands to register with the Controller at startup.
If you don't want to initialize a different Controller, call parent::initializeController() at the beginning of your method, then register Commands.




Tags:

access:  protected


[ Top ]

method initializeFacade [line 123]

void initializeFacade( )

Initialize the Facade instance.

Called automatically by the constructor. Override in your subclass to do any subclass specific initializations. Be sure to call parent::initializeFacade(), though.




Tags:

access:  protected


[ Top ]

method initializeModel [line 199]

void initializeModel( )

Initialize the Model.

Called by the initializeFacade() method.

Override this method in your subclass of Facade if one or both of the following are true:

  • You wish to initialize a different Model.
  • You have Proxys to register with the Model that do not
    retrieve a reference to the Facade at construction time.
If you don't want to initialize a different Model, call parent::initializeModel() at the beginning of your method, then register Proxys.

Note:
This method is rarely overridden; in practice you are more likely to use a Command to create and register Proxys with the Model, since Proxys with mutable data will likely need to send Notifications and thus will likely want to fetch a reference to the Facade during their construction.




Tags:

access:  protected


[ Top ]

method initializeNotifier [line 440]

void initializeNotifier( string $key)

Set the Multiton key for this facade instance.

Not called directly, but instead from the constructor when getInstance is invoked. It is necessary to be public in order to implement INotifier.




Tags:

access:  public



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

Parameters:

string   $key   Unique key for this instance.

[ Top ]

method initializeView [line 231]

void initializeView( )

Initialize the View.

Called by the initializeFacade() method.

Override this method in your subclass of Facade if one or both of the following are true:

  • You wish to initialize a different IView implementation.
  • You have Observers to register with the View
If you don't want to initialize a different
, call
at the beginning of your method, then register
instances.

Note:
This method is rarely overridden; in practice you are more likely to use a Command to create and register Mediators with the View, since IMediator instances will need to send INotifications and thus will likely want to fetch a reference to the Facade during their construction.




Tags:

access:  protected


[ Top ]

method notifyObservers [line 421]

void notifyObservers( INotification $notification)

Notify Observers.

This method is left public mostly for backward compatibility, and to allow you to send custom notification classes using the facade.

Usually you should just call sendNotification and pass the parameters, never having to construct the notification yourself.




Tags:

access:  public



Implementation of:
IFacade::notifyObservers()
Notify Observers.

Parameters:

INotification   $notification   The INotification to have the View notify Observers of.

[ Top ]

method registerCommand [line 302]

void registerCommand( $notificationName, object|string $commandClassRef, string $noteName)

Register Command

Register an ICommand with the Controller.




Tags:

access:  public



Implementation of:
IFacade::registerCommand()
Register Command

Parameters:

string   $noteName   Name of the INotification
object|string   $commandClassRef   ICommand object to register. Can be an object OR a class name.
   $notificationName  

[ Top ]

method registerMediator [line 344]

void registerMediator( IMediator $mediator)

Register Mediator

Register an IMediator instance with the View.




Tags:

access:  public



Implementation of:
IFacade::registerMediator()
Register Mediator

Parameters:

IMediator   $mediator   Reference to the IMediator instance.

[ Top ]

method registerProxy [line 246]

void registerProxy( IProxy $proxy)

Register Proxy

Register an IProxy with the Model.




Tags:

access:  public



Implementation of:
IFacade::registerProxy()
Register Proxy

Parameters:

IProxy   $proxy   The IProxy to be registered with the Model.

[ Top ]

method removeCommand [line 316]

void removeCommand( string $notificationName)

Remove Command

Remove a previously registered ICommand to INotification mapping.




Tags:

access:  public



Implementation of:
IFacade::removeCommand()
Remove Command

Parameters:

string   $notificationName   Name of the INotification to remove the ICommand mapping for.

[ Top ]

method removeMediator [line 373]

IMediator removeMediator( string $mediatorName)

Remove Mediator

Remove a previously registered IMediator instance from the View.




Tags:

return:  The IMediator instance previously registered with the given mediatorName.
access:  public



Implementation of:
IFacade::removeMediator()
Remove Mediator

Parameters:

string   $mediatorName   Name of the IMediator instance to be removed.

[ Top ]

method removeProxy [line 275]

IProxy removeProxy( string $proxyName)

Remove Proxy

Remove a previously registered IProxy instance from the Model by name.




Tags:

return:  The IProxy that was removed from the Model.
access:  public



Implementation of:
IFacade::removeProxy()
Remove Proxy

Parameters:

string   $proxyName   Name of the IProxy to remove from the Model.

[ Top ]

method retrieveMediator [line 360]

IMediator retrieveMediator( string $mediatorName)

Retreive Mediator

Retrieve a previously registered IMediator instance from the View.




Tags:

return:  The IMediator previously registered with the given mediatorName.
access:  public



Implementation of:
IFacade::retrieveMediator()
Retreive Mediator

Parameters:

string   $mediatorName   Name of the IMediator instance to retrieve.

[ Top ]

method retrieveProxy [line 262]

IProxy retrieveProxy( string $proxyName)

Retreive Proxy

Retrieve a previously registered IProxy from the Model by name.




Tags:

return:  The IProxy previously regisetered by proxyName with the Model.
access:  public



Implementation of:
IFacade::retrieveProxy()
Retreive Proxy

Parameters:

string   $proxyName   Name of the IProxy instance to be retrieved.

[ Top ]

method sendNotification [line 402]

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

Create and send an INotification.

Keeps us from 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 =  "Facade instance for this Multiton key already constructed!"

[line 55]

Define the message content for the duplicate instance exception


[ Top ]



Documentation generated on Mon, 03 Aug 2009 04:57:53 +0000 by phpDocumentor 1.4.2