| Total Complexity | 2 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class ShippingOption |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * Shipping option identifier. |
||
| 16 | * |
||
| 17 | * @var string |
||
| 18 | */ |
||
| 19 | public $id; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Option title. |
||
| 23 | * |
||
| 24 | * @var string |
||
| 25 | */ |
||
| 26 | public $title; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * List of price portions. |
||
| 30 | * |
||
| 31 | * @var LabeledPriceType[] |
||
| 32 | */ |
||
| 33 | public $prices; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @param string $id |
||
| 37 | * @param string $title |
||
| 38 | * @param array $prices |
||
| 39 | * |
||
| 40 | * @return ShippingOption |
||
| 41 | */ |
||
| 42 | public static function create(string $id, string $title, array $prices): ShippingOption |
||
| 43 | { |
||
| 44 | $instance = new static(); |
||
| 45 | $instance->id = $id; |
||
| 46 | $instance->title = $title; |
||
| 47 | $instance->prices = $prices; |
||
| 48 | |||
| 49 | return $instance; |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @param LabeledPriceType $price |
||
| 54 | * |
||
| 55 | * @return ShippingOption |
||
| 56 | */ |
||
| 57 | public function addPrice(LabeledPriceType $price): ShippingOption |
||
| 62 | } |
||
| 63 | } |
||
| 64 |