@@ -30,7 +30,6 @@ discard block |
||
30 | 30 | * |
31 | 31 | * |
32 | 32 | * @param bool|string $implode Implode header lines, false to return header as array. |
33 | - |
|
34 | 33 | * @return string|array |
35 | 34 | */ |
36 | 35 | public function get(string $name, $default = null, $implode = ',') |
@@ -69,7 +68,6 @@ discard block |
||
69 | 68 | * Normalize header name. |
70 | 69 | * |
71 | 70 | * @param string $header |
72 | - |
|
73 | 71 | * @return string |
74 | 72 | */ |
75 | 73 | protected function normalize(string $header): string |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | $value = parent::get($this->normalize($name), $default); |
39 | 39 | |
40 | - if (!empty($implode) && is_array($value)) { |
|
40 | + if (!empty($implode) && is_array($value)){ |
|
41 | 41 | return implode($implode, $value); |
42 | 42 | } |
43 | 43 | |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | |
56 | 56 | $values = parent::fetch($keys, $fill, $filler); |
57 | 57 | |
58 | - if (!empty($implode)) { |
|
59 | - foreach ($values as &$value) { |
|
58 | + if (!empty($implode)){ |
|
59 | + foreach ($values as &$value){ |
|
60 | 60 | $value = implode($implode, $value); |
61 | 61 | unset($value); |
62 | 62 | } |
@@ -37,7 +37,8 @@ discard block |
||
37 | 37 | { |
38 | 38 | $value = parent::get($this->normalize($name), $default); |
39 | 39 | |
40 | - if (!empty($implode) && is_array($value)) { |
|
40 | + if (!empty($implode) && is_array($value)) |
|
41 | + { |
|
41 | 42 | return implode($implode, $value); |
42 | 43 | } |
43 | 44 | |
@@ -55,8 +56,10 @@ discard block |
||
55 | 56 | |
56 | 57 | $values = parent::fetch($keys, $fill, $filler); |
57 | 58 | |
58 | - if (!empty($implode)) { |
|
59 | - foreach ($values as &$value) { |
|
59 | + if (!empty($implode)) |
|
60 | + { |
|
61 | + foreach ($values as &$value) |
|
62 | + { |
|
60 | 63 | $value = implode($implode, $value); |
61 | 64 | unset($value); |
62 | 65 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | ResponseFactoryInterface $responseFactory, |
47 | 47 | StreamFactoryInterface $streamFactory, |
48 | 48 | FilesInterface $files |
49 | - ) { |
|
49 | + ){ |
|
50 | 50 | $this->responseFactory = $responseFactory; |
51 | 51 | $this->streamFactory = $streamFactory; |
52 | 52 | $this->files = $files; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function redirect($uri, int $code = 302): ResponseInterface |
74 | 74 | { |
75 | - if (!is_string($uri) && !$uri instanceof UriInterface) { |
|
75 | + if (!is_string($uri) && !$uri instanceof UriInterface){ |
|
76 | 76 | throw new ResponseException('Redirect allowed only for string or UriInterface uris'); |
77 | 77 | } |
78 | 78 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | string $name = '', |
109 | 109 | string $mime = 'application/octet-stream' |
110 | 110 | ): ResponseInterface { |
111 | - if (empty($name)) { |
|
112 | - if (!is_string($filename)) { |
|
111 | + if (empty($name)){ |
|
112 | + if (!is_string($filename)){ |
|
113 | 113 | throw new ResponseException('Unable to resolve public filename'); |
114 | 114 | } |
115 | 115 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $response = $response->withHeader('Content-Length', (string)$stream->getSize()); |
124 | 124 | $response = $response->withHeader( |
125 | 125 | 'Content-Disposition', |
126 | - 'attachment; filename="' . addcslashes($name, '"') . '"' |
|
126 | + 'attachment; filename="'.addcslashes($name, '"').'"' |
|
127 | 127 | ); |
128 | 128 | |
129 | 129 | return $response->withBody($stream); |
@@ -156,19 +156,19 @@ discard block |
||
156 | 156 | */ |
157 | 157 | private function getStream($file): StreamInterface |
158 | 158 | { |
159 | - if ($file instanceof StreamableInterface) { |
|
159 | + if ($file instanceof StreamableInterface){ |
|
160 | 160 | return $file->getStream(); |
161 | 161 | } |
162 | 162 | |
163 | - if ($file instanceof StreamInterface) { |
|
163 | + if ($file instanceof StreamInterface){ |
|
164 | 164 | return $file; |
165 | 165 | } |
166 | 166 | |
167 | - if (is_resource($file)) { |
|
167 | + if (is_resource($file)){ |
|
168 | 168 | return $this->streamFactory->createStreamFromResource($file); |
169 | 169 | } |
170 | 170 | |
171 | - if (!$this->files->isFile($file)) { |
|
171 | + if (!$this->files->isFile($file)){ |
|
172 | 172 | throw new ResponseException('Unable to allocate response body stream, file does not exist'); |
173 | 173 | } |
174 | 174 |
@@ -72,7 +72,8 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function redirect($uri, int $code = 302): ResponseInterface |
74 | 74 | { |
75 | - if (!is_string($uri) && !$uri instanceof UriInterface) { |
|
75 | + if (!is_string($uri) && !$uri instanceof UriInterface) |
|
76 | + { |
|
76 | 77 | throw new ResponseException('Redirect allowed only for string or UriInterface uris'); |
77 | 78 | } |
78 | 79 | |
@@ -108,8 +109,10 @@ discard block |
||
108 | 109 | string $name = '', |
109 | 110 | string $mime = 'application/octet-stream' |
110 | 111 | ): ResponseInterface { |
111 | - if (empty($name)) { |
|
112 | - if (!is_string($filename)) { |
|
112 | + if (empty($name)) |
|
113 | + { |
|
114 | + if (!is_string($filename)) |
|
115 | + { |
|
113 | 116 | throw new ResponseException('Unable to resolve public filename'); |
114 | 117 | } |
115 | 118 | |
@@ -156,19 +159,23 @@ discard block |
||
156 | 159 | */ |
157 | 160 | private function getStream($file): StreamInterface |
158 | 161 | { |
159 | - if ($file instanceof StreamableInterface) { |
|
162 | + if ($file instanceof StreamableInterface) |
|
163 | + { |
|
160 | 164 | return $file->getStream(); |
161 | 165 | } |
162 | 166 | |
163 | - if ($file instanceof StreamInterface) { |
|
167 | + if ($file instanceof StreamInterface) |
|
168 | + { |
|
164 | 169 | return $file; |
165 | 170 | } |
166 | 171 | |
167 | - if (is_resource($file)) { |
|
172 | + if (is_resource($file)) |
|
173 | + { |
|
168 | 174 | return $this->streamFactory->createStreamFromResource($file); |
169 | 175 | } |
170 | 176 | |
171 | - if (!$this->files->isFile($file)) { |
|
177 | + if (!$this->files->isFile($file)) |
|
178 | + { |
|
172 | 179 | throw new ResponseException('Unable to allocate response body stream, file does not exist'); |
173 | 180 | } |
174 | 181 |