12
12
*
13
13
* Реализует управление заголовками запроса
14
14
*/
15
- class Headers implements HeadersInterface {
15
+ class Headers implements HeadersInterface
16
+ {
16
17
17
18
/**
18
19
* @var array Заголовки
@@ -56,7 +57,8 @@ private function getAllHeaders(): array
56
57
/**
57
58
* @inheritDoc
58
59
*/
59
- public function set (array $ params ): void {
60
+ public function set (array $ params ): void
61
+ {
60
62
$ this ->getAll ();
61
63
62
64
foreach ($ params as $ header => $ value )
@@ -70,7 +72,8 @@ public function set(array $params): void {
70
72
/**
71
73
* @inheritDoc
72
74
*/
73
- public function add (array $ params ): void {
75
+ public function add (array $ params ): void
76
+ {
74
77
foreach ($ params as $ header => $ value )
75
78
{
76
79
$ headerExists = array_key_exists ($ header , $ this ->headers );
@@ -83,7 +86,8 @@ public function add(array $params): void {
83
86
/**
84
87
* @inheritDoc
85
88
*/
86
- public function remove (string $ key ): void {
89
+ public function remove (string $ key ): void
90
+ {
87
91
$ this ->getAll ();
88
92
89
93
unset($ this ->headers [$ key ]);
@@ -93,7 +97,8 @@ public function remove(string $key): void {
93
97
/**
94
98
* @inheritDoc
95
99
*/
96
- public function removeAll (): void {
100
+ public function removeAll (): void
101
+ {
97
102
$ this ->headers = [];
98
103
99
104
header_remove ();
@@ -102,7 +107,8 @@ public function removeAll(): void {
102
107
/**
103
108
* @inheritDoc
104
109
*/
105
- public function has (string $ key ): bool {
110
+ public function has (string $ key ): bool
111
+ {
106
112
$ this ->getAll ();
107
113
108
114
return array_key_exists ($ key , $ this ->headers );
@@ -111,7 +117,8 @@ public function has(string $key): bool {
111
117
/**
112
118
* @inheritDoc
113
119
*/
114
- public function get (string $ key ): string {
120
+ public function get (string $ key ): string
121
+ {
115
122
if (!$ this ->has ($ key ))
116
123
{
117
124
throw new InvalidArgumentException ("Заголоков {$ key } отсутсвует. " );
@@ -123,9 +130,10 @@ public function get(string $key): string {
123
130
/**
124
131
* @inheritDoc
125
132
*/
126
- public function getAll (): array {
133
+ public function getAll (): array
134
+ {
127
135
$ this ->headers = !empty ($ this ->headers ) ? $ this ->headers : $ this ->getAllHeaders ();
128
136
129
137
return $ this ->headers ;
130
138
}
131
- }
139
+ }
0 commit comments