Completed
Push — master ( 7860e0...d3b4dd )
by Matthew
02:30 queued 24s
created

VehicleTransformer   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 27
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 17 1
1
<?php
2
3
namespace Ps2alerts\Api\Transformer\Metrics;
4
5
use League\Fractal\TransformerAbstract;
6
7
class VehicleTransformer 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['vehicleID'],
20
            'kills' => [
21
                'infantry' => (int) $data['killICount'],
22
                'vehicle' => (int) $data['killVCount'],
23
                'total' => (int) $data['killCount'],
24
            ],
25
            'deaths' => [
26
                'infantry' => (int) $data['deathICount'],
27
                'vehicle' => (int) $data['deathVCount'],
28
                'total' => (int) $data['deathCount'],
29
            ],
30
            'bails' => (int) $data['bails']
31
        ];
32
    }
33
}
34