-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathExample.php
More file actions
113 lines (86 loc) · 2.19 KB
/
Example.php
File metadata and controls
113 lines (86 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php declare(strict_types = 1);
namespace Contributte\OpenApi\Schema;
class Example
{
private ?string $summary = null;
private ?string $description = null;
private mixed $value = null;
private ?string $externalValue = null;
private ?VendorExtensions $vendorExtensions = null;
/**
* @param array{summary?: string, description?: string, value?: mixed, externalValue?: string} $data
*/
public static function fromArray(array $data): self
{
$example = new Example();
$example->summary = $data['summary'] ?? null;
$example->description = $data['description'] ?? null;
$example->value = $data['value'] ?? null;
$example->externalValue = $data['externalValue'] ?? null;
$example->vendorExtensions = VendorExtensions::fromArray($data);
return $example;
}
/**
* @return mixed[]
*/
public function toArray(): array
{
$data = [];
if ($this->summary !== null) {
$data['summary'] = $this->summary;
}
if ($this->description !== null) {
$data['description'] = $this->description;
}
if ($this->value !== null) {
$data['value'] = $this->value;
}
if ($this->externalValue !== null) {
$data['externalValue'] = $this->externalValue;
}
if ($this->vendorExtensions !== null) {
$data = array_merge($data, $this->vendorExtensions->toArray());
}
return $data;
}
public function getSummary(): ?string
{
return $this->summary;
}
public function setSummary(?string $summary): void
{
$this->summary = $summary;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): void
{
$this->description = $description;
}
public function getValue(): mixed
{
return $this->value;
}
public function setValue(mixed $value): void
{
$this->value = $value;
}
public function getExternalValue(): ?string
{
return $this->externalValue;
}
public function setExternalValue(?string $externalValue): void
{
$this->externalValue = $externalValue;
}
public function getVendorExtensions(): ?VendorExtensions
{
return $this->vendorExtensions;
}
public function setVendorExtensions(?VendorExtensions $vendorExtensions): void
{
$this->vendorExtensions = $vendorExtensions;
}
}