Conditions | 3 |
Paths | 4 |
Total Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
38 | public static function make( |
||
39 | string $code, |
||
40 | $value, |
||
41 | int $sortOrder, |
||
42 | bool $isConsumable = null |
||
43 | ): Model { |
||
44 | $attributes = [ |
||
45 | 'code' => $code, |
||
46 | 'value' => $value, |
||
47 | 'sort_order' => $sortOrder, |
||
48 | ]; |
||
49 | |||
50 | if (is_bool($value)) { |
||
51 | $attributes['is_consumable'] = false; |
||
52 | } else { |
||
53 | $attributes['is_consumable'] = true; |
||
54 | } |
||
55 | |||
56 | if ($isConsumable != null) { |
||
57 | $attributes['is_consumable'] = $isConsumable; |
||
58 | } |
||
59 | |||
60 | return new self($attributes); |
||
61 | } |
||
62 | |||
68 |