Passed
Push — master ( ef2d88...898186 )
by Arthur
06:43
created

NotificationTransformer::toArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 9
nc 2
nop 1
dl 0
loc 13
rs 9.9666
c 0
b 0
f 0
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
12
use Foundation\Abstracts\Transformers\Transformer;
13
14
class NotificationTransformer extends Transformer
15
{
16
    /**
17
     * Transform the resource into an array.
18
     *
19
     * @param \Illuminate\Http\Request $request
20
     *
21
     * @return array
22
     */
23
    public function toArray($request)
24
    {
25
        $notification = (object) $this->data;
0 ignored issues
show
Bug Best Practice introduced by
The property data does not exist on Modules\Notification\Tra...NotificationTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
26
        $resource = [
27
            'id'      => $this->getKey(),
0 ignored issues
show
Bug introduced by
The method getKey() does not exist on Modules\Notification\Tra...NotificationTransformer. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
            'id'      => $this->/** @scrutinizer ignore-call */ getKey(),
Loading history...
28
            'title'   => $notification->title,
29
            'message' => $notification->message,
30
            'target'  => $notification->target,
31
            'tag'     => $notification->tag,
32
            'is_read' => isset($this->read_at) ? true : false,
0 ignored issues
show
Bug Best Practice introduced by
The property read_at does not exist on Modules\Notification\Tra...NotificationTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
33
        ];
34
35
        return $resource;
36
    }
37
}
38