1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Aweapi\Openapi\Builders; |
6
|
|
|
|
7
|
|
|
use Aweapi\Openapi\Objects; |
8
|
|
|
|
9
|
|
|
final class ComponentsBuilder implements Objects\ComponentsFactory |
10
|
|
|
{ |
11
|
|
|
use Properties\OptionalExtensions; |
12
|
|
|
|
13
|
|
|
private $callbacks; |
14
|
|
|
|
15
|
|
|
private $examples; |
16
|
|
|
|
17
|
|
|
private $headers; |
18
|
|
|
|
19
|
|
|
private $links; |
20
|
|
|
|
21
|
|
|
private $parameters; |
22
|
|
|
|
23
|
|
|
private $requestBodies; |
24
|
|
|
|
25
|
|
|
private $responses; |
26
|
|
|
|
27
|
|
|
private $schemas; |
28
|
|
|
|
29
|
|
|
// private $securitySchemes; |
30
|
|
|
|
31
|
3 |
|
public function createComponents(): Objects\Components |
32
|
|
|
{ |
33
|
3 |
|
return new Objects\Components( |
34
|
3 |
|
$this->getSchemas() ? $this->getSchemas()->createSchemas() : null, |
35
|
3 |
|
$this->getResponses() ? $this->getResponses()->createResponses() : null, |
36
|
3 |
|
$this->getParameters() ? $this->getParameters()->createParameters() : null, |
37
|
3 |
|
$this->getRequestBodies() ? $this->getRequestBodies()->createRequestBodies() : null, |
38
|
3 |
|
$this->getHeaders() ? $this->getHeaders()->createHeaders() : null, |
39
|
3 |
|
null, |
40
|
3 |
|
$this->getLinks() ? $this->getLinks()->createLinks() : null, |
41
|
3 |
|
$this->getCallbacks() ? $this->getCallbacks()->createCallbackRequests() : null, |
42
|
3 |
|
$this->getExample() ? $this->getExample()->createExamples() : null, |
43
|
3 |
|
$this->getExtensions() |
44
|
|
|
); |
45
|
|
|
} |
46
|
|
|
|
47
|
1 |
|
public function setCallbacks(Objects\CallbackRequestsFactory $callbacks): self |
48
|
|
|
{ |
49
|
1 |
|
$this->callbacks = $callbacks; |
50
|
|
|
|
51
|
1 |
|
return $this; |
52
|
|
|
} |
53
|
|
|
|
54
|
1 |
|
public function setExamples(Objects\ExamplesFactory $examples): self |
55
|
|
|
{ |
56
|
1 |
|
$this->examples = $examples; |
57
|
|
|
|
58
|
1 |
|
return $this; |
59
|
|
|
} |
60
|
|
|
|
61
|
1 |
|
public function setHeaders(Objects\HeadersFactory $headers): self |
62
|
|
|
{ |
63
|
1 |
|
$this->headers = $headers; |
64
|
|
|
|
65
|
1 |
|
return $this; |
66
|
|
|
} |
67
|
|
|
|
68
|
1 |
|
public function setLinks(Objects\LinksFactory $links): self |
69
|
|
|
{ |
70
|
1 |
|
$this->links = $links; |
71
|
|
|
|
72
|
1 |
|
return $this; |
73
|
|
|
} |
74
|
|
|
|
75
|
1 |
|
public function setParameters(Objects\ParametersFactory $parameters): self |
76
|
|
|
{ |
77
|
1 |
|
$this->parameters = $parameters; |
78
|
|
|
|
79
|
1 |
|
return $this; |
80
|
|
|
} |
81
|
|
|
|
82
|
1 |
|
public function setRequestBodies(Objects\RequestBodiesFactory $requestBodies): self |
83
|
|
|
{ |
84
|
1 |
|
$this->requestBodies = $requestBodies; |
85
|
|
|
|
86
|
1 |
|
return $this; |
87
|
|
|
} |
88
|
|
|
|
89
|
1 |
|
public function setResponses(Objects\ResponsesFactory $responses): self |
90
|
|
|
{ |
91
|
1 |
|
$this->responses = $responses; |
92
|
|
|
|
93
|
1 |
|
return $this; |
94
|
|
|
} |
95
|
|
|
|
96
|
2 |
|
public function setSchemas(Objects\SchemasFactory $schemas): self |
97
|
|
|
{ |
98
|
2 |
|
$this->schemas = $schemas; |
99
|
|
|
|
100
|
2 |
|
return $this; |
101
|
|
|
} |
102
|
|
|
|
103
|
3 |
|
private function getCallbacks(): ?Objects\CallbackRequestsFactory |
104
|
|
|
{ |
105
|
3 |
|
return $this->callbacks; |
106
|
|
|
} |
107
|
|
|
|
108
|
3 |
|
private function getExample(): ?Objects\ExamplesFactory |
109
|
|
|
{ |
110
|
3 |
|
return $this->examples; |
111
|
|
|
} |
112
|
|
|
|
113
|
3 |
|
private function getHeaders(): ?Objects\HeadersFactory |
114
|
|
|
{ |
115
|
3 |
|
return $this->headers; |
116
|
|
|
} |
117
|
|
|
|
118
|
3 |
|
private function getLinks(): ?Objects\LinksFactory |
119
|
|
|
{ |
120
|
3 |
|
return $this->links; |
121
|
|
|
} |
122
|
|
|
|
123
|
3 |
|
private function getParameters(): ?Objects\ParametersFactory |
124
|
|
|
{ |
125
|
3 |
|
return $this->parameters; |
126
|
|
|
} |
127
|
|
|
|
128
|
3 |
|
private function getRequestBodies(): ?Objects\RequestBodiesFactory |
129
|
|
|
{ |
130
|
3 |
|
return $this->requestBodies; |
131
|
|
|
} |
132
|
|
|
|
133
|
3 |
|
private function getResponses(): ?Objects\ResponsesFactory |
134
|
|
|
{ |
135
|
3 |
|
return $this->responses; |
136
|
|
|
} |
137
|
|
|
|
138
|
3 |
|
private function getSchemas(): ?Objects\SchemasFactory |
139
|
|
|
{ |
140
|
3 |
|
return $this->schemas; |
141
|
|
|
} |
142
|
|
|
} |
143
|
|
|
|