PlayerVehicleTransformer::transform()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 17
rs 9.4285
1
<?php
2
3
namespace Ps2alerts\Api\Transformer\Profiles;
4
5
use League\Fractal\TransformerAbstract;
6
7
class PlayerVehicleTransformer 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['id'],
20
            'kills' => [
21
                'infrantry' => $data['killsInf'],
22
                'vehicles'  => $data['killsVeh'],
23
                'total'     => $data['kills']
24
            ],
25
            'deaths' => [
26
                'infrantry' => $data['deathsInf'],
27
                'vehicles'  => $data['deathsVeh'],
28
                'total'     => $data['deaths'],
29
            ],
30
            'bails' => $data['bails']
31
        ];
32
    }
33
}
34