class RequestUtil
Methods
static bool
isApiRequest(ServerRequestInterface $request)
Determine if the request is an API request. We do not manually set the `Accepts` header for API requests, so we need to check the priority list to determine whether it is or not.
static string
getPreferredContentType(ServerRequestInterface $request, array $types)
Determine the client's preferred content type out of the given list.
static ServerRequestInterface
static array|null
extractSort(ServerRequestInterface $request, string|null $default, array $available = [])
No description
static int|null
extractLimit(ServerRequestInterface $request, int|null $defaultLimit = null, int|null $max = null)
No description
static array
extractFields(ServerRequestInterface $request, array|null $available = null)
No description
Details
at
line 24
static bool
isApiRequest(ServerRequestInterface $request)
Determine if the request is an API request. We do not manually set the `Accepts` header for API requests, so we need to check the priority list to determine whether it is or not.
Normal browsing requests will have `text/html` as their preferred content type, while API will have `* / *`.
at
line 34
static bool
isHtmlRequest(ServerRequestInterface $request)
at
line 46
static string
getPreferredContentType(ServerRequestInterface $request, array $types)
Determine the client's preferred content type out of the given list.