1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
arrayaccesswithreferences.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Main\Session
;
4
5
use
Bitrix\Main\Diag\Helper
;
6
7
trait
ArrayAccessWithReferences
8
{
10
protected
$sessionData = [];
12
protected
$nullPointers
= [];
14
protected
$strictMode
=
false
;
15
16
public
function
has
(
$name
)
17
{
18
$this->
processLazyStart
();
19
20
return
21
isset($this->sessionData[
$name
]) ||
22
(empty($this->nullPointers[
$name
]) && $this->sessionData && array_key_exists(
$name
, $this->sessionData))
23
;
24
}
25
26
public
function
&
get
(
$name
)
27
{
28
$this->
processLazyStart
();
29
30
if
(!isset($this->sessionData[
$name
]) && !array_key_exists(
$name
, $this->sessionData))
31
{
32
if
($this->strictMode)
33
{
34
$trace = Helper::getBackTrace(1, DEBUG_BACKTRACE_IGNORE_ARGS)[0];
35
trigger_error(
"Notice: Undefined index: {$name} in {$trace['function']} called from {$trace['file']} on line {$trace['line']}.\n"
, E_USER_NOTICE);
36
}
37
$this->nullPointers[
$name
] =
true
;
38
}
39
40
return
$this->sessionData[
$name
];
41
}
42
43
public
function
set
(
$name
, $value)
44
{
45
$this->
processLazyStart
();
46
47
$this->sessionData[
$name
] = $value;
48
unset($this->nullPointers[
$name
]);
49
}
50
51
public
function
remove
(
$name
)
52
{
53
$this->
processLazyStart
();
54
55
unset($this->sessionData[
$name
], $this->nullPointers[
$name
]);
56
}
57
58
public
function
delete
(
$name
)
59
{
60
$this->
remove
(
$name
);
61
}
62
63
public
function
offsetExists
($offset): bool
64
{
65
$this->
processLazyStart
();
66
67
return
isset($this->sessionData[$offset]);
68
}
69
70
#[\ReturnTypeWillChange]
71
public
function
&
offsetGet
($offset)
72
{
73
return
$this->
get
($offset);
74
}
75
76
public
function
offsetSet
($offset, $value): void
77
{
78
if
($offset ===
null
)
79
{
80
$this->
processLazyStart
();
81
82
$this->sessionData[] = $value;
83
}
84
else
85
{
86
$this->
set
($offset, $value);
87
}
88
}
89
90
public
function
offsetUnset
($offset): void
91
{
92
$this->
remove
($offset);
93
}
94
95
public
function
refineReferencesBeforeSave
(): void
96
{
97
foreach
($this->nullPointers as
$key
=> $exists)
98
{
99
if
($exists ===
true
&& $this->sessionData[
$key
] ===
null
)
100
{
101
unset($this->sessionData[
$key
]);
102
}
103
}
104
105
$this->nullPointers = [];
106
}
107
108
protected
function
processLazyStart
()
109
{}
110
}
Bitrix\Main\Diag\Helper
Определения
helper.php:5
$name
$name
Определения
menu_edit.php:35
Bitrix\Main\Session
Определения
arrayaccesswithreferences.php:3
Bitrix\Main\Session\offsetUnset
offsetUnset($offset)
Определения
arrayaccesswithreferences.php:90
Bitrix\Main\Session\offsetExists
offsetExists($offset)
Определения
arrayaccesswithreferences.php:63
Bitrix\Main\Session\$nullPointers
$nullPointers
Определения
arrayaccesswithreferences.php:12
Bitrix\Main\Session\has
has($name)
Определения
arrayaccesswithreferences.php:16
Bitrix\Main\Session\refineReferencesBeforeSave
refineReferencesBeforeSave()
Определения
arrayaccesswithreferences.php:95
Bitrix\Main\Session\offsetGet
& offsetGet($offset)
Определения
arrayaccesswithreferences.php:71
Bitrix\Main\Session\offsetSet
offsetSet($offset, $value)
Определения
arrayaccesswithreferences.php:76
Bitrix\Main\Session\ArrayAccessWithReferences
trait ArrayAccessWithReferences
Определения
arrayaccesswithreferences.php:8
Bitrix\Main\Session\processLazyStart
processLazyStart()
Определения
arrayaccesswithreferences.php:108
Bitrix\Main\Session\$strictMode
$strictMode
Определения
arrayaccesswithreferences.php:14
$key
if(empty($signedUserToken)) $key
Определения
quickway.php:257
bitrix
modules
main
lib
session
arrayaccesswithreferences.php
Создано системой
1.14.0