CalculatorTransformer   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 15 1
1
<?php
2
3
namespace App\Http\Transformers;
4
5
6
/**
7
 * Class CalculatorTransformer
8
 * @package App\Http\Transformers
9
 */
10
class CalculatorTransformer extends Transformer
11
{
12
    /**
13
     * @param $calcul
14
     * @return array
15
     */
16
    public function transform($calcul)
17
    {
18
        return [
19
            'user_id' => $calcul['user_id'],
20
            'name' => $calcul['name'],
21
            'quantity_to_buy' =>(Float) $calcul['quantity_to_buy'],
22
            'quote_to_buy' =>(Float) $calcul['quote_to_buy'],
23
            'price_to_buy' => (Float)$calcul['price_to_buy'],
24
            'quantity_to_sell' => (Float)$calcul['quantity_to_sell'],
25
            'quote_to_sell' => (Float)$calcul['quote_to_sell'],
26
            'tax_percent_to_discount' => (Float)$calcul['tax_percent_to_discount'],
27
            'price_to_sell' => (Float)$calcul['price_to_sell'],
28
            'gains_or_losses' => (Float)$calcul['gains_or_losses'],
29
        ];
30
    }
31
}