commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
DirectDiscountDraftModel.php
1<?php
2
3declare(strict_types=1);
10
19use stdClass;
20
25{
30 protected $value;
31
36 protected $target;
37
38
42 public function __construct(
45 ) {
46 $this->value = $value;
47 $this->target = $target;
48 }
49
56 public function getValue()
57 {
58 if (is_null($this->value)) {
60 $data = $this->raw(self::FIELD_VALUE);
61 if (is_null($data)) {
62 return null;
63 }
65 $this->value = $className::of($data);
66 }
67
68 return $this->value;
69 }
70
78 public function getTarget()
79 {
80 if (is_null($this->target)) {
82 $data = $this->raw(self::FIELD_TARGET);
83 if (is_null($data)) {
84 return null;
85 }
86 $className = CartDiscountTargetModel::resolveDiscriminatorClass($data);
87 $this->target = $className::of($data);
88 }
89
90 return $this->target;
91 }
92
93
97 public function setValue(?CartDiscountValueDraft $value): void
98 {
99 $this->value = $value;
100 }
101
105 public function setTarget(?CartDiscountTarget $target): void
106 {
107 $this->target = $target;
108 }
109}
__construct(?CartDiscountValueDraft $value=null, ?CartDiscountTarget $target=null)