PlayerSearchTransformer::transform()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 12

Duplication

Lines 15
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 12
nc 1
nop 1
dl 15
loc 15
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Ps2alerts\Api\Transformer\Search;
4
5
use League\Fractal\TransformerAbstract;
6
7 View Code Duplication
class PlayerSearchTransformer 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
            'id'        => (string) $data['playerID'], // Bigint
20
            'name'      => (string) $data['playerName'],
21
            'outfit'    => (string) $data['playerOutfit'], // Bigint
22
            'faction'   => (int) $data['playerFaction'],
23
            'server'    => (int) $data['playerServer'],
24
            'kills'     => (int) $data['playerKills'],
25
            'deaths'    => (int) $data['playerDeaths'],
26
            'teamkills' => (int) $data['playerTeamKills'],
27
            'suicides'  => (int) $data['playerSuicides'],
28
            'headshots' => (int) $data['headshots']
29
        ];
30
    }
31
}
32