Stoppable.php 907 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://hyperf.wiki
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  10. */
  11. namespace Hyperf\Event;
  12. trait Stoppable
  13. {
  14. protected bool $propagation = false;
  15. /**
  16. * Is propagation stopped?
  17. * This will typically only be used by the Dispatcher to determine if the
  18. * previous listener halted propagation.
  19. *
  20. * @return bool
  21. * True if the Event is complete and no further listeners should be called.
  22. * False to continue calling listeners.
  23. */
  24. public function isPropagationStopped(): bool
  25. {
  26. return $this->propagation;
  27. }
  28. public function setPropagation(bool $propagation): self
  29. {
  30. $this->propagation = $propagation;
  31. return $this;
  32. }
  33. }