Completed
Push — master ( 7b285b...480624 )
by Rigel Kent
04:14
created

Source::setData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Luigel\Paymongo\Models;
4
5
class Source
6
{
7
    public $id;
8
    public $type;
9
    public $currency;
10
    public $status;
11
    public $amount;
12
    public $redirect;
13
    public $source_type;
14
    public $created_at;
15
16
    public function setData($data)
17
    {
18
        $this->id = $data['id'];
19
        $this->type = $data['type'];
20
        $this->currency = $data['attributes']['currency'];
21
        $this->status = $data['attributes']['status'];
22
        $this->amount = number_format($data['attributes']['amount'] / 100, 2);
23
        $this->redirect = $data['attributes']['redirect'];
24
        $this->source_type = $data['attributes']['type'];
25
        $this->created_at = $data['attributes']['created_at'];
26
27
        return $this;
28
    }
29
}
30