1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the API Platform project. |
5
|
|
|
* |
6
|
|
|
* (c) Kévin Dunglas <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(strict_types=1); |
13
|
|
|
|
14
|
|
|
namespace ApiPlatform\Core\OpenApi; |
15
|
|
|
|
16
|
|
|
class Operation |
17
|
|
|
{ |
18
|
|
|
private $tags; |
19
|
|
|
private $summary; |
20
|
|
|
private $description; |
21
|
|
|
private $operationId; |
22
|
|
|
/** |
23
|
|
|
* @Parameter | Reference |
24
|
|
|
*/ |
25
|
|
|
private $parameters; |
26
|
|
|
|
27
|
|
|
private $requestBody; |
28
|
|
|
private $responses; |
29
|
|
|
private $callbacks; |
30
|
|
|
private $deprecated; |
31
|
|
|
private $security; |
32
|
|
|
private $servers; |
33
|
|
|
private $externalDocs; |
34
|
|
|
|
35
|
|
|
public function __construct(string $operationId = null, array $tags = [], array $responses = [], string $summary = '', string $description = '', $externalDocs = [], array $parameters = [], RequestBody $requestBody = null, $callbacks = [], bool $deprecated = false, $security = [], array $servers = []) |
36
|
|
|
{ |
37
|
|
|
$this->tags = $tags; |
38
|
|
|
$this->summary = $summary; |
39
|
|
|
$this->description = $description; |
40
|
|
|
$this->operationId = $operationId; |
41
|
|
|
$this->parameters = $parameters; |
42
|
|
|
$this->requestBody = $requestBody; |
43
|
|
|
$this->responses = $responses; |
44
|
|
|
$this->callbacks = $callbacks; |
45
|
|
|
$this->deprecated = $deprecated; |
46
|
|
|
$this->security = $security; |
47
|
|
|
$this->servers = $servers; |
48
|
|
|
$this->externalDocs = $externalDocs; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function addResponse(Response $response, $status = 'default') |
52
|
|
|
{ |
53
|
|
|
$this->responses[$status] = $response; |
54
|
|
|
|
55
|
|
|
return $this; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function getTags() |
59
|
|
|
{ |
60
|
|
|
return $this->tags; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function getSummary() |
64
|
|
|
{ |
65
|
|
|
return $this->summary; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
public function getDescription() |
69
|
|
|
{ |
70
|
|
|
return $this->description; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function getOperationId() |
74
|
|
|
{ |
75
|
|
|
return $this->operationId; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function getParameters() |
79
|
|
|
{ |
80
|
|
|
return $this->parameters; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function getRequestBody() |
84
|
|
|
{ |
85
|
|
|
return $this->requestBody; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function getResponses() |
89
|
|
|
{ |
90
|
|
|
return $this->responses; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public function getCallbacks() |
94
|
|
|
{ |
95
|
|
|
return $this->callbacks; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function getDeprecated() |
99
|
|
|
{ |
100
|
|
|
return $this->deprecated; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function getSecurity() |
104
|
|
|
{ |
105
|
|
|
return $this->security; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
public function getServers() |
109
|
|
|
{ |
110
|
|
|
return $this->servers; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
public function getExternalDocs() |
114
|
|
|
{ |
115
|
|
|
return $this->externalDocs; |
116
|
|
|
} |
117
|
|
|
} |
118
|
|
|
|