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

PopulationTransformer::transform()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 10
loc 10
rs 9.4285
cc 1
eloc 7
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 PopulationTransformer 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
            'timestamp' => (int) $data['timestamp'],
20
            'vs'        => (int) $data['popsVS'],
21
            'nc'        => (int) $data['popsNC'],
22
            'tr'        => (int) $data['popsTR'],
23
            'total'     => (int) $data['popsTotal'],
24
        ];
25
    }
26
}
27