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
15use stdClass;
16
20final class WarningObjectModel extends JsonObjectModel implements WarningObject
21{
22 public const DISCRIMINATOR_VALUE = '';
27 protected $code;
28
33 protected $message;
34
39 private static $discriminatorClasses = [
40 'ImageProcessingOngoing' => ImageProcessingOngoingWarningModel::class,
41 ];
42
46 public function __construct(
47 ?string $message = null,
48 ?string $code = null
49 ) {
50 $this->message = $message;
51 $this->code = $code;
52 }
53
60 public function getCode()
61 {
62 if (is_null($this->code)) {
64 $data = $this->raw(self::FIELD_CODE);
65 if (is_null($data)) {
66 return null;
67 }
68 $this->code = (string) $data;
69 }
70
71 return $this->code;
72 }
73
80 public function getMessage()
81 {
82 if (is_null($this->message)) {
84 $data = $this->raw(self::FIELD_MESSAGE);
85 if (is_null($data)) {
86 return null;
87 }
88 $this->message = (string) $data;
89 }
90
91 return $this->message;
92 }
93
94
98 public function setMessage(?string $message): void
99 {
100 $this->message = $message;
101 }
102
103
104
109 public static function resolveDiscriminatorClass($value): string
110 {
112 if (is_object($value) && isset($value->$fieldName)) {
114 $discriminatorValue = $value->$fieldName;
115 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
116 return self::$discriminatorClasses[$discriminatorValue];
117 }
118 }
119 if (is_array($value) && isset($value[$fieldName])) {
121 $discriminatorValue = $value[$fieldName];
122 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
123 return self::$discriminatorClasses[$discriminatorValue];
124 }
125 }
126
128 $type = WarningObjectModel::class;
129 return $type;
130 }
131}
__construct(?string $message=null, ?string $code=null)