From 5633c8508cae66dd06981c077730242a869666a1 Mon Sep 17 00:00:00 2001 From: Dominik Liebler Date: Tue, 24 Sep 2013 13:44:11 +0200 Subject: [PATCH] README Observer --- Observer/README.md | 14 ++++++++++++++ Observer/UserObserver.php | 12 +----------- 2 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 Observer/README.md diff --git a/Observer/README.md b/Observer/README.md new file mode 100644 index 0000000..c59a584 --- /dev/null +++ b/Observer/README.md @@ -0,0 +1,14 @@ +# Observer + +## Purpose + +To implement a publish/subscribe behaviour to an object, whenever a "Subject" object changes it's state, the attached +"Observers" will be notified. It is used to shorten the amount of coupled objects and uses loose coupling instead. + +## Examples + +* a message queue system is observed to show the progress of a job in a GUI + +## Note + +PHP already defines two interfaces that can help to implement this pattern: SplObserver and SplSubject. \ No newline at end of file diff --git a/Observer/UserObserver.php b/Observer/UserObserver.php index 549da20..20bdf71 100644 --- a/Observer/UserObserver.php +++ b/Observer/UserObserver.php @@ -3,17 +3,7 @@ namespace DesignPatterns\Observer; /** - * Observer pattern - * - * Purpose: - * to implement a publish/subscribe behaviour to an object, whenever a "Subject" object changes it's state, the attached - * "Observers" will be notified. It is used to shorten the amount of coupled objects and uses loose coupling instead - * - * Examples: - * - a message queue system is observed to show the progress of a job in a GUI - * - * PHP already defines two interfaces that can help to implement this pattern: SplObserver and SplSubject - * + * class UserObserver */ class UserObserver implements \SplObserver {