PluginProbe
Plausible Analytics / trunk
Plausible Analytics vtrunk
2.6.1 2.6.0 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 All 52 releases
plausible-analytics / src / Client / lib / Model / CustomPropDisableRequest.php

CustomPropDisableRequest.php in Plausible Analytics trunk, at src/Client/lib/Model/CustomPropDisableRequest.php

437 lines 10.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * CustomPropDisableRequest
4 *
5 * PHP version 7.4
6 *
7 * @category Class
8 * @package Plausible\Analytics\WP\Client
9 * @author OpenAPI Generator team
10 * @link https://openapi-generator.tech
11 */
12
13 /**
14 * Plausible Plugins API
15 *
16 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
17 *
18 * The version of the OpenAPI document: 1.0-rc
19 * Generated by: https://openapi-generator.tech
20 * OpenAPI Generator version: 7.0.1
21 */
22
23 /**
24 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
25 * https://openapi-generator.tech
26 * Do not edit the class manually.
27 */
28
29 namespace Plausible\Analytics\WP\Client\Model;
30
31 use \ArrayAccess;
32 use \Plausible\Analytics\WP\Client\ObjectSerializer;
33
34 /**
35 * CustomPropDisableRequest Class Doc Comment
36 *
37 * @category Class
38 * @description Custom Property disable params
39 * @package Plausible\Analytics\WP\Client
40 * @author OpenAPI Generator team
41 * @link https://openapi-generator.tech
42 * @implements \ArrayAccess<string, mixed>
43 */
44 class CustomPropDisableRequest implements ModelInterface, ArrayAccess, \JsonSerializable {
45 public const DISCRIMINATOR = null;
46
47 /**
48 * The original name of the model.
49 *
50 * @var string
51 */
52 protected static $openAPIModelName = 'CustomProp.DisableRequest';
53
54 /**
55 * Array of property to type mappings. Used for (de)serialization
56 *
57 * @var string[]
58 */
59 protected static $openAPITypes = [
60 'custom_props' => '\Plausible\Analytics\WP\Client\Model\CustomProp[]',
61 'custom_prop' => '\Plausible\Analytics\WP\Client\Model\CustomPropCustomProp'
62 ];
63
64 /**
65 * Array of property to format mappings. Used for (de)serialization
66 *
67 * @var string[]
68 * @phpstan-var array<string, string|null>
69 * @psalm-var array<string, string|null>
70 */
71 protected static $openAPIFormats = [
72 'custom_props' => null,
73 'custom_prop' => null
74 ];
75
76 /**
77 * Array of nullable properties. Used for (de)serialization
78 *
79 * @var boolean[]
80 */
81 protected static array $openAPINullables = [
82 'custom_props' => false,
83 'custom_prop' => false
84 ];
85
86 /**
87 * If a nullable field gets set to null, insert it here
88 *
89 * @var boolean[]
90 */
91 protected array $openAPINullablesSetToNull = [];
92
93 /**
94 * Array of property to type mappings. Used for (de)serialization
95 *
96 * @return array
97 */
98 public static function openAPITypes() {
99 return self::$openAPITypes;
100 }
101
102 /**
103 * Array of property to format mappings. Used for (de)serialization
104 *
105 * @return array
106 */
107 public static function openAPIFormats() {
108 return self::$openAPIFormats;
109 }
110
111 /**
112 * Array of nullable properties
113 *
114 * @return array
115 */
116 protected static function openAPINullables(): array {
117 return self::$openAPINullables;
118 }
119
120 /**
121 * Array of nullable field names deliberately set to null
122 *
123 * @return boolean[]
124 */
125 private function getOpenAPINullablesSetToNull(): array {
126 return $this->openAPINullablesSetToNull;
127 }
128
129 /**
130 * Setter - Array of nullable field names deliberately set to null
131 *
132 * @param boolean[] $openAPINullablesSetToNull
133 */
134 private function setOpenAPINullablesSetToNull( array $openAPINullablesSetToNull ): void {
135 $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
136 }
137
138 /**
139 * Checks if a property is nullable
140 *
141 * @param string $property
142 *
143 * @return bool
144 */
145 public static function isNullable( string $property ): bool {
146 return self::openAPINullables()[ $property ] ?? false;
147 }
148
149 /**
150 * Checks if a nullable property is set to null.
151 *
152 * @param string $property
153 *
154 * @return bool
155 */
156 public function isNullableSetToNull( string $property ): bool {
157 return in_array( $property, $this->getOpenAPINullablesSetToNull(), true );
158 }
159
160 /**
161 * Array of attributes where the key is the local name,
162 * and the value is the original name
163 *
164 * @var string[]
165 */
166 protected static $attributeMap = [
167 'custom_props' => 'custom_props',
168 'custom_prop' => 'custom_prop'
169 ];
170
171 /**
172 * Array of attributes to setter functions (for deserialization of responses)
173 *
174 * @var string[]
175 */
176 protected static $setters = [
177 'custom_props' => 'setCustomProps',
178 'custom_prop' => 'setCustomProp'
179 ];
180
181 /**
182 * Array of attributes to getter functions (for serialization of requests)
183 *
184 * @var string[]
185 */
186 protected static $getters = [
187 'custom_props' => 'getCustomProps',
188 'custom_prop' => 'getCustomProp'
189 ];
190
191 /**
192 * Array of attributes where the key is the local name,
193 * and the value is the original name
194 *
195 * @return array
196 */
197 public static function attributeMap() {
198 return self::$attributeMap;
199 }
200
201 /**
202 * Array of attributes to setter functions (for deserialization of responses)
203 *
204 * @return array
205 */
206 public static function setters() {
207 return self::$setters;
208 }
209
210 /**
211 * Array of attributes to getter functions (for serialization of requests)
212 *
213 * @return array
214 */
215 public static function getters() {
216 return self::$getters;
217 }
218
219 /**
220 * The original name of the model.
221 *
222 * @return string
223 */
224 public function getModelName() {
225 return self::$openAPIModelName;
226 }
227
228
229 /**
230 * Associative array for storing property values
231 *
232 * @var mixed[]
233 */
234 protected $container = [];
235
236 /**
237 * Constructor
238 *
239 * @param mixed[]|null $data Associated array of property values
240 * initializing the model
241 */
242 public function __construct( ?array $data = null ) {
243 $this->setIfExists( 'custom_props', $data ?? [], null );
244 $this->setIfExists( 'custom_prop', $data ?? [], null );
245 }
246
247 /**
248 * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
249 * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
250 * $this->openAPINullablesSetToNull array
251 *
252 * @param string $variableName
253 * @param array $fields
254 * @param mixed $defaultValue
255 */
256 private function setIfExists( string $variableName, array $fields, $defaultValue ): void {
257 if ( self::isNullable( $variableName ) && array_key_exists( $variableName, $fields ) && is_null( $fields[ $variableName ] ) ) {
258 $this->openAPINullablesSetToNull[] = $variableName;
259 }
260
261 $this->container[ $variableName ] = $fields[ $variableName ] ?? $defaultValue;
262 }
263
264 /**
265 * Show all the invalid properties with reasons.
266 *
267 * @return array invalid properties with reasons
268 */
269 public function listInvalidProperties() {
270 $invalidProperties = [];
271
272 if ( $this->container['custom_props'] === null ) {
273 $invalidProperties[] = "'custom_props' can't be null";
274 }
275 if ( ( count( $this->container['custom_props'] ) < 1 ) ) {
276 $invalidProperties[] = "invalid value for 'custom_props', number of items must be greater than or equal to 1.";
277 }
278
279 if ( $this->container['custom_prop'] === null ) {
280 $invalidProperties[] = "'custom_prop' can't be null";
281 }
282
283 return $invalidProperties;
284 }
285
286 /**
287 * Validate all the properties in the model
288 * return true if all passed
289 *
290 * @return bool True if all properties are valid
291 */
292 public function valid() {
293 return count( $this->listInvalidProperties()) === 0;
294 }
295
296
297 /**
298 * Gets custom_props
299 *
300 * @return \Plausible\Analytics\WP\Client\Model\CustomProp[]
301 */
302 public function getCustomProps() {
303 return $this->container['custom_props'];
304 }
305
306 /**
307 * Sets custom_props
308 *
309 * @param \Plausible\Analytics\WP\Client\Model\CustomProp[] $custom_props custom_props
310 *
311 * @return self
312 */
313 public function setCustomProps( $custom_props ) {
314 if ( is_null( $custom_props ) ) {
315 throw new \InvalidArgumentException( 'non-nullable custom_props cannot be null' );
316 }
317
318
319 if ( ( count( $custom_props ) < 1 ) ) {
320 throw new \InvalidArgumentException( 'invalid length for $custom_props when calling CustomPropDisableRequest., number of items must be greater than or equal to 1.' );
321 }
322 $this->container['custom_props'] = $custom_props;
323
324 return $this;
325 }
326
327 /**
328 * Gets custom_prop
329 *
330 * @return \Plausible\Analytics\WP\Client\Model\CustomPropCustomProp
331 */
332 public function getCustomProp() {
333 return $this->container['custom_prop'];
334 }
335
336 /**
337 * Sets custom_prop
338 *
339 * @param \Plausible\Analytics\WP\Client\Model\CustomPropCustomProp $custom_prop custom_prop
340 *
341 * @return self
342 */
343 public function setCustomProp( $custom_prop ) {
344 if ( is_null( $custom_prop ) ) {
345 throw new \InvalidArgumentException( 'non-nullable custom_prop cannot be null' );
346 }
347 $this->container['custom_prop'] = $custom_prop;
348
349 return $this;
350 }
351
352 /**
353 * Returns true if offset exists. False otherwise.
354 *
355 * @param integer $offset Offset
356 *
357 * @return boolean
358 */
359 public function offsetExists( $offset ): bool {
360 return isset( $this->container[ $offset ] );
361 }
362
363 /**
364 * Gets offset.
365 *
366 * @param integer $offset Offset
367 *
368 * @return mixed|null
369 */
370 #[\ReturnTypeWillChange]
371 public function offsetGet( $offset ) {
372 return $this->container[ $offset ] ?? null;
373 }
374
375 /**
376 * Sets value based on offset.
377 *
378 * @param int|null $offset Offset
379 * @param mixed $value Value to be set
380 *
381 * @return void
382 */
383 public function offsetSet( $offset, $value ): void {
384 if ( is_null( $offset ) ) {
385 $this->container[] = $value;
386 } else {
387 $this->container[ $offset ] = $value;
388 }
389 }
390
391 /**
392 * Unsets offset.
393 *
394 * @param integer $offset Offset
395 *
396 * @return void
397 */
398 public function offsetUnset( $offset ): void {
399 unset( $this->container[ $offset ] );
400 }
401
402 /**
403 * Serializes the object to a value that can be serialized natively by json_encode().
404 * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
405 *
406 * @return mixed Returns data which can be serialized by json_encode(), which is a value
407 * of any type other than a resource.
408 */
409 #[\ReturnTypeWillChange]
410 public function jsonSerialize() {
411 return ObjectSerializer::sanitizeForSerialization($this );
412 }
413
414 /**
415 * Gets the string presentation of the object
416 *
417 * @return string
418 */
419 public function __toString() {
420 return json_encode(
421 ObjectSerializer::sanitizeForSerialization( $this ),
422 JSON_PRETTY_PRINT
423 );
424 }
425
426 /**
427 * Gets a header-safe presentation of the object
428 *
429 * @return string
430 */
431 public function toHeaderValue() {
432 return json_encode( ObjectSerializer::sanitizeForSerialization($this));
433 }
434 }
435
436
437