commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
AgentResponsesSuccessModel.php
1<?php
2
3declare(strict_types=1);
10
16use stdClass;
17
22{
23 public const DISCRIMINATOR_VALUE = '';
28 protected $entityType;
29
34 protected $warnings;
35
40 protected $threadId;
41
46 private static $discriminatorClasses = [
47 'Cart' => AgentResponsesCartSuccessModel::class,
48 'QuoteRequest' => AgentResponsesQuoteRequestSuccessModel::class,
49 'ShoppingList' => AgentResponsesShoppingListSuccessModel::class,
50 ];
51
55 public function __construct(
57 ?string $threadId = null,
58 ?string $entityType = null
59 ) {
60 $this->warnings = $warnings;
61 $this->threadId = $threadId;
62 $this->entityType = $entityType;
63 }
64
71 public function getEntityType()
72 {
73 if (is_null($this->entityType)) {
75 $data = $this->raw(self::FIELD_ENTITY_TYPE);
76 if (is_null($data)) {
77 return null;
78 }
79 $this->entityType = (string) $data;
80 }
81
82 return $this->entityType;
83 }
84
91 public function getWarnings()
92 {
93 if (is_null($this->warnings)) {
95 $data = $this->raw(self::FIELD_WARNINGS);
96 if (is_null($data)) {
97 return null;
98 }
99 $this->warnings = WarningObjectCollection::fromArray($data);
100 }
101
102 return $this->warnings;
103 }
104
111 public function getThreadId()
112 {
113 if (is_null($this->threadId)) {
115 $data = $this->raw(self::FIELD_THREAD_ID);
116 if (is_null($data)) {
117 return null;
118 }
119 $this->threadId = (string) $data;
120 }
121
122 return $this->threadId;
123 }
124
125
130 {
131 $this->warnings = $warnings;
132 }
133
137 public function setThreadId(?string $threadId): void
138 {
139 $this->threadId = $threadId;
140 }
141
142
143
148 public static function resolveDiscriminatorClass($value): string
149 {
151 if (is_object($value) && isset($value->$fieldName)) {
153 $discriminatorValue = $value->$fieldName;
154 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
155 return self::$discriminatorClasses[$discriminatorValue];
156 }
157 }
158 if (is_array($value) && isset($value[$fieldName])) {
160 $discriminatorValue = $value[$fieldName];
161 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
162 return self::$discriminatorClasses[$discriminatorValue];
163 }
164 }
165
167 $type = AgentResponsesSuccessModel::class;
168 return $type;
169 }
170}
__construct(?WarningObjectCollection $warnings=null, ?string $threadId=null, ?string $entityType=null)