DeviceTransformer   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 10 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