|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Aweapi\Openapi\Builders; |
|
6
|
|
|
|
|
7
|
|
|
use Aweapi\Openapi\Objects; |
|
8
|
|
|
|
|
9
|
|
|
final class LinkBuilder implements Objects\LinkFactory |
|
10
|
|
|
{ |
|
11
|
|
|
use Properties\OptionalExtensions; |
|
12
|
|
|
|
|
13
|
|
|
private $description; |
|
14
|
|
|
|
|
15
|
|
|
private $operationId; |
|
16
|
|
|
|
|
17
|
|
|
private $operationRef; |
|
18
|
|
|
|
|
19
|
|
|
private $parameters = []; |
|
20
|
|
|
|
|
21
|
|
|
private $requestBody; |
|
22
|
|
|
|
|
23
|
|
|
private $server; |
|
24
|
|
|
|
|
25
|
5 |
|
public function createLink(): Objects\Link |
|
26
|
|
|
{ |
|
27
|
5 |
|
return new Objects\Link( |
|
28
|
5 |
|
$this->getOperationId(), |
|
29
|
5 |
|
$this->getOperationRef(), |
|
30
|
5 |
|
$this->getDescription(), |
|
31
|
5 |
|
$this->getParameters(), |
|
32
|
5 |
|
$this->getRequestBody(), |
|
33
|
5 |
|
$this->getServer() ? $this->getServer()->createServer() : null, |
|
34
|
5 |
|
$this->getExtensions() |
|
35
|
|
|
); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
1 |
|
public function setDescription(string $description): self |
|
39
|
|
|
{ |
|
40
|
1 |
|
$this->description = $description; |
|
41
|
|
|
|
|
42
|
1 |
|
return $this; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
4 |
|
public function setOperationId(string $operationId): self |
|
46
|
|
|
{ |
|
47
|
4 |
|
$this->operationId = $operationId; |
|
48
|
|
|
|
|
49
|
4 |
|
return $this; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
1 |
|
public function setOperationRef(string $operationRef): self |
|
53
|
|
|
{ |
|
54
|
1 |
|
$this->operationRef = $operationRef; |
|
55
|
|
|
|
|
56
|
1 |
|
return $this; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
1 |
|
public function setParameters(array $parameters): self |
|
60
|
|
|
{ |
|
61
|
1 |
|
$this->parameters = $parameters; |
|
62
|
|
|
|
|
63
|
1 |
|
return $this; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @param mixed $requestBody |
|
68
|
|
|
*/ |
|
69
|
1 |
|
public function setRequestBody($requestBody): self |
|
70
|
|
|
{ |
|
71
|
1 |
|
$this->requestBody = $requestBody; |
|
72
|
|
|
|
|
73
|
1 |
|
return $this; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
1 |
|
public function setServer(Objects\ServerFactory $server): self |
|
77
|
|
|
{ |
|
78
|
1 |
|
$this->server = $server; |
|
79
|
|
|
|
|
80
|
1 |
|
return $this; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
5 |
|
private function getDescription(): ?string |
|
84
|
|
|
{ |
|
85
|
5 |
|
return $this->description; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
5 |
|
private function getOperationId(): ?string |
|
89
|
|
|
{ |
|
90
|
5 |
|
return $this->operationId; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
5 |
|
private function getOperationRef(): ?string |
|
94
|
|
|
{ |
|
95
|
5 |
|
return $this->operationRef; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
5 |
|
private function getParameters(): array |
|
99
|
|
|
{ |
|
100
|
5 |
|
return $this->parameters; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* @return mixed |
|
105
|
|
|
*/ |
|
106
|
5 |
|
private function getRequestBody() |
|
107
|
|
|
{ |
|
108
|
5 |
|
return $this->requestBody; |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
5 |
|
private function getServer(): ?Objects\ServerFactory |
|
112
|
|
|
{ |
|
113
|
5 |
|
return $this->server; |
|
114
|
|
|
} |
|
115
|
|
|
} |
|
116
|
|
|
|