1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
response.php
См. документацию.
1
<?php
2
9
10
namespace
Bitrix\Main\Web\Http;
11
12
use Psr\Http\Message\ResponseInterface;
13
use Psr\Http\Message\StreamInterface;
14
15
class
Response
extends
Message
implements ResponseInterface
16
{
17
public
function
__construct
(
int
$statusCode,
array
$headers
=
null
, StreamInterface
$body
=
null
,
string
$version =
null
,
string
$reasonPhrase =
''
)
18
{
19
parent::__construct(
$headers
,
$body
, $version);
20
21
$this->headers->setStatus($statusCode, $reasonPhrase);
22
}
23
27
public
function
getStatusCode
(): int
28
{
29
return
$this->headers->getStatus();
30
}
31
35
public
function
withStatus
(
int
$code
,
string
$reasonPhrase =
''
): ResponseInterface
36
{
37
$new
= clone $this;
38
$new
->headers->setStatus(
$code
, $reasonPhrase);
39
40
return
$new
;
41
}
42
46
public
function
getReasonPhrase
(): string
47
{
48
return
$this->headers->getReasonPhrase();
49
}
50
55
public
function
adjustHeaders
(): void
56
{
57
// If a Client chooses to decompress the message body then it MUST also remove the Content-Encoding header and adjust the Content-Length header
58
if
(strtolower($this->headers->get(
'Content-Encoding'
) ??
''
) ==
'gzip'
)
59
{
60
$this->headers->delete(
'Content-Encoding'
);
61
62
if
($this->headers->has(
'Content-Length'
))
63
{
64
$size = $this->body->getSize();
65
if
($size !==
null
)
66
{
67
$this->headers->set(
'Content-Length'
, $size);
68
}
69
else
70
{
71
$this->headers->delete(
'Content-Length'
);
72
}
73
}
74
}
75
76
// Already dechunked
77
if
(strtolower($this->headers->get(
'Transfer-Encoding'
) ??
''
) ==
'chunked'
)
78
{
79
$this->headers->delete(
'Transfer-Encoding'
);
80
}
81
}
82
}
Bitrix\Main\Response
Определения
response.php:5
Bitrix\Main\Web\Http\Message
Определения
message.php:17
Bitrix\Main\Web\Http\Message\$headers
HttpHeaders $headers
Определения
message.php:18
Bitrix\Main\Web\Http\Message\$body
StreamInterface $body
Определения
message.php:19
Bitrix\Main\Web\Http\Response\__construct
__construct(int $statusCode, array $headers=null, StreamInterface $body=null, string $version=null, string $reasonPhrase='')
Определения
response.php:17
Bitrix\Main\Web\Http\Response\getStatusCode
getStatusCode()
Определения
response.php:27
Bitrix\Main\Web\Http\Response\withStatus
withStatus(int $code, string $reasonPhrase='')
Определения
response.php:35
Bitrix\Main\Web\Http\Response\getReasonPhrase
getReasonPhrase()
Определения
response.php:46
Bitrix\Main\Web\Http\Response\adjustHeaders
adjustHeaders()
Определения
response.php:55
$new
$new
Определения
file_edit.php:48
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$code
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения
options.php:195
bitrix
modules
main
lib
web
http
response.php
Создано системой
1.14.0