A simple example for Observer Pattern

This commit is contained in:
John Skoumbourdis
2013-05-14 08:05:42 +01:00
parent cd2183b2a2
commit cb4a9de3be

View File

@@ -59,7 +59,7 @@ class User implements \SplSubject
} }
/** /**
* *
* *
* @return void * @return void
*/ */
@@ -86,4 +86,9 @@ class User implements \SplSubject
// notify the observers, that user has been updated // notify the observers, that user has been updated
$this->notify(); $this->notify();
} }
} }
$user = new User();
$user->attach(new UserObserver());
$user->notify();