Passed
Pull Request — master (#18)
by Alex
02:18
created

ImmutableEventDispatcher   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 60%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 2
eloc 4
c 1
b 1
f 0
dl 0
loc 21
ccs 3
cts 5
cp 0.6
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getListenerProvider() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arp\EventDispatcher;
6
7
use Psr\EventDispatcher\ListenerProviderInterface;
8
9
/**
10
 * An event dispatcher that does not expose any methods that are able to modify or change the listener provider
11
 * that is passed in during construction.
12
 *
13
 * @author  Alex Patterson <[email protected]>
14
 * @package Arp\EventDispatcher
15
 */
16
final class ImmutableEventDispatcher extends AbstractEventDispatcher
17
{
18
    /**
19
     * @var ListenerProviderInterface
20
     */
21
    private ListenerProviderInterface $listenerProvider;
22
23
    /**
24
     * @param ListenerProviderInterface $listenerProvider
25
     */
26 1
    public function __construct(ListenerProviderInterface $listenerProvider)
27
    {
28 1
        $this->listenerProvider = $listenerProvider;
29 1
    }
30
31
    /**
32
     * @return ListenerProviderInterface
33
     */
34
    protected function getListenerProvider(): ListenerProviderInterface
35
    {
36
        return $this->listenerProvider;
37
    }
38
}
39