Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
dictionary.php
1
<?php
2
namespace
Bitrix\Main\Type
;
3
4
class
Dictionary
5
implements
\ArrayAccess, \Iterator, \Countable, \JsonSerializable
6
{
10
protected
$values
= [];
11
17
public
function
__construct
(array
$values
=
null
)
18
{
19
if
(
$values
!==
null
)
20
{
21
$this->values =
$values
;
22
}
23
}
24
31
public
function
get
($name)
32
{
33
// this condition a bit faster
34
// it is possible to omit array_key_exists here, but for uniformity...
35
if
(isset($this->values[$name]) || \array_key_exists($name, $this->values))
36
{
37
return
$this->values[$name];
38
}
39
40
return
null
;
41
}
42
43
public
function
set
($name, $value =
null
)
44
{
45
if
(\is_array($name))
46
{
47
$this->values = $name;
48
}
49
else
50
{
51
$this[$name] = $value;
52
}
53
}
54
58
public
function
getValues
()
59
{
60
return
$this->values
;
61
}
62
66
public
function
setValues
(
$values
)
67
{
68
$this->values =
$values
;
69
}
70
71
public
function
clear
()
72
{
73
$this->values = [];
74
}
75
81
#[\ReturnTypeWillChange]
82
public
function
current
()
83
{
84
return
current
($this->values);
85
}
86
92
public
function
next
(): void
93
{
94
next
($this->values);
95
}
96
102
#[\ReturnTypeWillChange]
103
public
function
key
()
104
{
105
return
key
($this->values);
106
}
107
113
public
function
valid
(): bool
114
{
115
return
($this->
key
() !==
null
);
116
}
117
123
public
function
rewind
(): void
124
{
125
reset($this->values);
126
}
127
133
public
function
offsetExists
($offset): bool
134
{
135
return
isset($this->values[$offset]) || \array_key_exists($offset, $this->values);
136
}
137
143
#[\ReturnTypeWillChange]
144
public
function
offsetGet
($offset)
145
{
146
if
(isset($this->values[$offset]) || \array_key_exists($offset, $this->values))
147
{
148
return
$this->values[$offset];
149
}
150
151
return
null
;
152
}
153
159
#[\ReturnTypeWillChange]
160
public
function
offsetSet
($offset, $value)
161
{
162
if
($offset ===
null
)
163
{
164
$this->values[] = $value;
165
}
166
else
167
{
168
$this->values[$offset] = $value;
169
}
170
}
171
177
public
function
offsetUnset
($offset): void
178
{
179
unset($this->values[$offset]);
180
}
181
187
public
function
count
(): int
188
{
189
return \count($this->values);
190
}
191
197
public
function
toArray
()
198
{
199
return
$this->values
;
200
}
201
206
public
function
isEmpty
()
207
{
208
return
empty($this->values);
209
}
210
215
#[\ReturnTypeWillChange]
216
public
function
jsonSerialize
()
217
{
218
return
$this->values
;
219
}
220
}
Bitrix\Main\Type\Dictionary
Definition
dictionary.php:6
Bitrix\Main\Type\Dictionary\offsetUnset
offsetUnset($offset)
Definition
dictionary.php:177
Bitrix\Main\Type\Dictionary\offsetExists
offsetExists($offset)
Definition
dictionary.php:133
Bitrix\Main\Type\Dictionary\setValues
setValues($values)
Definition
dictionary.php:66
Bitrix\Main\Type\Dictionary\offsetGet
offsetGet($offset)
Definition
dictionary.php:144
Bitrix\Main\Type\Dictionary\__construct
__construct(array $values=null)
Definition
dictionary.php:17
Bitrix\Main\Type\Dictionary\toArray
toArray()
Definition
dictionary.php:197
Bitrix\Main\Type\Dictionary\getValues
getValues()
Definition
dictionary.php:58
Bitrix\Main\Type\Dictionary\key
key()
Definition
dictionary.php:103
Bitrix\Main\Type\Dictionary\clear
clear()
Definition
dictionary.php:71
Bitrix\Main\Type\Dictionary\valid
valid()
Definition
dictionary.php:113
Bitrix\Main\Type\Dictionary\offsetSet
offsetSet($offset, $value)
Definition
dictionary.php:160
Bitrix\Main\Type\Dictionary\count
count()
Definition
dictionary.php:187
Bitrix\Main\Type\Dictionary\next
next()
Definition
dictionary.php:92
Bitrix\Main\Type\Dictionary\jsonSerialize
jsonSerialize()
Definition
dictionary.php:216
Bitrix\Main\Type\Dictionary\rewind
rewind()
Definition
dictionary.php:123
Bitrix\Main\Type\Dictionary\isEmpty
isEmpty()
Definition
dictionary.php:206
Bitrix\Main\Type\Dictionary\current
current()
Definition
dictionary.php:82
Bitrix\Main\Type\Dictionary\$values
$values
Definition
dictionary.php:10
Bitrix\Main\Type
Definition
collection.php:2
modules
main
lib
type
dictionary.php
Создано системой
1.10.0