Passed
Push — master ( 2ed9e5...1d8231 )
by Andrew
02:46 queued 52s
created

EmitterAwarePolyfill::getEventDispatcher()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

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
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace League\OAuth2\Server\EventEmitting;
6
7
use League\Event\ListenerRegistry;
8
use Psr\EventDispatcher\EventDispatcherInterface;
9
10
trait EmitterAwarePolyfill
11
{
12
    private EventEmitter $emitter;
13
14 49
    public function getEmitter(): EventEmitter
15
    {
16 49
        return $this->emitter ??= new EventEmitter();
17
    }
18
19 8
    public function setEmitter(EventEmitter $emitter): self
20
    {
21 8
        $this->emitter = $emitter;
22
23 8
        return $this;
24
    }
25
26 1
    public function getEventDispatcher(): EventDispatcherInterface
27
    {
28 1
        return $this->getEmitter();
29
    }
30
31 1
    public function getListenerRegistry(): ListenerRegistry
32
    {
33 1
        return $this->getEmitter();
34
    }
35
}
36