commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ReviewUpdateActionModel.php
1<?php
2
3declare(strict_types=1);
10
15use stdClass;
16
21{
22 public const DISCRIMINATOR_VALUE = '';
27 protected $action;
28
33 private static $discriminatorClasses = [
34 'setAuthorName' => ReviewSetAuthorNameActionModel::class,
35 'setCustomField' => ReviewSetCustomFieldActionModel::class,
36 'setCustomType' => ReviewSetCustomTypeActionModel::class,
37 'setCustomer' => ReviewSetCustomerActionModel::class,
38 'setKey' => ReviewSetKeyActionModel::class,
39 'setLocale' => ReviewSetLocaleActionModel::class,
40 'setRating' => ReviewSetRatingActionModel::class,
41 'setTarget' => ReviewSetTargetActionModel::class,
42 'setText' => ReviewSetTextActionModel::class,
43 'setTitle' => ReviewSetTitleActionModel::class,
44 'transitionState' => ReviewTransitionStateActionModel::class,
45 ];
46
50 public function __construct(
51 ?string $action = null
52 ) {
53 $this->action = $action;
54 }
55
60 public function getAction()
61 {
62 if (is_null($this->action)) {
64 $data = $this->raw(self::FIELD_ACTION);
65 if (is_null($data)) {
66 return null;
67 }
68 $this->action = (string) $data;
69 }
70
71 return $this->action;
72 }
73
74
75
76
77
82 public static function resolveDiscriminatorClass($value): string
83 {
85 if (is_object($value) && isset($value->$fieldName)) {
87 $discriminatorValue = $value->$fieldName;
88 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
89 return self::$discriminatorClasses[$discriminatorValue];
90 }
91 }
92 if (is_array($value) && isset($value[$fieldName])) {
94 $discriminatorValue = $value[$fieldName];
95 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
96 return self::$discriminatorClasses[$discriminatorValue];
97 }
98 }
99
101 $type = ReviewUpdateActionModel::class;
102 return $type;
103 }
104}