Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
65 / 65 |
|
100.00% |
28 / 28 |
CRAP | |
100.00% |
1 / 1 |
| SDK | |
100.00% |
65 / 65 |
|
100.00% |
28 / 28 |
38 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| __toString | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| openAPITypes | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| openAPIFormats | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| isNullable | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| isNullableSetToNull | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| attributeMap | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setters | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getters | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getModelName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getPlatformAllowableValues | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |||
| listInvalidProperties | |
100.00% |
13 / 13 |
|
100.00% |
1 / 1 |
5 | |||
| valid | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getPlatform | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setPlatform | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
2 | |||
| getVersion | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setVersion | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getIntegrations | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setIntegrations | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| offsetExists | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| offsetGet | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| offsetSet | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
| offsetUnset | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| jsonSerialize | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toHeaderValue | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| openAPINullables | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getOpenAPINullablesSetToNull | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setOpenAPINullablesSetToNull | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| setIfExists | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
4 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * SDK. |
| 5 | * |
| 6 | * @category Class |
| 7 | * |
| 8 | * @author Fingerprint |
| 9 | * |
| 10 | * @see https://fingerprint.com |
| 11 | */ |
| 12 | |
| 13 | /** |
| 14 | * Server API. |
| 15 | * |
| 16 | * Fingerprint Server API allows you to get, search, and update Events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios. Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device. |
| 17 | * |
| 18 | * The version of the OpenAPI document: 4 |
| 19 | * Contact: support@fingerprint.com |
| 20 | * Generated by: https://openapi-generator.tech |
| 21 | * Generator version: 7.21.0 |
| 22 | */ |
| 23 | |
| 24 | /** |
| 25 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). |
| 26 | * https://openapi-generator.tech |
| 27 | * Do not edit the class manually. |
| 28 | */ |
| 29 | |
| 30 | namespace Fingerprint\ServerSdk\Model; |
| 31 | |
| 32 | use Fingerprint\ServerSdk\ObjectSerializer; |
| 33 | |
| 34 | /** |
| 35 | * Contains information about the SDK used to perform the request. |
| 36 | * |
| 37 | * @category Class |
| 38 | * |
| 39 | * @description Contains information about the SDK used to perform the request. |
| 40 | * |
| 41 | * @author Fingerprint |
| 42 | * |
| 43 | * @see https://fingerprint.com |
| 44 | * |
| 45 | * @implements \ArrayAccess<string, mixed> |
| 46 | * |
| 47 | * @noinspection GrazieInspection |
| 48 | * @noinspection RedundantSuppression |
| 49 | */ |
| 50 | class SDK implements ModelInterface, \ArrayAccess, \JsonSerializable |
| 51 | { |
| 52 | public const DISCRIMINATOR = null; |
| 53 | |
| 54 | public const PLATFORM_JS = 'js'; |
| 55 | public const PLATFORM_ANDROID = 'android'; |
| 56 | public const PLATFORM_IOS = 'ios'; |
| 57 | public const PLATFORM_UNKNOWN = 'unknown'; |
| 58 | |
| 59 | /** |
| 60 | * The original name of the model. |
| 61 | * |
| 62 | */ |
| 63 | protected static string $openAPIModelName = 'SDK'; |
| 64 | |
| 65 | /** |
| 66 | * Array of property to type mappings. Used for (de)serialization. |
| 67 | * |
| 68 | * @var string[] |
| 69 | */ |
| 70 | protected static array $openAPITypes = [ |
| 71 | 'platform' => 'string', |
| 72 | 'version' => 'string', |
| 73 | 'integrations' => '\Fingerprint\ServerSdk\Model\Integration[]', |
| 74 | ]; |
| 75 | |
| 76 | /** |
| 77 | * Array of property to format mappings. Used for (de)serialization. |
| 78 | * |
| 79 | * @var string[] |
| 80 | * |
| 81 | * @phpstan-var array<string, string|null> |
| 82 | * |
| 83 | * @psalm-var array<string, string|null> |
| 84 | */ |
| 85 | protected static array $openAPIFormats = [ |
| 86 | 'platform' => null, |
| 87 | 'version' => null, |
| 88 | 'integrations' => null, |
| 89 | ]; |
| 90 | |
| 91 | /** |
| 92 | * Array of nullable properties. Used for (de)serialization. |
| 93 | * |
| 94 | * @var bool[] |
| 95 | */ |
| 96 | protected static array $openAPINullables = [ |
| 97 | 'platform' => false, |
| 98 | 'version' => false, |
| 99 | 'integrations' => false, |
| 100 | ]; |
| 101 | |
| 102 | /** |
| 103 | * If a nullable field gets set to null, insert it here. |
| 104 | * |
| 105 | * @var bool[] |
| 106 | */ |
| 107 | protected array $openAPINullablesSetToNull = []; |
| 108 | |
| 109 | /** |
| 110 | * Array of attributes where the key is the local name, |
| 111 | * and the value is the original name. |
| 112 | * |
| 113 | * @var string[] |
| 114 | */ |
| 115 | protected static array $attributeMap = [ |
| 116 | 'platform' => 'platform', |
| 117 | 'version' => 'version', |
| 118 | 'integrations' => 'integrations', |
| 119 | ]; |
| 120 | |
| 121 | /** |
| 122 | * Array of attributes to setter functions (for deserialization of responses). |
| 123 | * |
| 124 | * @var string[] |
| 125 | */ |
| 126 | protected static array $setters = [ |
| 127 | 'platform' => 'setPlatform', |
| 128 | 'version' => 'setVersion', |
| 129 | 'integrations' => 'setIntegrations', |
| 130 | ]; |
| 131 | |
| 132 | /** |
| 133 | * Array of attributes to getter functions (for serialization of requests). |
| 134 | * |
| 135 | * @var string[] |
| 136 | */ |
| 137 | protected static array $getters = [ |
| 138 | 'platform' => 'getPlatform', |
| 139 | 'version' => 'getVersion', |
| 140 | 'integrations' => 'getIntegrations', |
| 141 | ]; |
| 142 | |
| 143 | /** |
| 144 | * Associative array for storing property values. |
| 145 | */ |
| 146 | protected array $container = []; |
| 147 | |
| 148 | /** |
| 149 | * Constructor. |
| 150 | * |
| 151 | * @param array|null $data Associated array of property values |
| 152 | * initializing the model |
| 153 | * |
| 154 | * @noinspection DuplicatedCode |
| 155 | */ |
| 156 | public function __construct(?array $data = null) |
| 157 | { |
| 158 | $this->setIfExists('platform', $data ?? [], null); |
| 159 | $this->setIfExists('version', $data ?? [], null); |
| 160 | $this->setIfExists('integrations', $data ?? [], null); |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * Gets the string presentation of the object. |
| 165 | * |
| 166 | */ |
| 167 | public function __toString(): string |
| 168 | { |
| 169 | return json_encode( |
| 170 | ObjectSerializer::sanitizeForSerialization($this), |
| 171 | JSON_PRETTY_PRINT |
| 172 | ); |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * Array of property to type mappings. Used for (de)serialization. |
| 177 | * |
| 178 | */ |
| 179 | public static function openAPITypes(): array |
| 180 | { |
| 181 | return self::$openAPITypes; |
| 182 | } |
| 183 | |
| 184 | /** |
| 185 | * Array of property to format mappings. Used for (de)serialization. |
| 186 | */ |
| 187 | public static function openAPIFormats(): array |
| 188 | { |
| 189 | return self::$openAPIFormats; |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * Checks if a property is nullable. |
| 194 | * |
| 195 | */ |
| 196 | public static function isNullable(string $property): bool |
| 197 | { |
| 198 | return self::openAPINullables()[$property] ?? false; |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * Checks if a nullable property is set to null. |
| 203 | * |
| 204 | */ |
| 205 | public function isNullableSetToNull(string $property): bool |
| 206 | { |
| 207 | return in_array($property, $this->getOpenAPINullablesSetToNull(), true); |
| 208 | } |
| 209 | |
| 210 | /** |
| 211 | * Array of attributes where the key is the local name, |
| 212 | * and the value is the original name. |
| 213 | * |
| 214 | */ |
| 215 | public static function attributeMap(): array |
| 216 | { |
| 217 | return self::$attributeMap; |
| 218 | } |
| 219 | |
| 220 | /** |
| 221 | * Array of attributes to setter functions (for deserialization of responses). |
| 222 | * |
| 223 | */ |
| 224 | public static function setters(): array |
| 225 | { |
| 226 | return self::$setters; |
| 227 | } |
| 228 | |
| 229 | /** |
| 230 | * Array of attributes to getter functions (for serialization of requests). |
| 231 | * |
| 232 | */ |
| 233 | public static function getters(): array |
| 234 | { |
| 235 | return self::$getters; |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * The original name of the model. |
| 240 | * |
| 241 | */ |
| 242 | public function getModelName(): string |
| 243 | { |
| 244 | return self::$openAPIModelName; |
| 245 | } |
| 246 | |
| 247 | /** |
| 248 | * Gets allowable values of the enum. |
| 249 | * |
| 250 | * @return string[] |
| 251 | */ |
| 252 | public function getPlatformAllowableValues(): array |
| 253 | { |
| 254 | return [ |
| 255 | self::PLATFORM_JS, |
| 256 | self::PLATFORM_ANDROID, |
| 257 | self::PLATFORM_IOS, |
| 258 | self::PLATFORM_UNKNOWN, |
| 259 | ]; |
| 260 | } |
| 261 | |
| 262 | /** |
| 263 | * Show all the invalid properties with reasons. |
| 264 | * |
| 265 | * @return array invalid properties with reasons |
| 266 | */ |
| 267 | public function listInvalidProperties(): array |
| 268 | { |
| 269 | $invalidProperties = []; |
| 270 | |
| 271 | if (null === $this->container['platform']) { |
| 272 | $invalidProperties[] = "'platform' can't be null"; |
| 273 | } |
| 274 | $allowedValues = $this->getPlatformAllowableValues(); |
| 275 | if (!is_null($this->container['platform']) && !in_array($this->container['platform'], $allowedValues, true)) { |
| 276 | $invalidProperties[] = sprintf( |
| 277 | "invalid value '%s' for 'platform', must be one of '%s'", |
| 278 | $this->container['platform'], |
| 279 | implode("', '", $allowedValues) |
| 280 | ); |
| 281 | } |
| 282 | |
| 283 | if (null === $this->container['version']) { |
| 284 | $invalidProperties[] = "'version' can't be null"; |
| 285 | } |
| 286 | |
| 287 | return $invalidProperties; |
| 288 | } |
| 289 | |
| 290 | /** |
| 291 | * Validate all the properties in the model |
| 292 | * return true if all passed. |
| 293 | * |
| 294 | * @return bool True if all properties are valid |
| 295 | */ |
| 296 | public function valid(): bool |
| 297 | { |
| 298 | return 0 === count($this->listInvalidProperties()); |
| 299 | } |
| 300 | |
| 301 | /** |
| 302 | * Gets platform. |
| 303 | * |
| 304 | */ |
| 305 | public function getPlatform(): ?string |
| 306 | { |
| 307 | return $this->container['platform']; |
| 308 | } |
| 309 | |
| 310 | /** |
| 311 | * Sets platform. |
| 312 | * |
| 313 | * @param string $platform platform of the SDK used for the identification request |
| 314 | * |
| 315 | */ |
| 316 | public function setPlatform(string $platform): self |
| 317 | { |
| 318 | $allowedValues = $this->getPlatformAllowableValues(); |
| 319 | if (!in_array($platform, $allowedValues, true)) { |
| 320 | throw new \InvalidArgumentException( |
| 321 | sprintf( |
| 322 | "Invalid value '%s' for 'platform', must be one of '%s'", |
| 323 | $platform, |
| 324 | implode("', '", $allowedValues) |
| 325 | ) |
| 326 | ); |
| 327 | } |
| 328 | $this->container['platform'] = $platform; |
| 329 | |
| 330 | return $this; |
| 331 | } |
| 332 | |
| 333 | /** |
| 334 | * Gets version. |
| 335 | * |
| 336 | */ |
| 337 | public function getVersion(): ?string |
| 338 | { |
| 339 | return $this->container['version']; |
| 340 | } |
| 341 | |
| 342 | /** |
| 343 | * Sets version. |
| 344 | * |
| 345 | * @param string $version Version string of the SDK used for the identification request. For example: `\"3.12.1\"` |
| 346 | * |
| 347 | */ |
| 348 | public function setVersion(string $version): self |
| 349 | { |
| 350 | $this->container['version'] = $version; |
| 351 | |
| 352 | return $this; |
| 353 | } |
| 354 | |
| 355 | /** |
| 356 | * Gets integrations. |
| 357 | * |
| 358 | * @return Integration[]|null |
| 359 | */ |
| 360 | public function getIntegrations(): ?array |
| 361 | { |
| 362 | return $this->container['integrations']; |
| 363 | } |
| 364 | |
| 365 | /** |
| 366 | * Sets integrations. |
| 367 | * |
| 368 | * @param Integration[] $integrations integrations |
| 369 | * |
| 370 | */ |
| 371 | public function setIntegrations(array $integrations): self |
| 372 | { |
| 373 | $this->container['integrations'] = $integrations; |
| 374 | |
| 375 | return $this; |
| 376 | } |
| 377 | |
| 378 | /** |
| 379 | * Returns true if offset exists. False otherwise. |
| 380 | * |
| 381 | * @param int|string $offset Offset |
| 382 | * |
| 383 | */ |
| 384 | public function offsetExists(mixed $offset): bool |
| 385 | { |
| 386 | return isset($this->container[$offset]); |
| 387 | } |
| 388 | |
| 389 | /** |
| 390 | * Gets offset. |
| 391 | * |
| 392 | * @param int|string $offset Offset |
| 393 | * |
| 394 | * @return mixed|null |
| 395 | */ |
| 396 | #[\ReturnTypeWillChange] |
| 397 | public function offsetGet(mixed $offset): mixed |
| 398 | { |
| 399 | return $this->container[$offset] ?? null; |
| 400 | } |
| 401 | |
| 402 | /** |
| 403 | * Sets value based on offset. |
| 404 | * |
| 405 | * @param int|null $offset Offset |
| 406 | * @param mixed $value Value to be set |
| 407 | * |
| 408 | */ |
| 409 | public function offsetSet(mixed $offset, mixed $value): void |
| 410 | { |
| 411 | if (is_null($offset)) { |
| 412 | $this->container[] = $value; |
| 413 | } else { |
| 414 | $this->container[$offset] = $value; |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | /** |
| 419 | * Unsets offset. |
| 420 | * |
| 421 | * @param int|string $offset Offset |
| 422 | * |
| 423 | */ |
| 424 | public function offsetUnset(mixed $offset): void |
| 425 | { |
| 426 | unset($this->container[$offset]); |
| 427 | } |
| 428 | |
| 429 | /** |
| 430 | * Serializes the object to a value that can be serialized natively by json_encode(). |
| 431 | * |
| 432 | * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php |
| 433 | * |
| 434 | * @return mixed returns data which can be serialized by json_encode(), which is a value |
| 435 | * of any type other than a resource |
| 436 | */ |
| 437 | #[\ReturnTypeWillChange] |
| 438 | public function jsonSerialize(): mixed |
| 439 | { |
| 440 | return ObjectSerializer::sanitizeForSerialization($this); |
| 441 | } |
| 442 | |
| 443 | /** |
| 444 | * Gets a header-safe presentation of the object. |
| 445 | * |
| 446 | */ |
| 447 | public function toHeaderValue(): string |
| 448 | { |
| 449 | return json_encode(ObjectSerializer::sanitizeForSerialization($this)); |
| 450 | } |
| 451 | |
| 452 | /** |
| 453 | * Array of nullable properties. |
| 454 | */ |
| 455 | protected static function openAPINullables(): array |
| 456 | { |
| 457 | return self::$openAPINullables; |
| 458 | } |
| 459 | |
| 460 | /** |
| 461 | * Array of nullable field names deliberately set to null. |
| 462 | * |
| 463 | * @return bool[] |
| 464 | */ |
| 465 | private function getOpenAPINullablesSetToNull(): array |
| 466 | { |
| 467 | return $this->openAPINullablesSetToNull; |
| 468 | } |
| 469 | |
| 470 | /** |
| 471 | * Setter - Array of nullable field names deliberately set to null. |
| 472 | * |
| 473 | * @param bool[] $openAPINullablesSetToNull |
| 474 | * |
| 475 | * @codeCoverageIgnore |
| 476 | */ |
| 477 | private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void |
| 478 | { |
| 479 | $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; |
| 480 | } |
| 481 | |
| 482 | /** |
| 483 | * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName |
| 484 | * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the |
| 485 | * $this->openAPINullablesSetToNull array. |
| 486 | * |
| 487 | * @noinspection PhpSameParameterValueInspection |
| 488 | */ |
| 489 | private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void |
| 490 | { |
| 491 | if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { |
| 492 | $this->openAPINullablesSetToNull[] = $variableName; // @codeCoverageIgnore |
| 493 | } |
| 494 | |
| 495 | $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; |
| 496 | } |
| 497 | } |