YoastSEO_Vendor\GuzzleHttp\Handler
StreamHandler::getDefaultContext() private Yoast 1.0
{} Это метод класса: StreamHandler{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
// private - только в коде основоного (родительского) класса $result = $this->getDefaultContext( \YoastSEO_Vendor\Psr\Http\Message\RequestInterface $request );
Код StreamHandler::getDefaultContext() StreamHandler::getDefaultContext Yoast 15.7
private function getDefaultContext(\YoastSEO_Vendor\Psr\Http\Message\RequestInterface $request)
{
$headers = '';
foreach ($request->getHeaders() as $name => $value) {
foreach ($value as $val) {
$headers .= "{$name}: {$val}\r\n";
}
}
$context = ['http' => ['method' => $request->getMethod(), 'header' => $headers, 'protocol_version' => $request->getProtocolVersion(), 'ignore_errors' => \true, 'follow_location' => 0]];
$body = (string) $request->getBody();
if (!empty($body)) {
$context['http']['content'] = $body;
// Prevent the HTTP handler from adding a Content-Type header.
if (!$request->hasHeader('Content-Type')) {
$context['http']['header'] .= "Content-Type:\r\n";
}
}
$context['http']['header'] = \rtrim($context['http']['header']);
return $context;
}