Proposal for "Event_Dispatcher2"

» Metadata » Status
» Description
Rewrite of Event_Dispatcher for php5
several code improvements
also now implements SplSubject
» Dependencies » Links
» Timeline » Changelog
  • First Draft: 2009-04-02
  • Proposal: 2009-04-03
  • Call for Votes: 2009-04-11
  • Voting Extended: 2009-07-20
  • Dmitri Snytkine
    [2009-04-06 14:08 UTC]


    Changes specific to php5:
    Added access modifiers
    Added type hinting
    Added Implements SplSubject
    Added the use of custom Exception classes that extend Pear_Exception

    Other changes:
    Got rid of using $GLOBALS array

    Refactored methods to get rid of duplicate code.
    Extracted method postPendingEvents as a separate method
    Extracted method notifyNestedDispatchers() as a separate method
    Added separate method checkCallback($callback) to check that callback is valid
    This method is used when adding and removing observers
    Added methods attach(), detach(), notify() in order to implement SplSubject interface
    Added option to use an object as an argument for addObserver()
    Method getInstance() now takes a second argument $notificationClass which
    Is the name of notification class and defaults to Event_Notification2
    Added __toString() method, useful for logging and debugging purposes. It
    Returns some basic info about the object like name of dispatcher and name of notification object

    Added accessor methods:
    getRegisteredObservers(),
    getPendingEvents()
  • Dmitri Snytkine
    [2009-04-10 01:56 UTC]

    I made all the changes so that CodeSniffer does not report any errors
    Also make AllTests.php in the tests/ directory

    the latest changes are in the svn here:

    http://dev.sharedlog.com/svn/trunk/Event/