Passed
Push — master ( 802ddf...d5fac0 )
by Arthur
13:53
created

NotificationTransformer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 12
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A transformResource() 0 10 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arthur
5
 * Date: 29.10.18
6
 * Time: 12:40.
7
 */
8
9
namespace Modules\Notification\Transformers;
10
11
use Foundation\Abstracts\Transformers\Transformer;
12
use Illuminate\Notifications\DatabaseNotification;
13
14
class NotificationTransformer extends Transformer
15
{
16 2
    public function transformResource(DatabaseNotification $notification)
17
    {
18 2
        $notificationData = (object)$notification->data;
19
        return [
20 2
            'id' => $notification->getKey(),
21 2
            'title' => $notificationData->title,
22 2
            'message' => $notificationData->message,
23 2
            'target' => $notificationData->target,
24 2
            'tag' => $notificationData->tag,
25 2
            'is_read' => isset($notification->read_at) ? true : false,
26
        ];
27
    }
28
}
29