Completed
Push — master ( bb59f2...5ee32e )
by Tony
11s
created

NotificationTransformer   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 19
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 10 1
1
<?php
2
/*
3
 * Copyright (C) 2016 Tony Murray <[email protected]>
4
 * This program is free software: you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation, either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
 */
17
18
namespace App\Api\Transformers;
19
20
use App\Models\Notification;
21
use League\Fractal;
22
23
class NotificationTransformer extends Fractal\TransformerAbstract
24
{
25
    /**
26
     * Turn this item object into a generic array
27
     *
28
     * @param Notification $notification
29
     * @return array
30
     */
31 1
    public function transform(Notification $notification)
32
    {
33
        return [
34 1
            'id'       => (int)$notification->notifications_id,
35 1
            'title'    => $notification->title,
36 1
            'body'     => $notification->body,
37 1
            'source'   => $notification->source,
38 1
            'datetime' => $notification->datetime,
39 1
        ];
40
    }
41
}