PromotionTransformer   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 22
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 12 1
1
<?php
2
3
namespace WSW\SiftScience\Transformers\Entities;
4
5
use WSW\SiftScience\Entities\Promotion;
6
use WSW\SiftScience\Support\Traits\Transformers\Relationships;
7
use WSW\SiftScience\Transformers\AbstractTransformer;
8
9
/**
10
 * Class PromotionTransformer
11
 *
12
 * @package WSW\SiftScience\Transformers\Entities
13
 * @author Ronaldo Matos Rodrigues <[email protected]>
14
 */
15
class PromotionTransformer extends AbstractTransformer
16
{
17
    use Relationships;
18
19
    /**
20
     * @param Promotion $promotion
21
     *
22
     * @return array
23
     */
24 1
    public function transform(Promotion $promotion)
25
    {
26 1
        return array_filter([
27 1
            '$promotion_id' => $promotion->getId(),
28 1
            '$status' => $promotion->getStatus(),
29 1
            '$failure_reason' => $promotion->getFailureReason(),
30 1
            '$description' => $promotion->getDescription(),
31 1
            '$referrer_user_id' => $promotion->getReferrerUserId(),
32 1
            '$discount' => $this->discount($promotion->getDiscount()),
33 1
            '$credit_point' => $this->creditPoint($promotion->getCreditPoint())
34
        ]);
35
    }
36
}
37