Completed
Push — ezp-30616 ( 9239a0...7bf8e8 )
by
unknown
57:53 queued 37:56
created

SymfonyEventConverterSlot::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * File containing the SymfonyEventConverterSlot class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Bundle\EzPublishCoreBundle\SignalSlot\Slot;
10
11
use eZ\Publish\Core\MVC\Symfony\Event\SignalEvent;
12
use eZ\Publish\Core\MVC\Symfony\MVCEvents;
13
use eZ\Publish\Core\SignalSlot\Signal;
14
use eZ\Publish\Core\SignalSlot\Slot;
15
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
16
17
/**
18
 * Generic slot that converts signals emitted by Repository services into Symfony events.
19
 */
20
class SymfonyEventConverterSlot extends Slot
21
{
22
    /**
23
     * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
24
     */
25
    private $eventDispatcher;
26
27
    public function __construct(EventDispatcherInterface $eventDispatcher)
28
    {
29
        $this->eventDispatcher = $eventDispatcher;
30
    }
31
32
    /**
33
     * Receive the given $signal and react on it.
34
     *
35
     * @param Signal $signal
36
     */
37
    public function receive(Signal $signal)
38
    {
39
        $this->eventDispatcher->dispatch(MVCEvents::API_SIGNAL, new SignalEvent($signal));
40
    }
41
}
42