Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
/*
6
 * This file is part of the league/commonmark package.
7
 *
8
 * (c) Colin O'Dell <colinodell@gmail.com>
9
 *
10
 * Original code based on the Symfony EventDispatcher "Event" contract
11
 *  - (c) 2018-2019 Fabien Potencier
12
 *
13
 * For the full copyright and license information, please view the LICENSE
14
 * file that was distributed with this source code.
15
 */
16
 
17
namespace League\CommonMark\Event;
18
 
19
use Psr\EventDispatcher\StoppableEventInterface;
20
 
21
/**
22
 * Base class for classes containing event data.
23
 *
24
 * This class contains no event data. It is used by events that do not pass
25
 * state information to an event handler when an event is raised.
26
 *
27
 * You can call the method stopPropagation() to abort the execution of
28
 * further listeners in your event listener.
29
 */
30
abstract class AbstractEvent implements StoppableEventInterface
31
{
32
    /** @psalm-readonly-allow-private-mutation */
33
    private bool $propagationStopped = false;
34
 
35
    /**
36
     * Returns whether further event listeners should be triggered.
37
     */
38
    final public function isPropagationStopped(): bool
39
    {
40
        return $this->propagationStopped;
41
    }
42
 
43
    /**
44
     * Stops the propagation of the event to further event listeners.
45
     *
46
     * If multiple event listeners are connected to the same event, no
47
     * further event listener will be triggered once any trigger calls
48
     * stopPropagation().
49
     */
50
    final public function stopPropagation(): void
51
    {
52
        $this->propagationStopped = true;
53
    }
54
}