NotificationTransformer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A transformResource() 0 11 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
    public function transformResource(DatabaseNotification $notification)
17
    {
18
        $notificationData = (object) $notification->data;
19
20
        return [
21
            'id'      => $notification->getKey(),
22
            'title'   => $notificationData->title,
23
            'message' => $notificationData->message,
24
            'target'  => $notificationData->target,
25
            'tag'     => $notificationData->tag,
26
            'is_read' => isset($notification->read_at) ? true : false,
27
        ];
28
    }
29
}
30