Merge pull request #17 from scoumbourdis/cb4a9de3be436bb5ae1f1d9460dab449e137ae07

A simple example for Observer Pattern
This commit is contained in:
Dominik Liebler
2013-05-17 14:17:33 -07:00

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();