private invalidateResponse ( Psr\Http\Message\ResponseInterface $response, string $reason, array $headers = [], string | null $body = null ) : Psr\Http\Message\ResponseInterface | ||
$response | Psr\Http\Message\ResponseInterface | |
$reason | string | |
$headers | array | |
$body | string | null | |
Результат | Psr\Http\Message\ResponseInterface |
private function invalidateResponse(ResponseInterface $response, $reason, array $headers = [], $body = null)
{
$response = $response->withStatus(422, $reason);
foreach ($headers as $name => $value) {
$response = $response->withHeader($name, $value);
}
if ($body !== null) {
$stream = $response->getBody();
$stream->write($body);
}
return $response;
}