Total Complexity | 6 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Coverage | 93.75% |
Changes | 0 |
1 | <?php |
||
18 | class SymfonyEventAdapter implements EventManagerAdpter |
||
19 | { |
||
20 | |||
21 | private static $instance; |
||
22 | /** @var EventDispatcher */ |
||
23 | private $eventDispatcher; |
||
24 | |||
25 | 1 | private function __construct() |
|
28 | 1 | } |
|
29 | |||
30 | 2 | public static function getInstance() |
|
31 | { |
||
32 | 2 | if (self::$instance === null) { |
|
33 | 1 | self::$instance = new self(); |
|
34 | } |
||
35 | |||
36 | 2 | return self::$instance; |
|
37 | } |
||
38 | |||
39 | 2 | public function addSubscriber(Subscriber $subscriber) |
|
40 | { |
||
41 | /** @var EventSubscriberInterface $subs */ |
||
42 | 2 | $subs = $subscriber; |
|
43 | 2 | $this->eventDispatcher->addSubscriber($subs); |
|
44 | 2 | } |
|
45 | |||
46 | 2 | public function publish(Event $event) |
|
47 | { |
||
48 | /** @var \Symfony\Component\EventDispatcher\Event $event */ |
||
49 | 2 | $evt = $event; |
|
50 | 2 | $this->eventDispatcher->dispatch($event->getName(), $evt); |
|
|
|||
51 | 2 | } |
|
52 | |||
53 | private function __clone() |
||
55 | } |
||
56 | } |