Completed
Push — master ( 92ccbf...b2415b )
by Simonas
63:39
created

MessageUpdateListener   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A onMessageUpdate() 0 4 1
1
<?php
2
3
namespace ONGR\TranslationsBundle\EventListener;
4
5
use ONGR\TranslationsBundle\Event\MessageUpdateEvent;
6
use ONGR\TranslationsBundle\Service\HistoryManager;
7
8
class MessageUpdateListener
9
{
10
    /**
11
     * @var HistoryManager
12
     */
13
    private $historyManager;
14
15
    /**
16
     * @param HistoryManager $historyManager
17
     */
18
    public function __construct(HistoryManager $historyManager)
19
    {
20
        $this->historyManager = $historyManager;
21
    }
22
23
    public function onMessageUpdate(MessageUpdateEvent $e)
24
    {
25
        $this->historyManager->add($e->getMessage(), $e->getDocument());
26
    }
27
}
28