|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Aweapi\Openapi\Builders; |
|
6
|
|
|
|
|
7
|
|
|
use Aweapi\Openapi\Objects; |
|
8
|
|
|
|
|
9
|
|
|
final class InfoBuilder implements Objects\InfoFactory |
|
10
|
|
|
{ |
|
11
|
|
|
use Properties\OptionalExtensions; |
|
12
|
|
|
|
|
13
|
|
|
private $contact; |
|
14
|
|
|
|
|
15
|
|
|
private $description; |
|
16
|
|
|
|
|
17
|
|
|
private $license; |
|
18
|
|
|
|
|
19
|
|
|
private $termsOfService; |
|
20
|
|
|
|
|
21
|
|
|
private $title; |
|
22
|
|
|
|
|
23
|
|
|
private $version; |
|
24
|
|
|
|
|
25
|
4 |
|
public function createInfo(): Objects\Info |
|
26
|
|
|
{ |
|
27
|
4 |
|
return new Objects\Info( |
|
28
|
4 |
|
$this->getTitle(), |
|
29
|
4 |
|
$this->getVersion(), |
|
30
|
4 |
|
$this->getDescription(), |
|
31
|
4 |
|
$this->getTermsOfService(), |
|
32
|
4 |
|
$this->getContact() ? $this->getContact()->createContact() : null, |
|
33
|
4 |
|
$this->getLicense() ? $this->getLicense()->createLicense() : null, |
|
34
|
4 |
|
$this->getExtensions() |
|
35
|
|
|
); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
1 |
|
public function setContact(Objects\ContactFactory $contact): self |
|
39
|
|
|
{ |
|
40
|
1 |
|
$this->contact = $contact; |
|
41
|
|
|
|
|
42
|
1 |
|
return $this; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
1 |
|
public function setDescription(string $description): self |
|
46
|
|
|
{ |
|
47
|
1 |
|
$this->description = $description; |
|
48
|
|
|
|
|
49
|
1 |
|
return $this; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
1 |
|
public function setLicense(Objects\LicenseFactory $license): self |
|
53
|
|
|
{ |
|
54
|
1 |
|
$this->license = $license; |
|
55
|
|
|
|
|
56
|
1 |
|
return $this; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
1 |
|
public function setTermsOfService(string $termsOfService): self |
|
60
|
|
|
{ |
|
61
|
1 |
|
$this->termsOfService = $termsOfService; |
|
62
|
|
|
|
|
63
|
1 |
|
return $this; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
4 |
|
public function setTitle(string $title): self |
|
67
|
|
|
{ |
|
68
|
4 |
|
$this->title = $title; |
|
69
|
|
|
|
|
70
|
4 |
|
return $this; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
4 |
|
public function setVersion(string $version): self |
|
74
|
|
|
{ |
|
75
|
4 |
|
$this->version = $version; |
|
76
|
|
|
|
|
77
|
4 |
|
return $this; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
4 |
|
private function getContact(): ?Objects\ContactFactory |
|
81
|
|
|
{ |
|
82
|
4 |
|
return $this->contact; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
4 |
|
private function getDescription(): ?string |
|
86
|
|
|
{ |
|
87
|
4 |
|
return $this->description; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
4 |
|
private function getLicense(): ?Objects\LicenseFactory |
|
91
|
|
|
{ |
|
92
|
4 |
|
return $this->license; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
4 |
|
private function getTermsOfService(): ?string |
|
96
|
|
|
{ |
|
97
|
4 |
|
return $this->termsOfService; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
4 |
|
private function getTitle(): string |
|
101
|
|
|
{ |
|
102
|
4 |
|
return $this->title; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
4 |
|
private function getVersion(): string |
|
106
|
|
|
{ |
|
107
|
4 |
|
return $this->version; |
|
108
|
|
|
} |
|
109
|
|
|
} |
|
110
|
|
|
|