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

Class: MacroCommand

Source Location: /org/puremvc/php/multicore/patterns/command/MacroCommand.php

Class Overview

Notifier
   |
   --MacroCommand

A base ICommand implementation that executes other ICommands.


Author(s):

Implements interfaces:

Variables

Methods


Inherited Constants

Inherited Variables

Inherited Methods

Class: Notifier

Notifier::__construct()
Notifier::facade()
Return the Multiton Facade instance
Notifier::initializeNotifier()
Initialize this INotifier instance.
Notifier::sendNotification()
Send a INotification.

Class Details

[line 53]
A base ICommand implementation that executes other ICommands.

A MacroCommand maintains an list of ICommand Class references called SubCommands.

When execute is called, the MacroCommand instantiates and calls execute on each of its SubCommands turn. Each SubCommand will be passed a reference to the original INotification that was passed to the MacroCommand's execute method.

Unlike SimpleCommand, your subclass should not override execute, but instead, should override the initializeMacroCommand method, calling addSubCommand once for each SubCommand to be executed.




Tags:

see:  SimpleCommand
see:  Notification
see:  Controller


[ Top ]


Class Variables

$subCommands =

[line 56]



Tags:

access:  private

Type:   mixed


[ Top ]



Class Methods


constructor __construct [line 67]

void __construct( )

Constructor.

Your subclass MUST define a constructor, be sure to call parent::__construct(); to have PHP instanciate the whole parent/child chain.




Tags:

access:  public


Overrides Notifier::__construct() (parent method not documented)

[ Top ]

method addSubCommand [line 110]

void addSubCommand( string $commandClassRef)

Add a SubCommand.

The SubCommands will be called in First In/First Out (FIFO) order.




Tags:

access:  protected


Parameters:

string   $commandClassRef   The Class name of the ICommand.

[ Top ]

method execute [line 124]

void execute( INotification $notification)

Execute this MacroCommand's SubCommands.

The SubCommands will be called in First In/First Out (FIFO) order.




Tags:

access:  public



Implementation of:
ICommand::execute()
Execute Command

Parameters:

INotification   $notification   The INotification object to be passsed to each SubCommand.

[ Top ]

method initializeMacroCommand [line 97]

void initializeMacroCommand( )

Initialize the MacroCommand.

In your subclass, override this method to initialize the MacroCommand's SubCommand list with ICommand class references like this:

  1.       // Initialize MyMacroCommand
  2.       protected function initializeMacroCommandvoid
  3.       {
  4.           $this->addSubCommand'FirstCommand' );
  5.           $this->addSubCommand'SecondCommand' );
  6.           $this->addSubCommand'ThirdCommand' );
  7.       }

Note that SubCommands may be any ICommand implementor, MacroCommands or SimpleCommands are both acceptable.




Tags:

access:  protected


[ Top ]


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