DeviceTransformer::transform()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 1
1
<?php
2
namespace App\Api\Transformers;
3
4
use App\Models\Device;
5
use League\Fractal;
6
7
class DeviceTransformer extends Fractal\TransformerAbstract
8
{
9
10
    /**
11
     * Turn this item object into a generic array
12
     *
13
     * @return array
14
     */
15
    public function transform(Device $device)
16
    {
17
        return [
18
            'id'                        => (int) $device->device_id,
19
            'name'                      => $device->hostname,
20
            'icon'                      => $device->icon,
21
            'os'                        => $device->os,
22
            'status'                    => (int) $device->status,
23
        ];
24
    }
25
}
26