Completed
Push — master ( 2f5ecd...f26b52 )
by dan
01:56
created

DatabaseMessageDispatcher::createDatabaseNotificationEntity()   B

Complexity

Conditions 4
Paths 6

Size

Total Lines 29
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 8.5806
c 0
b 0
f 0
cc 4
eloc 17
nc 6
nop 1
1
<?php
2
3
namespace IrishDan\NotificationBundle\Dispatcher;
4
5
use IrishDan\NotificationBundle\DatabaseNotificationManager;
6
use IrishDan\NotificationBundle\Message\MessageInterface;
7
8
class DatabaseMessageDispatcher implements MessageDispatcherInterface
9
{
10
    protected $databaseNotificationManager;
11
12
    public function __construct(DatabaseNotificationManager $databaseNotificationManager)
13
    {
14
        $this->databaseNotificationManager = $databaseNotificationManager;
15
    }
16
17
    public function dispatch(MessageInterface $message)
18
    {
19
        $dispatchData = $message->getDispatchData();
20
        $messageData = $message->getMessageData();
21
        $data = $dispatchData + $messageData;
22
23
        $databaseNotification = $this->databaseNotificationManager->createDatabaseNotification($data);
24
        if ($databaseNotification) {
25
            return true;
26
        }
27
28
        return false;
29
    }
30
}