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

ItemTransformer::transform()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 0
cts 14
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 14
nc 1
nop 1
crap 2
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