some explanations

This commit is contained in:
Trismegiste
2013-08-24 00:24:30 +02:00
parent 1d04c20f25
commit 99c181f975
3 changed files with 16 additions and 1 deletions

View File

@@ -5,7 +5,7 @@ namespace DesignPatterns\Observer;
/**
* Observer pattern : The observed object (the subject)
*
* The subject maintains a list of Observer and send notificiations.
* The subject maintains a list of Observers and sends notifications.
*
*/
class User implements \SplSubject

View File

@@ -18,6 +18,12 @@ namespace DesignPatterns\Observer;
class UserObserver implements \SplObserver
{
/**
* This is the only method to implement as an observer.
* It is called by the Subject (usually by SplSubject::notify() )
*
* @param \SplSubject $subject
*/
public function update(\SplSubject $subject)
{
echo get_class($subject) . ' has been updated';