Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| StoppableEventTrait | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| isPropagationStopped | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| stopPropagation | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** |
| 6 | * This file is part of php-fast-forward/event-dispatcher. |
| 7 | * |
| 8 | * This source file is subject to the license bundled |
| 9 | * with this source code in the file LICENSE. |
| 10 | * |
| 11 | * @copyright Copyright (c) 2025-2026 Felipe Sayão Lobato Abreu <github@mentordosnerds.com> |
| 12 | * @license https://opensource.org/licenses/MIT MIT License |
| 13 | * |
| 14 | * @see https://github.com/php-fast-forward/event-dispatcher |
| 15 | * @see https://github.com/php-fast-forward |
| 16 | * @see https://datatracker.ietf.org/doc/html/rfc2119 |
| 17 | */ |
| 18 | |
| 19 | namespace FastForward\EventDispatcher\Event; |
| 20 | |
| 21 | /** |
| 22 | * Store propagation state for stoppable events. |
| 23 | */ |
| 24 | trait StoppableEventTrait |
| 25 | { |
| 26 | /** |
| 27 | * Current propagation state. |
| 28 | */ |
| 29 | private bool $propagationStopped = false; |
| 30 | |
| 31 | /** |
| 32 | * Determine whether propagation has been stopped. |
| 33 | * |
| 34 | * @return bool whether propagation is currently stopped |
| 35 | */ |
| 36 | public function isPropagationStopped(): bool |
| 37 | { |
| 38 | return $this->propagationStopped; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Stop further listener propagation for the current event. |
| 43 | */ |
| 44 | public function stopPropagation(): void |
| 45 | { |
| 46 | $this->propagationStopped = true; |
| 47 | } |
| 48 | } |