commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ReplicaCartDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
28  protected $reference;
29 
34  protected $key;
35 
36 
40  public function __construct(
41  ?JsonObject $reference = null,
42  ?string $key = null
43  ) {
44  $this->reference = $reference;
45  $this->key = $key;
46  }
47 
54  public function getReference()
55  {
56  if (is_null($this->reference)) {
58  $data = $this->raw(self::FIELD_REFERENCE);
59  if (is_null($data)) {
60  return null;
61  }
62  $this->reference = $data;
63  }
64 
65  return $this->reference;
66  }
67 
74  public function getKey()
75  {
76  if (is_null($this->key)) {
78  $data = $this->raw(self::FIELD_KEY);
79  if (is_null($data)) {
80  return null;
81  }
82  $this->key = (string) $data;
83  }
84 
85  return $this->key;
86  }
87 
93  public function getReferenceAsCartReference()
94  {
96  $data = $this->raw(self::FIELD_REFERENCE);
97  if (is_null($data)) {
98  return null;
99  }
100 
101  return CartReferenceModel::of($data);
102  }
103 
110  {
112  $data = $this->raw(self::FIELD_REFERENCE);
113  if (is_null($data)) {
114  return null;
115  }
116 
117  return OrderReferenceModel::of($data);
118  }
119 
123  public function setReference(?JsonObject $reference): void
124  {
125  $this->reference = $reference;
126  }
127 
131  public function setKey(?string $key): void
132  {
133  $this->key = $key;
134  }
135 }
__construct(?JsonObject $reference=null, ?string $key=null)