1 | <?php |
||
14 | class Operation extends AbstractModel implements Arrayable { |
||
15 | |||
16 | use ConsumesPart; |
||
17 | use ProducesPart; |
||
18 | use TagsPart; |
||
19 | use ParametersPart; |
||
20 | use ResponsesPart; |
||
21 | use ExternalDocsPart; |
||
22 | use ExtensionPart; |
||
23 | |||
24 | /** @var string */ |
||
25 | private $summary; |
||
26 | |||
27 | /** @var string */ |
||
28 | private $description; |
||
29 | |||
30 | /** @var string */ |
||
31 | private $operationId; |
||
32 | |||
33 | /** @var boolean */ |
||
34 | private $deprecated = false; |
||
35 | |||
36 | 8 | public function __construct($contents = []) { |
|
39 | |||
40 | 8 | private function parse($contents = []) { |
|
41 | 8 | $data = CollectionUtils::toMap($contents); |
|
42 | |||
43 | 8 | $this->summary = $data->get('summary'); |
|
44 | 8 | $this->description = $data->get('description'); |
|
45 | 8 | $this->operationId = $data->get('operationId'); |
|
46 | 8 | $this->deprecated = $data->has('deprecated') && $data->get('deprecated'); |
|
47 | |||
48 | // parts |
||
49 | 8 | $this->parseConsumes($data); |
|
50 | 8 | $this->parseProduces($data); |
|
51 | 8 | $this->parseTags($data); |
|
52 | 8 | $this->parseParameters($data); |
|
53 | 8 | $this->parseResponses($data); |
|
54 | 8 | $this->parseExternalDocs($data); |
|
55 | 8 | $this->parseExtensions($data); |
|
56 | 8 | } |
|
57 | |||
58 | 6 | public function toArray() { |
|
62 | |||
63 | /** |
||
64 | * |
||
65 | * @return the string |
||
66 | */ |
||
67 | 6 | public function getSummary() { |
|
68 | return $this->summary; |
||
69 | 6 | } |
|
70 | |||
71 | /** |
||
72 | * |
||
73 | * @param string $summary |
||
74 | * @return $this |
||
75 | */ |
||
76 | public function setSummary($summary) { |
||
80 | |||
81 | /** |
||
82 | * |
||
83 | * @return string |
||
84 | */ |
||
85 | public function getDescription() { |
||
88 | |||
89 | /** |
||
90 | * |
||
91 | * @param string $description |
||
92 | */ |
||
93 | public function setDescription($description) { |
||
97 | |||
98 | /** |
||
99 | * |
||
100 | * @return string |
||
101 | */ |
||
102 | public function getOperationId() { |
||
105 | |||
106 | /** |
||
107 | * |
||
108 | * @param string $operationId |
||
109 | * @return $this |
||
110 | */ |
||
111 | public function setOperationId($operationId) { |
||
115 | |||
116 | /** |
||
117 | * |
||
118 | * @return boolean |
||
119 | */ |
||
120 | public function getDeprecated() { |
||
123 | |||
124 | /** |
||
125 | * |
||
126 | * @param boolean $deprecated |
||
127 | * @return $this |
||
128 | */ |
||
129 | public function setDeprecated($deprecated) { |
||
133 | |||
134 | |||
135 | } |