Completed
Pull Request — master (#9)
by Bernhard
02:13
created

Currency   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 26
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromResponse() 0 13 2
1
<?php
2
3
namespace GloBee\PaymentApi\Models;
4
5
class Currency extends Model
6
{
7
8
    protected $readonlyProperties = [
9
        'id' => null,
10
        'name' => null,
11
    ];
12
13
    /**
14
     * @param array $data
15
     *
16
     * @return Currency[]
17
     */
18 2
    public static function fromResponse(array $data)
19
    {
20 2
        $currencies = [];
21
22 2
        foreach ($data as $currency) {
23 2
            $self = new self();
24 2
            $self->properties['id'] = $currency['id'];
25 2
            $self->properties['name'] = $currency['name'];
26
27 2
            $currencies[] = $self;
28
        }
29
30 2
        return $currencies;
31
    }
32
}
33