Conditions | 6 |
Paths | 32 |
Total Lines | 29 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 0 |
1 | <?php |
||
64 | public static function createFromArray(array $data): self |
||
65 | { |
||
66 | $id = -1; |
||
67 | if (isset($data['id'])) { |
||
68 | $id = $data['id']; |
||
69 | } |
||
70 | |||
71 | $code = ''; |
||
72 | if (isset($data['code'])) { |
||
73 | $code = $data['code']; |
||
74 | } |
||
75 | |||
76 | $name = ''; |
||
77 | if (isset($data['name'])) { |
||
78 | $name = $data['name']; |
||
79 | } |
||
80 | |||
81 | $description = ''; |
||
82 | if (isset($data['description'])) { |
||
83 | $description = $data['description']; |
||
84 | } |
||
85 | |||
86 | $price = -1; |
||
87 | if (isset($data['price'])) { |
||
88 | $price = $data['price']; |
||
89 | } |
||
90 | |||
91 | return new self($id, $code, $name, $description, $price); |
||
92 | } |
||
93 | |||
119 |