Completed
Push — staging ( 5f9089...8e7d49 )
by Matthew
04:33
created

WeaponTransformer::transform()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 9
rs 9.6666
cc 1
eloc 6
nc 1
nop 1
1
<?php
2
3
namespace Ps2alerts\Api\Transformer\Metrics;
4
5
use League\Fractal\TransformerAbstract;
6
7
class WeaponTransformer 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['weaponID'],
20
            'kills'     => (int) $data['killCount'],
21
            'headshots' => (int) $data['headshots'],
22
            'teamkills' => (int) $data['teamkills']
23
        ];
24
    }
25
}
26