commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
WarningObjectModel.php
1<?php
2
3declare(strict_types=1);
10
19use stdClass;
20
24final class WarningObjectModel extends JsonObjectModel implements WarningObject
25{
26 public const DISCRIMINATOR_VALUE = '';
31 protected $code;
32
37 protected $message;
38
43 private static $discriminatorClasses = [
44 'CannotChangeReservationExpiry' => CannotChangeReservationExpiryWarningModel::class,
45 'CannotCreateReservation' => CannotCreateReservationWarningModel::class,
46 'CannotUpdateReservation' => CannotUpdateReservationWarningModel::class,
47 'FileNotProcessed' => AgentFileNotProcessedWarningModel::class,
48 'ImageProcessingOngoing' => ImageProcessingOngoingWarningModel::class,
49 'ProductsNotFound' => AgentProductsNotFoundWarningModel::class,
50 ];
51
55 public function __construct(
56 ?string $message = null,
57 ?string $code = null
58 ) {
59 $this->message = $message;
60 $this->code = $code;
61 }
62
69 public function getCode()
70 {
71 if (is_null($this->code)) {
73 $data = $this->raw(self::FIELD_CODE);
74 if (is_null($data)) {
75 return null;
76 }
77 $this->code = (string) $data;
78 }
79
80 return $this->code;
81 }
82
89 public function getMessage()
90 {
91 if (is_null($this->message)) {
93 $data = $this->raw(self::FIELD_MESSAGE);
94 if (is_null($data)) {
95 return null;
96 }
97 $this->message = (string) $data;
98 }
99
100 return $this->message;
101 }
102
103
107 public function setMessage(?string $message): void
108 {
109 $this->message = $message;
110 }
111
112
113
118 public static function resolveDiscriminatorClass($value): string
119 {
121 if (is_object($value) && isset($value->$fieldName)) {
123 $discriminatorValue = $value->$fieldName;
124 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
125 return self::$discriminatorClasses[$discriminatorValue];
126 }
127 }
128 if (is_array($value) && isset($value[$fieldName])) {
130 $discriminatorValue = $value[$fieldName];
131 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
132 return self::$discriminatorClasses[$discriminatorValue];
133 }
134 }
135
137 $type = WarningObjectModel::class;
138 return $type;
139 }
140}
__construct(?string $message=null, ?string $code=null)