|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Aweapi\Openapi\Objects; |
|
6
|
|
|
|
|
7
|
|
|
use Aweapi\Openapi\Extensions; |
|
8
|
|
|
use Aweapi\Openapi\ValueObject; |
|
9
|
|
|
|
|
10
|
|
|
final class Encoding extends ValueObject |
|
11
|
|
|
{ |
|
12
|
|
|
use Properties\OptionalExtensions; |
|
13
|
|
|
|
|
14
|
|
|
private $allowReserved; |
|
15
|
|
|
|
|
16
|
|
|
private $contentType; |
|
17
|
|
|
|
|
18
|
|
|
private $explode; |
|
19
|
|
|
|
|
20
|
|
|
private $headers; |
|
21
|
|
|
|
|
22
|
|
|
private $style; |
|
23
|
|
|
|
|
24
|
9 |
|
public function __construct( |
|
25
|
|
|
string $contentType = null, |
|
26
|
|
|
Headers $headers = null, |
|
27
|
|
|
string $style = null, |
|
28
|
|
|
bool $explode = true, |
|
29
|
|
|
bool $allowReserved = false, |
|
30
|
|
|
Extensions $extensions = null |
|
31
|
|
|
) { |
|
32
|
9 |
|
$this->contentType = $contentType; |
|
33
|
9 |
|
$this->headers = $headers; |
|
34
|
9 |
|
$this->style = $style; |
|
35
|
9 |
|
$this->explode = $explode; |
|
36
|
9 |
|
$this->allowReserved = $allowReserved; |
|
37
|
9 |
|
$this->extensions = $extensions; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
6 |
|
public function getContentType(): string |
|
41
|
|
|
{ |
|
42
|
6 |
|
return $this->contentType; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
2 |
|
public function getHeaders(): Headers |
|
46
|
|
|
{ |
|
47
|
2 |
|
return $this->headers; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
2 |
|
public function getStyle(): string |
|
51
|
|
|
{ |
|
52
|
2 |
|
return $this->style; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
8 |
|
public function hasContentType(): bool |
|
56
|
|
|
{ |
|
57
|
8 |
|
return isset($this->contentType); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
8 |
|
public function hasHeaders(): bool |
|
61
|
|
|
{ |
|
62
|
8 |
|
return isset($this->headers); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
8 |
|
public function hasStyle(): bool |
|
66
|
|
|
{ |
|
67
|
8 |
|
return isset($this->style); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
8 |
|
public function isAllowReserved(): bool |
|
71
|
|
|
{ |
|
72
|
8 |
|
return $this->allowReserved; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
8 |
|
public function isExplode(): bool |
|
76
|
|
|
{ |
|
77
|
8 |
|
return $this->explode; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
8 |
|
public function jsonSerialize(): ?array |
|
81
|
|
|
{ |
|
82
|
8 |
|
return $this->extendedProperties(parent::jsonSerialize()); |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
8 |
|
protected function normalizeOptionalProperties(): array |
|
86
|
|
|
{ |
|
87
|
|
|
return [ |
|
88
|
8 |
|
'contentType' => $this->hasContentType() ? $this->getContentType() : null, |
|
89
|
8 |
|
'headers' => $this->hasHeaders() ? $this->getHeaders()->jsonSerialize() : null, |
|
90
|
8 |
|
'style' => $this->hasStyle() ? $this->getStyle() : null, |
|
91
|
8 |
|
'explode' => $this->isExplode() ? null : false, |
|
92
|
8 |
|
'allowReserved' => $this->isAllowReserved() ?: null, |
|
93
|
|
|
]; |
|
94
|
|
|
} |
|
95
|
|
|
} |
|
96
|
|
|
|