CalculatorTransformer::transform()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 15
rs 9.4285
cc 1
eloc 12
nc 1
nop 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
}