1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
httpcookies.php
См. документацию.
1
<?php
2
9
10
namespace
Bitrix\Main\Web;
11
12
use Bitrix\Main\ArgumentTypeException;
13
17
class
HttpCookies
extends
\Bitrix\Main\Type\Dictionary
18
{
22
public
function
__construct
(
array
$values
=
null
)
23
{
24
if
(
$values
!==
null
)
25
{
26
foreach
(
$values
as
$key
=> $value)
27
{
28
if
(!($value instanceof
Http
\
Cookie
))
29
{
30
$value =
new
Http\Cookie
(
$key
, $value);
31
}
32
$this[
$key
] = $value;
33
}
34
}
35
}
36
41
public
function
implode
(): string
42
{
43
$str
=
''
;
44
foreach
($this->values as $cookie)
45
{
46
$str
.= (
$str
==
''
?
''
:
'; '
) . rawurlencode($cookie->getName()) .
'='
. rawurlencode($cookie->getValue());
47
}
48
49
return
$str
;
50
}
51
52
public
function
addFromString
(
string
$str
): void
53
{
54
if
(($pos = strpos(
$str
,
';'
)) !==
false
&& $pos > 0)
55
{
56
$cookie = trim(substr(
$str
, 0, $pos));
57
}
58
else
59
{
60
$cookie = trim(
$str
);
61
}
62
$cookies = explode(
'='
, $cookie, 2);
63
64
$name
= rawurldecode($cookies[0]);
65
$value = rawurldecode($cookies[1]);
66
67
// TODO: a cookie has more attributes
68
$this[
$name
] =
new
Http\Cookie
(
$name
, $value);
69
}
70
71
public
function
toArray
()
72
{
73
$cookies = [];
74
foreach
($this->values as $cookie)
75
{
76
$cookies[$cookie->getName()] = $cookie->getValue();
77
}
78
79
return
$cookies;
80
}
81
82
#[\ReturnTypeWillChange]
83
public
function
offsetSet
($offset, $value)
84
{
85
if
(!($value instanceof
Http
\
Cookie
))
86
{
87
throw
new
ArgumentTypeException
(
'value'
,
Http
\Cookie::class);
88
}
89
parent::offsetSet($offset, $value);
90
}
91
}
Bitrix\Main\ArgumentTypeException
Определения
ArgumentTypeException.php:9
Bitrix\Main\Type\Dictionary
Определения
dictionary.php:6
Bitrix\Main\Type\Dictionary\$values
$values
Определения
dictionary.php:10
Bitrix\Main\Web\Cookie
Определения
cookie.php:9
Bitrix\Main\Web\Http\Cookie
Определения
cookie.php:13
Bitrix\Main\Web\HttpCookies
Определения
httpcookies.php:18
Bitrix\Main\Web\HttpCookies\implode
implode()
Определения
httpcookies.php:41
Bitrix\Main\Web\HttpCookies\__construct
__construct(array $values=null)
Определения
httpcookies.php:22
Bitrix\Main\Web\HttpCookies\toArray
toArray()
Определения
httpcookies.php:71
Bitrix\Main\Web\HttpCookies\addFromString
addFromString(string $str)
Определения
httpcookies.php:52
Bitrix\Main\Web\HttpCookies\offsetSet
offsetSet($offset, $value)
Определения
httpcookies.php:83
$str
$str
Определения
commerceml2.php:63
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$name
$name
Определения
menu_edit.php:35
Bitrix\Main\Web\Http
Определения
clientexception.php:3
$key
if(empty($signedUserToken)) $key
Определения
quickway.php:257
bitrix
modules
main
lib
web
httpcookies.php
Создано системой
1.14.0