public function Debugger::extractRequestInfo in Acquia Purge 8
Extract information from a request.
Parameters
\Psr\Http\Message\RequestInterface $request: The HTTP request object.
bool $body_title: Whether the request body should be a titled array key.
Return value
string[] Tabular information which could be fed to ::writeTable().
Overrides DebuggerInterface::extractRequestInfo
1 call to Debugger::extractRequestInfo()
- Debugger::logFailedRequest in src/
Plugin/ Purge/ Purger/ Debugger.php - Log the given failure with as much info as possible.
File
- src/
Plugin/ Purge/ Purger/ Debugger.php, line 105
Class
- Debugger
- Provides a centralized debugger for Acquia purger plugins.
Namespace
Drupal\acquia_purge\Plugin\Purge\PurgerCode
public function extractRequestInfo(RequestInterface $request, $body_title = FALSE) {
$info = [];
$info['REQ'] = sprintf("%s %s HTTP/%s", $request
->getMethod(), $request
->getRequestTarget(), $request
->getProtocolVersion());
foreach ($request
->getHeaders() as $header => $value) {
$info['REQ ' . $header] = implode(',', $value);
}
if ($body = $request
->getBody()
->getContents()) {
if ($body_title) {
$info['REQ BODY'] = $body;
}
else {
$info[] = '';
$info[] = $body;
}
}
return $info;
}