mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-03-22 15:20:10 +01:00
bug: enhances example of Observer implementation, with actual change.
This commit is contained in:
parent
152ec3dd34
commit
b5d7e12b21
@ -15,6 +15,7 @@ use SplObserver;
|
||||
class User implements SplSubject
|
||||
{
|
||||
private SplObjectStorage $observers;
|
||||
private $email;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -33,6 +34,7 @@ class User implements SplSubject
|
||||
|
||||
public function changeEmail(string $email)
|
||||
{
|
||||
$this->email = $email;
|
||||
$this->notify();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user