observers = new SplObjectStorage(); } public function attach(SplObserver $observer): void { $this->observers->attach($observer); } public function detach(SplObserver $observer): void { $this->observers->detach($observer); } public function deposit(float $money): void { $this->money += $money; $this->notify(); } public function getAmount(): float { return $this->money; } public function notify(): void { foreach ($this->observers as $observer) { $observer->update($this); } } }