ValueObjects /
Common
| 1 | <?php |
||
| 2 | |||
| 3 | namespace ValueObjects\Common\Observers; |
||
| 4 | |||
| 5 | use SplObjectStorage; |
||
| 6 | use ValueObjects\Common\Contracts\Observers\ValueObjectObserverManagerInterface; |
||
| 7 | |||
| 8 | abstract class AbstractValueObjectObserverManager implements ValueObjectObserverManagerInterface |
||
| 9 | { |
||
| 10 | protected SplObjectStorage $observers; |
||
| 11 | protected array $notifying = []; |
||
| 12 | |||
| 13 | public function detachAll(): void |
||
| 14 | { |
||
| 15 | foreach ($this->observers as $observer) { |
||
| 16 | $this->observers->detach($observer); |
||
| 17 | } |
||
| 18 | } |
||
| 19 | |||
| 20 | public function getObservers(): SplObjectStorage |
||
| 21 | { |
||
| 22 | return $this->observers; |
||
| 23 | } |
||
| 24 | |||
| 25 | public function notify(string $event): void |
||
| 26 | { |
||
| 27 | if (isset($this->notifying[$event])) { |
||
| 28 | return; |
||
| 29 | } |
||
| 30 | |||
| 31 | $this->notifying[$event] = null; |
||
| 32 | try { |
||
| 33 | foreach ($this->observers as $observer) { |
||
| 34 | $this->fire($observer, $event); |
||
|
0 ignored issues
–
show
|
|||
| 35 | } |
||
| 36 | } finally { |
||
| 37 | unset($this->notifying[$event]); |
||
| 38 | } |
||
| 39 | } |
||
| 40 | } |
||
| 41 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.