. namespace core\hook; /** * Moodle specific implementation of * \Psr\EventDispatcher\StoppableEventInterface * interface from PSR-14. * * @package core * @author Petr Skoda * @copyright 2023 Open LMS * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ trait stoppable_trait { /** @var bool $propagationstopped propagation is stopped */ private $propagationstopped = false; /** * Allows plugins to notify the hook dispatcher that hook propagation should be stopped */ public function stop_propagation(): void { $this->propagationstopped = true; } /** * Is propagation stopped? * * This will typically only be used by the Dispatcher to determine if the * previous listener halted propagation. * @return bool True if the Event is complete and no further listeners should be called. * False to continue calling listeners. */ public function isPropagationStopped(): bool { return $this->propagationstopped; } }