Completed
Push — master ( fb0370...84a128 )
by Ronaldo
03:03
created

ItemTransformer   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 20
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 17 1
1
<?php
2
3
namespace WSW\SiftScience\Transformers;
4
5
use WSW\SiftScience\Entities\Item;
6
7
/**
8
 * Class ItemTransformer
9
 *
10
 * @package WSW\SiftScience\Transformers
11
 * @author Ronaldo Matos Rodrigues <[email protected]>
12
 */
13
class ItemTransformer extends AbstractTransformer
14
{
15
    public function transform(Item $item)
16
    {
17
        return array_filter([
18
            '$item_id' => $item->getId(),
19
            '$product_title' => $item->getTitle(),
20
            '$price' => $item->getPrice()->getMicros(),
21
            '$currency_code' => $item->getPrice()->getCurrency()->getCode(),
22
            '$quantity' => $item->getQuantity(),
23
            '$upc' => $item->getUpc(),
24
            '$sku' => $item->getSku(),
25
            '$brand' => $item->getBrand(),
26
            '$manufacturer' => $item->getManufacturer(),
27
            '$category' => $item->getCategory(),
28
            '$tags' => $item->getTags(),
29
            '$color' => $item->getColor()
30
        ]);
31
    }
32
}
33