Passed
Pull Request — master (#1308)
by Frank
30:36
created

AbstractEvent::eventName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace League\OAuth2\Server\EventEmitting;
5
6
use League\Event\HasEventName;
7
use Psr\EventDispatcher\StoppableEventInterface;
8
9
class AbstractEvent implements  StoppableEventInterface, HasEventName
10
{
11
    /**
12
     * @var string
13
     */
14
    private $name;
15
16
    private $propagationStopped = false;
17
18
    public function __construct(string $name)
19
    {
20
        $this->name = $name;
21
    }
22
23
    public function eventName(): string
24
    {
25
        return $this->name;
26
    }
27
28
    /**
29
     * Backwards compatibility method
30
     *
31
     * @deprecated use eventName instead
32
     */
33
    public function getName(): string
34
    {
35
        return $this->name;
36
    }
37
38
    public function isPropagationStopped(): bool
39
    {
40
        return $this->propagationStopped;
41
    }
42
43
    public function stopPropagation(): self
44
    {
45
        $this->propagationStopped = true;
46
47
        return $this;
48
    }
49
}