commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
DiscountCodeInfoModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
28  protected $discountCode;
29 
34  protected $state;
35 
36 
40  public function __construct(
42  ?string $state = null
43  ) {
44  $this->discountCode = $discountCode;
45  $this->state = $state;
46  }
47 
54  public function getDiscountCode()
55  {
56  if (is_null($this->discountCode)) {
58  $data = $this->raw(self::FIELD_DISCOUNT_CODE);
59  if (is_null($data)) {
60  return null;
61  }
62 
63  $this->discountCode = DiscountCodeKeyReferenceModel::of($data);
64  }
65 
66  return $this->discountCode;
67  }
68 
75  public function getState()
76  {
77  if (is_null($this->state)) {
79  $data = $this->raw(self::FIELD_STATE);
80  if (is_null($data)) {
81  return null;
82  }
83  $this->state = (string) $data;
84  }
85 
86  return $this->state;
87  }
88 
89 
94  {
95  $this->discountCode = $discountCode;
96  }
97 
101  public function setState(?string $state): void
102  {
103  $this->state = $state;
104  }
105 }
setDiscountCode(?DiscountCodeKeyReference $discountCode)
__construct(?DiscountCodeKeyReference $discountCode=null, ?string $state=null)