MessageHelper
Controller trait with some handy methods.
Instance Methods
| Returns | Signature and Description |
|---|---|
Map<string,mixed> | getParsedBodyMap()Gets a |
Principal | getPrincipal()Gets the stored principal, or the anonymous user if none was found. |
Map<string,mixed> | getQueryParamsMap()Gets a |
ResponseInterface | ifModSince(, , )Checks the |
ResponseInterface | ifNoneMatch(, , )Checks the |
PaginationFactory | Gets a pagination factory |
ResponseInterface | redirect(, , )Redirects the user to another URL. |
ResponseInterface | write(, )Cleanly writes the body to the response. |
Method Details
getParsedBodyMap
getParsedBodyMap(ServerRequestInterface $request)Gets a Map of the request body content.
| Name | Type | Description |
|---|---|---|
$request | ServerRequestInterface | The request |
| Type | Description |
|---|---|
Map<string,mixed> | The Map of request body content |
getPrincipal
getPrincipal(ServerRequestInterface $request)Gets the stored principal, or the anonymous user if none was found.
| Name | Type | Description |
|---|---|---|
$request | ServerRequestInterface | The HTTP request |
| Type | Description |
|---|---|
Principal | The authenticated principal |
getQueryParamsMap
getQueryParamsMap(ServerRequestInterface $request)Gets a Map of the request query params.
| Name | Type | Description |
|---|---|---|
$request | ServerRequestInterface | The request |
| Type | Description |
|---|---|
Map<string,mixed> | The Map of query params |
ifModSince
ifModSince(ServerRequestInterface $request, ResponseInterface $response, int $timestamp)Checks the If-Modified-Since header, maybe sending 304 Not Modified.
| Name | Type | Description |
|---|---|---|
$request | ServerRequestInterface | The HTTP request |
$response | ResponseInterface | The HTTP response |
$timestamp | int | The timestamp for comparison |
| Type | Description |
|---|---|
ResponseInterface | The same or new response |
ifNoneMatch
ifNoneMatch(ServerRequestInterface $request, ResponseInterface $response, string $etag)Checks the If-None-Match header, maybe sending 304 Not Modified.
| Name | Type | Description |
|---|---|---|
$request | ServerRequestInterface | The HTTP request |
$response | ResponseInterface | The HTTP response |
$etag | string | The ETag for comparison |
| Type | Description |
|---|---|
ResponseInterface | The same or new response |
paginationFactory
paginationFactory()Gets a pagination factory
| Type | Description |
|---|---|
PaginationFactory | The pagination factory |
redirect
redirect(ResponseInterface $response, int $code, string $url)Redirects the user to another URL.
| Name | Type | Description |
|---|---|---|
$response | ResponseInterface | The HTTP response |
$code | int | |
$url | string |
| Type | Description |
|---|---|
ResponseInterface | The new response |
write
write(ResponseInterface $response, mixed $body)Cleanly writes the body to the response.
| Name | Type | Description |
|---|---|---|
$response | ResponseInterface | The HTTP response |
$body | mixed | The body to write |
| Type | Description |
|---|---|
ResponseInterface | The same or new response |