Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
collection.php
1
<?php
2
3
namespace
Bitrix\Location\Entity\Generic
;
4
10
class
Collection
11
implements
\ArrayAccess, \Countable, \Iterator
12
{
13
protected
$items
= [];
14
18
public
function
__construct
(array
$items
= [])
19
{
20
$this->
setItems
(
$items
);
21
}
22
26
public
function
setItems
(array
$items
): void
27
{
28
foreach
(
$items
as $item)
29
{
30
$this->
addItem
($item);
31
}
32
}
33
37
public
function
getItems
(): array
38
{
39
return
$this->items
;
40
}
41
46
public
function
offsetSet
($offset, $value): void
47
{
48
if
($offset ===
null
)
49
{
50
$this->items[] = $value;
51
}
52
else
53
{
54
$this->items[$offset] = $value;
55
}
56
}
57
62
public
function
offsetExists
($offset): bool
63
{
64
return
isset($this->items[$offset]);
65
}
66
70
public
function
offsetUnset
($offset): void
71
{
72
unset($this->items[$offset]);
73
}
74
79
#[\ReturnTypeWillChange]
80
public
function
offsetGet
($offset)
81
{
82
return
isset($this->items[$offset]) ? $this->items[$offset] :
null
;
83
}
84
88
public
function
count
(): int
89
{
90
return
count
($this->items);
91
}
92
93
public
function
rewind
(): void
94
{
95
reset($this->items);
96
}
97
101
#[\ReturnTypeWillChange]
102
public
function
current
()
103
{
104
return
current
($this->items);
105
}
106
110
#[\ReturnTypeWillChange]
111
public
function
key
()
112
{
113
return
key
($this->items);
114
}
115
116
public
function
next
(): void
117
{
118
next
($this->items);
119
}
120
124
public
function
valid
(): bool
125
{
126
return
$this->
current
() !==
false
&& isset($this->items[$this->
key
()]);
127
}
128
129
public
function
clear
()
130
{
131
$this->items = [];
132
}
133
138
public
function
addItem
($item): int
139
{
140
$this->items[] = $item;
141
end($this->items);
142
return
key
($this->items);
143
}
144
}
Bitrix\Location\Entity\Generic\Collection
Definition
collection.php:12
Bitrix\Location\Entity\Generic\Collection\offsetUnset
offsetUnset($offset)
Definition
collection.php:70
Bitrix\Location\Entity\Generic\Collection\offsetExists
offsetExists($offset)
Definition
collection.php:62
Bitrix\Location\Entity\Generic\Collection\setItems
setItems(array $items)
Definition
collection.php:26
Bitrix\Location\Entity\Generic\Collection\__construct
__construct(array $items=[])
Definition
collection.php:18
Bitrix\Location\Entity\Generic\Collection\offsetGet
offsetGet($offset)
Definition
collection.php:80
Bitrix\Location\Entity\Generic\Collection\key
key()
Definition
collection.php:111
Bitrix\Location\Entity\Generic\Collection\$items
$items
Definition
collection.php:13
Bitrix\Location\Entity\Generic\Collection\addItem
addItem($item)
Definition
collection.php:138
Bitrix\Location\Entity\Generic\Collection\clear
clear()
Definition
collection.php:129
Bitrix\Location\Entity\Generic\Collection\getItems
getItems()
Definition
collection.php:37
Bitrix\Location\Entity\Generic\Collection\valid
valid()
Definition
collection.php:124
Bitrix\Location\Entity\Generic\Collection\offsetSet
offsetSet($offset, $value)
Definition
collection.php:46
Bitrix\Location\Entity\Generic\Collection\count
count()
Definition
collection.php:88
Bitrix\Location\Entity\Generic\Collection\next
next()
Definition
collection.php:116
Bitrix\Location\Entity\Generic\Collection\rewind
rewind()
Definition
collection.php:93
Bitrix\Location\Entity\Generic\Collection\current
current()
Definition
collection.php:102
Bitrix\Location\Entity\Generic
Definition
collection.php:3
modules
location
lib
entity
generic
collection.php
Создано системой
1.10.0