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