FormioJwt::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Spinen\Formio\Http\Resources;
4
5
//use Illuminate\Http\Resources\Json\JsonResource;
6
7
// TODO: When dropping support of Laravel 5.5, remove this if/else
8 1
if (class_exists('Illuminate\Http\Resources\Json\JsonResource')) {
9
    class JsonResource extends \Illuminate\Http\Resources\Json\JsonResource
10
    {
11
12
    }
13
} else {
14
    // NOTE: Only here to support Laravel 5.5
15
    class JsonResource extends \Illuminate\Http\Resources\Json\Resource
16
    {
17
18
    }
19
}
20
21
class FormioJwt extends JsonResource
22
{
23
    /**
24
     * Transform the resource into an array.
25
     *
26
     * @param \Illuminate\Http\Request $request
27
     *
28
     * @return array
29
     */
30 3
    public function toArray($request)
31
    {
32
        return [
33 3
            'expires_at' => $this->expires_at->toIso8601String(),
34 3
            'jwt'        => $this->jwt,
35
        ];
36
    }
37
}
38