mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-01 12:40:11 +02:00
A simple example for Observer Pattern
This commit is contained in:
@@ -87,3 +87,8 @@ class User implements \SplSubject
|
||||
$this->notify();
|
||||
}
|
||||
}
|
||||
|
||||
$user = new User();
|
||||
$user->attach(new UserObserver());
|
||||
|
||||
$user->notify();
|
||||
|
Reference in New Issue
Block a user