1 | <?php |
||
2 | |||
3 | namespace GloBee\PaymentApi\Models; |
||
4 | |||
5 | class Currency extends Model |
||
6 | { |
||
7 | |||
8 | protected $id; |
||
0 ignored issues
–
show
Coding Style
Documentation
introduced
by
![]() |
|||
9 | protected $name; |
||
0 ignored issues
–
show
|
|||
10 | |||
11 | 2 | public function __construct($id, $name) |
|
0 ignored issues
–
show
|
|||
12 | { |
||
13 | 2 | $this->id = $id; |
|
14 | 2 | $this->name = $name; |
|
15 | 2 | } |
|
16 | |||
17 | /** |
||
18 | * @param array $data |
||
0 ignored issues
–
show
|
|||
19 | * |
||
20 | * @return Currency[] |
||
21 | */ |
||
22 | 2 | public static function fromResponse(array $data) |
|
23 | { |
||
24 | 2 | $currencies = []; |
|
25 | |||
26 | 2 | foreach ($data as $currency) { |
|
27 | 2 | $self = new self($currency['id'], $currency['name']); |
|
28 | |||
29 | 2 | $currencies[] = $self; |
|
30 | } |
||
31 | |||
32 | 2 | return $currencies; |
|
33 | } |
||
34 | } |
||
35 |