FacilityDataTransformer::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
cc 1
eloc 7
nc 1
nop 1
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Ps2alerts\Api\Transformer\Data;
4
5
use League\Fractal\TransformerAbstract;
6
7
class FacilityDataTransformer extends TransformerAbstract
8
{
9
    /**
10
     * The transform method required by Fractal to parse the data and return proper typing and fields.
11
     *
12
     * @param  array $data Data to transform
13
     *
14
     * @return array
15
     */
16
    public function transform($data)
17
    {
18
        return [
19
            'id'    => (int) $data['facilityID'],
20
            'name'  => (string) $data['facilityName'],
21
            'type'  => (int) $data['facilityType'],
22
            'zone'  => (int) $data['zone'],
23
            'mapId' => (int) $data['facilityMapID']
24
        ];
25
    }
26
}
27