GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

NotificationTransformer::transform()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 4
Bugs 1 Features 0
Metric Value
c 4
b 1
f 0
dl 0
loc 15
rs 9.4285
ccs 0
cts 15
cp 0
cc 1
eloc 11
nc 1
nop 1
crap 2
1
<?php
2
3
namespace App\Transformers;
4
5
use App\Notification;
6
use League\Fractal\TransformerAbstract;
7
8
class NotificationTransformer extends TransformerAbstract
9
{
10
    /**
11
     * Turn this item object into a generic array.
12
     *
13
     * @param Notification $notification
14
     *
15
     * @return array
16
     */
17
    public function transform(Notification $notification)
18
    {
19
        return [
20
            'id'        => (int) $notification->id,
21
            'icon'      => (string) $notification->icon,
22
            'link'      => (string) $notification->link,
23
            'message'   => (string) $notification->message,
24
            'dismissed' => (bool) $notification->dismissed,
25
            'created'   => [
26
                'timestamp' => $notification->created_at->getTimestamp(),
27
                'date'      => (string) $notification->created_at->toFormattedDateString(),
28
                'readable'  => (string) $notification->created_at->diffForHumans(),
29
            ],
30
        ];
31
    }
32
}
33