commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
SubRateModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
20 final class SubRateModel extends JsonObjectModel implements SubRate
21 {
26  protected $name;
27 
32  protected $amount;
33 
34 
38  public function __construct(
39  ?string $name = null,
40  ?float $amount = null
41  ) {
42  $this->name = $name;
43  $this->amount = $amount;
44  }
45 
50  public function getName()
51  {
52  if (is_null($this->name)) {
54  $data = $this->raw(self::FIELD_NAME);
55  if (is_null($data)) {
56  return null;
57  }
58  $this->name = (string) $data;
59  }
60 
61  return $this->name;
62  }
63 
68  public function getAmount()
69  {
70  if (is_null($this->amount)) {
72  $data = $this->raw(self::FIELD_AMOUNT);
73  if (is_null($data)) {
74  return null;
75  }
76  $this->amount = (float) $data;
77  }
78 
79  return $this->amount;
80  }
81 
82 
86  public function setName(?string $name): void
87  {
88  $this->name = $name;
89  }
90 
94  public function setAmount(?float $amount): void
95  {
96  $this->amount = $amount;
97  }
98 }
__construct(?string $name=null, ?float $amount=null)