Completed
Push — master ( 4a8c36...355a61 )
by Hong
02:15
created

StoppableEvent::isPropagationStopped()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * Phoole (PHP7.2+)
5
 *
6
 * @category  Library
7
 * @package   Phoole\Event
8
 * @copyright Copyright (c) 2019 Hong Zhang
9
 */
10
declare(strict_types=1);
11
12
namespace Phoole\Event\Events;
13
14
use Psr\EventDispatcher\StoppableEventInterface;
15
16
/**
17
 * StoppableEvent prototype
18
 *
19
 * @package Phoole\Event
20
 */
21
abstract class StoppableEvent implements StoppableEventInterface
22
{
23
    /**
24
     * @var    bool
25
     */
26
    protected $stopped = FALSE;
27
28
    /**
29
     * Is propagation stopped?
30
     *
31
     * This will typically only be used by the Dispatcher to determine if the
32
     * previous listener halted propagation.
33
     *
34
     * @return bool
35
     *   True if the Event is complete and no further listeners should be called.
36
     *   False to continue calling listeners.
37
     */
38
    public function isPropagationStopped(): bool
39
    {
40
        return $this->stopped;
41
    }
42
43
    /**
44
     * @return void
45
     */
46
    public function stopEvent(): void
47
    {
48
        $this->stopped = TRUE;
49
    }
50
}