Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.1.0

Request #15271 Converted for php5
Submitted: 2008-12-07 22:34 UTC
From: snytkine Assigned: mgocobachi
Status: Assigned Package: Event_Dispatcher (version 1.0.0)
PHP Version: 5.2.0 OS: RHEL4
Roadmaps: (Not assigned)    
Subscription  


 [2008-12-07 22:34 UTC] snytkine (Dmitri Snytkine)
Description: ------------ Hi I converted this package to be used with PHP5, made some vars really private, changed == to === in many places, which is specially important in cases like == 0 and == true changed __construct to private, getInstance() to singleton, is_a() to instanceof, removed passing objects by reference, added __toString, added 2 Exception classes extending PEAR_Exception, added some input variables check to addObserver() that throw exceptions on validation failures, added option to pass only an object as argument to addObserver() but object must have Notify() method. This is sort of an implementation of observer design pattern - must have Notify(). also added type hinting to postNotification() Please have a look and maybe we can release the Event_Dispatcher2 for php5

Comments

 [2008-12-07 22:40 UTC] snytkine (Dmitri Snytkine)
I was unable to attache the zip files because this system only allows to attache the .diff files You can download the new files here: http://dev.sharedlog.com/Event_Dispatcher2.zip
 [2008-12-07 22:43 UTC] snytkine (Dmitri Snytkine)
Forgot to also mention that instead of global constants it now uses class constants, and also removed the user of $GLOBALS[] array No need to pollute global namespace
 [2008-12-08 08:36 UTC] mansion (Bertrand Mansion)
Hi, I don't have the time to manage the package anymore. If you would like to handle it, please let me know. But before, please write some unit tests to make sure things work correctly since it seems you changed the API a bit. For your constants, you should name them this way: Event_Notification::DEFAULT_STATE Instead of: Event_Notification::EVENT_NOTIFICATION_STATE_DEFAULT You can also add 'public' or 'protected' in front of your method signatures. You shouldn't change getInstance() to singleton(). The word singleton doesn't mean anything for me (although I know what it is). getInstance() is more meaningful. You changed NOTIFICATION_CLASS to private, this makes it impossible to set a different notification class. You might want to add a constructor parameter instead: __construct($name, $notificationClass = 'Event_Notification')
 [2008-12-08 13:42 UTC] snytkine (Dmitri Snytkine)
Thank you. Sure, I can take over this class I have been using pear for awhile now. I use over 15 pear classes in my project, including the pear installer to install and manage my project itself. I also maintain pear server to distribute my project and my project itself is distributed as pear package. it's here: http://opensourcecms.sharedlog.com/ Now about the Event_Notification: I just started using it 2 days ago, that's when I decided to change it to php5 to play nice with E_STRICT I still don't understand what is the purpose of ability to set a different notification class? Please explain this to me. I can also add some more to documentation, like some examples on how I am using it.
 [2008-12-27 05:36 UTC] doconnor (Daniel O'Connor)
I just marked the package as unmaintained, is that alright with you Bertrand?
 [2008-12-27 10:10 UTC] mansion (Bertrand Mansion)
That's fine with me.
 [2011-09-02 21:20 UTC] hm2k (James Wade)
-Assigned To: +Assigned To: doconnor
http://pear.php.net/package/Event_Dispatcher This page doesn't say this package is unmaintained. Also, snytkine agreed to take on the package but was not added. Please can someone take action on this? Alternatively, one of the existing developers (mgocobachi or schst) could apply these fixes. Thanks.
 [2011-09-02 21:30 UTC] hm2k (James Wade)
PHP Deprecated: Assigning the return value of new by reference is deprecated in /usr/share/pear/Event/Dispatcher.php on line 249
 [2011-09-02 21:57 UTC] mgocobachi (Miguel Gocobachi)
-Assigned To: doconnor +Assigned To: mgocobachi
 [2011-09-02 22:03 UTC] mgocobachi (Miguel Gocobachi)
I am going to work on it this weekend, thank you for your feedback.
 [2011-09-29 12:41 UTC] doconnor (Daniel O'Connor)
Dmitri did put a proposal up; it just didn't get much traction. I think we're still happy to look at that code for a possible Event_Dispatcher2 - thoughts Miguel? See http://pear.php.net/pepr/pepr-votes-show.php?id=596 Also; feel like migrating this one to github? (https://github.com/pear/pear-svn-git makes this easy)