You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`getContents(MessageInterface $message)`|`string`| Reads the body content of a `MessageInterface` and makes sure to rewind. |
73
-
|`decodeJSON(MessageInterface $message, bool $assoc = null)`| mixed | fetches the body of a `MessageInterface` and converts it to a JSON object (`stdClass`) or an associative array if `$assoc` is set to `true` and returns the result. |
74
-
|`decodeXML(MessageInterface $message, bool $assoc = null)`| mixed | fetches the body of a `MessageInterface` and converts it to a `SimpleXMLElement` or an associative array if `$assoc` is set to `true` and returns the result. |
75
-
|`toString(MessageInterface $message)`|`string`| Returns the string representation of an HTTP message. |
76
-
|`decompress(MessageInterface $message)`|`string`| Decompresses the message content according to the `Content-Encoding` header (`compress`, `deflate`, `gzip`, `br`, `zstd`) and returns the decompressed data. `br` and `zstd` will throw a `RuntimeException` if the respecive extensions are missing. |
77
-
|`setContentLengthHeader(MessageInterface $message)`|`MessageInterface`| ets a Content-Length header in the given message in case it does not exist and body size is not null |
|`getContents(MessageInterface $message)`|`string`| Reads the body content of a `MessageInterface` and makes sure to rewind. |
73
+
|`decodeJSON(MessageInterface $message, bool $assoc = null)`| mixed | fetches the body of a `MessageInterface` and converts it to a JSON object (`stdClass`) or an associative array if `$assoc` is set to `true` and returns the result. |
74
+
|`decodeXML(MessageInterface $message, bool $assoc = null)`| mixed | fetches the body of a `MessageInterface` and converts it to a `SimpleXMLElement` or an associative array if `$assoc` is set to `true` and returns the result. |
75
+
|`toString(MessageInterface $message)`|`string`| Returns the string representation of an HTTP message. |
76
+
|`decompress(MessageInterface $message)`|`string`| Decompresses the message content according to the `Content-Encoding` header (`compress`, `deflate`, `gzip`, `br`, `zstd`) and returns the decompressed data. `br` and `zstd` will throw a `RuntimeException` if the respecive extensions are missing. |
77
+
|`setContentLengthHeader(MessageInterface $message)`|`MessageInterface`| Sets a Content-Length header in the given message in case it does not exist and body size is not null |
78
+
|`setContentTypeHeader(MessageInterface $message, string $filename = null, string $extension = null)`|`MessageInterface`| Tries to determine the content type from the given values and sets the Content-Type header accordingly, throws if no mime type could be guessed. |
78
79
79
80
### `UriUtil`
80
81
| method | return | info |
@@ -94,6 +95,11 @@ The following classes contain static methods for use with PSR-7 http message obj
94
95
|`getFromFilename(string $filename)`|`?string`| Get the mime type from a file name |
95
96
|`getFromContent(string $content)`|`?string`| Get the mime type from the given content |
|`getContents(string $extension)`|`string`| Reads the content from a stream and make sure we rewind |
102
+
97
103
### `ServerUtil`
98
104
The `ServerUtil` object requires a set of [PSR-17 factories](https://www.php-fig.org/psr/psr-17/) on invocation, namely `ServerRequestFactoryInterface`, `UriFactoryInterface`, `UploadedFileFactoryInterface` and `StreamFactoryInterface`.
99
105
It provides convenience methods to create server requests, URIs and uploaded files from the [superglobals](https://www.php.net/manual/en/language.variables.superglobals.php).
0 commit comments