Completed
Push — master ( f8a59f...796b11 )
by Dmitry
02:31
created

PriceCreationDto::fromArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 9
ccs 0
cts 1
cp 0
rs 9.6666
cc 2
eloc 5
nc 2
nop 1
crap 6
1
<?php
2
3
namespace hiqdev\billing\hiapi\repositories;
4
5
class PriceCreationDto
6
{
7
    public $id;
8
9
    public $type;
10
11
    public $type_id;
12
13
    public $target_id;
14
15
    public $target_name;
16
17
    public $target_type_id;
18
19
    public $target_type_name;
20
21
    public $quantity;
22
23
    public $unit;
24
25
    public $currency;
26
27
    public $price;
28
29
    public static function fromArray(array $items)
30
    {
31
        $instance = new self;
32
        foreach ($items as $key => $value) {
33
            $instance->$key = $value;
34
        }
35
36
        return $instance;
37
    }
38
}
39