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

OutfitTransformer::transform()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 13

Duplication

Lines 18
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 18
loc 18
rs 9.4285
cc 1
eloc 13
nc 1
nop 1
1
<?php
2
3
namespace Ps2alerts\Api\Transformer\Metrics;
4
5
use League\Fractal\TransformerAbstract;
6
7 View Code Duplication
class OutfitTransformer extends TransformerAbstract
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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
            'outfit'  => [
20
                'id'      => (int) $data['outfitID'],
21
                'name'    => (string) $data['outfitName'],
22
                'tag'     => (string) $data['outfitTag'],
23
                'faction' => (int) $data['outfitFaction']
24
            ],
25
            'metrics' => [
26
                'kills'     => (int) $data['outfitKills'],
27
                'deaths'    => (int) $data['outfitDeaths'],
28
                'teamkills' => (int) $data['outfitTKs'],
29
                'suicides'  => (int) $data['outfitSuicides'],
30
                'captures'  => (int) $data['outfitCaps'],
31
            ]
32
        ];
33
    }
34
}
35