-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathInfo.php
More file actions
153 lines (116 loc) 路 2.97 KB
/
Copy pathInfo.php
File metadata and controls
153 lines (116 loc) 路 2.97 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php declare(strict_types = 1);
namespace Contributte\OpenApi\Schema;
class Info
{
private string $title;
private ?string $summary = null;
private ?string $description = null;
private ?string $termsOfService = null;
private ?Contact $contact = null;
private ?License $license = null;
private string $version;
private ?VendorExtensions $vendorExtensions = null;
public function __construct(string $title, string $version)
{
$this->title = $title;
$this->version = $version;
}
/**
* @param mixed[] $data
*/
public static function fromArray(array $data): Info
{
$info = new Info($data['title'], $data['version']);
$info->setSummary($data['summary'] ?? null);
$info->setDescription($data['description'] ?? null);
$info->setTermsOfService($data['termsOfService'] ?? null);
$info->setLicense(isset($data['license']) ? License::fromArray($data['license']) : null);
$info->setContact(isset($data['contact']) ? Contact::fromArray($data['contact']) : null);
$info->setVendorExtensions(VendorExtensions::fromArray($data));
return $info;
}
/**
* @return mixed[]
*/
public function toArray(): array
{
$data = [];
$data['title'] = $this->title;
if ($this->description !== null) {
$data['description'] = $this->description;
}
if ($this->summary !== null) {
$data['summary'] = $this->summary;
}
if ($this->termsOfService !== null) {
$data['termsOfService'] = $this->termsOfService;
}
if ($this->contact !== null) {
$data['contact'] = $this->contact->toArray();
}
if ($this->license !== null) {
$data['license'] = $this->license->toArray();
}
$data['version'] = $this->version;
if ($this->vendorExtensions !== null) {
$data = array_merge($data, $this->vendorExtensions->toArray());
}
return $data;
}
public function setSummary(?string $summary): void
{
$this->summary = $summary;
}
public function setDescription(?string $description): void
{
$this->description = $description;
}
public function setTermsOfService(?string $termsOfService): void
{
$this->termsOfService = $termsOfService;
}
public function setContact(?Contact $contact): void
{
$this->contact = $contact;
}
public function setLicense(?License $license): void
{
$this->license = $license;
}
public function getTitle(): string
{
return $this->title;
}
public function getSummary(): ?string
{
return $this->summary;
}
public function getDescription(): ?string
{
return $this->description;
}
public function getTermsOfService(): ?string
{
return $this->termsOfService;
}
public function getContact(): ?Contact
{
return $this->contact;
}
public function getLicense(): ?License
{
return $this->license;
}
public function getVersion(): string
{
return $this->version;
}
public function getVendorExtensions(): ?VendorExtensions
{
return $this->vendorExtensions;
}
public function setVendorExtensions(?VendorExtensions $vendorExtensions): void
{
$this->vendorExtensions = $vendorExtensions;
}
}