commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ClientLoggingModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
22 final class ClientLoggingModel extends JsonObjectModel implements ClientLogging
23 {
28  protected $clientId;
29 
34  protected $externalUserId;
35 
40  protected $customer;
41 
46  protected $anonymousId;
47 
52  protected $associate;
53 
54 
58  public function __construct(
59  ?string $clientId = null,
60  ?string $externalUserId = null,
62  ?string $anonymousId = null,
64  ) {
65  $this->clientId = $clientId;
66  $this->externalUserId = $externalUserId;
67  $this->customer = $customer;
68  $this->anonymousId = $anonymousId;
69  $this->associate = $associate;
70  }
71 
78  public function getClientId()
79  {
80  if (is_null($this->clientId)) {
82  $data = $this->raw(self::FIELD_CLIENT_ID);
83  if (is_null($data)) {
84  return null;
85  }
86  $this->clientId = (string) $data;
87  }
88 
89  return $this->clientId;
90  }
91 
98  public function getExternalUserId()
99  {
100  if (is_null($this->externalUserId)) {
102  $data = $this->raw(self::FIELD_EXTERNAL_USER_ID);
103  if (is_null($data)) {
104  return null;
105  }
106  $this->externalUserId = (string) $data;
107  }
108 
109  return $this->externalUserId;
110  }
111 
118  public function getCustomer()
119  {
120  if (is_null($this->customer)) {
122  $data = $this->raw(self::FIELD_CUSTOMER);
123  if (is_null($data)) {
124  return null;
125  }
126 
127  $this->customer = CustomerReferenceModel::of($data);
128  }
129 
130  return $this->customer;
131  }
132 
139  public function getAnonymousId()
140  {
141  if (is_null($this->anonymousId)) {
143  $data = $this->raw(self::FIELD_ANONYMOUS_ID);
144  if (is_null($data)) {
145  return null;
146  }
147  $this->anonymousId = (string) $data;
148  }
149 
150  return $this->anonymousId;
151  }
152 
159  public function getAssociate()
160  {
161  if (is_null($this->associate)) {
163  $data = $this->raw(self::FIELD_ASSOCIATE);
164  if (is_null($data)) {
165  return null;
166  }
167 
168  $this->associate = CustomerReferenceModel::of($data);
169  }
170 
171  return $this->associate;
172  }
173 
174 
178  public function setClientId(?string $clientId): void
179  {
180  $this->clientId = $clientId;
181  }
182 
186  public function setExternalUserId(?string $externalUserId): void
187  {
188  $this->externalUserId = $externalUserId;
189  }
190 
194  public function setCustomer(?CustomerReference $customer): void
195  {
196  $this->customer = $customer;
197  }
198 
202  public function setAnonymousId(?string $anonymousId): void
203  {
204  $this->anonymousId = $anonymousId;
205  }
206 
210  public function setAssociate(?CustomerReference $associate): void
211  {
212  $this->associate = $associate;
213  }
214 }
__construct(?string $clientId=null, ?string $externalUserId=null, ?CustomerReference $customer=null, ?string $anonymousId=null, ?CustomerReference $associate=null)