commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
MethodTaxRateBuilder.php
1<?php
2
3declare(strict_types=1);
10
18use stdClass;
19
23final class MethodTaxRateBuilder implements Builder
24{
29 private $shippingMethodKey;
30
35 private $taxRate;
36
43 public function getShippingMethodKey()
44 {
45 return $this->shippingMethodKey;
46 }
47
54 public function getTaxRate()
55 {
56 return $this->taxRate instanceof TaxRateBuilder ? $this->taxRate->build() : $this->taxRate;
57 }
58
63 public function withShippingMethodKey(?string $shippingMethodKey)
64 {
65 $this->shippingMethodKey = $shippingMethodKey;
66
67 return $this;
68 }
69
74 public function withTaxRate(?TaxRate $taxRate)
75 {
76 $this->taxRate = $taxRate;
77
78 return $this;
79 }
80
85 public function withTaxRateBuilder(?TaxRateBuilder $taxRate)
86 {
87 $this->taxRate = $taxRate;
88
89 return $this;
90 }
91
92 public function build(): MethodTaxRate
93 {
94 return new MethodTaxRateModel(
95 $this->shippingMethodKey,
96 $this->taxRate instanceof TaxRateBuilder ? $this->taxRate->build() : $this->taxRate
97 );
98 }
99
100 public static function of(): MethodTaxRateBuilder
101 {
102 return new self();
103 }
104}