OutfitTransformer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 16 2
1
<?php
2
3
namespace Ps2alerts\Api\Transformer\Data;
4
5
use League\Fractal\TransformerAbstract;
6
7
class OutfitTransformer 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
        $obj = [
19
            'id'          => (string) $data->outfit_id, // Bigint
20
            'name'        => (string) $data->name,
21
            'tag'         => (! empty($data->alias)) ? (string) $data->alias : null,
22
            'faction'     => (int) $data->leader->faction_id,
23
            'count'       => (int) $data->member_count,
24
            'leader'      => (string) $data->leader_character_id,
25
            'server'      => (int) $data->server,
26
            'environment' => (string) $data->environment,
27
            'entered'     => (int) date('U')
28
        ];
29
30
        return $obj;
31
    }
32
}
33