Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
collectionbase.php
1
<?php
2
3
namespace
Bitrix\Sale\Internals
;
4
5
use
Bitrix\Main\Localization\Loc
;
6
7
Loc::loadMessages
(__FILE__);
8
13
abstract
class
CollectionBase
14
implements
\ArrayAccess, \Countable, \IteratorAggregate
15
{
17
protected
$collection
= array();
18
22
public
function
getIterator
(): \Traversable
23
{
24
return
new \ArrayIterator($this->collection);
25
}
26
27
31
public
function
offsetExists
($offset): bool
32
{
33
return
isset($this->collection[$offset]) || array_key_exists($offset, $this->collection);
34
}
35
39
#[\ReturnTypeWillChange]
40
public
function
offsetGet
($offset)
41
{
42
if
(isset($this->collection[$offset]) || array_key_exists($offset, $this->collection))
43
{
44
return
$this->collection[$offset];
45
}
46
47
return
null
;
48
}
49
53
public
function
offsetSet
($offset, $value): void
54
{
55
if
($offset ===
null
)
56
{
57
$this->collection[] = $value;
58
}
59
else
60
{
61
$this->collection[$offset] = $value;
62
}
63
}
64
68
public
function
offsetUnset
($offset): void
69
{
70
unset($this->collection[$offset]);
71
}
72
76
public
function
count
(): int
77
{
78
return
count
($this->collection);
79
}
80
84
public
function
current
()
85
{
86
return
current
($this->collection);
87
}
88
92
public
function
next
()
93
{
94
return
next
($this->collection);
95
}
96
100
public
function
key
()
101
{
102
return
key
($this->collection);
103
}
104
108
public
function
valid
()
109
{
110
$key = $this->
key
();
111
return
$key !==
null
;
112
}
113
117
public
function
rewind
()
118
{
119
return
reset($this->collection);
120
}
121
127
public
function
isEmpty
()
128
{
129
return
empty($this->collection);
130
}
131
132
public
function
toArray
()
133
{
134
$result = [];
135
136
foreach
($this->collection as $entity)
137
{
138
$result[] = $entity->toArray();
139
}
140
141
return
$result;
142
}
143
}
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Sale\Internals\CollectionBase
Definition
collectionbase.php:15
Bitrix\Sale\Internals\CollectionBase\offsetUnset
offsetUnset($offset)
Definition
collectionbase.php:68
Bitrix\Sale\Internals\CollectionBase\offsetExists
offsetExists($offset)
Definition
collectionbase.php:31
Bitrix\Sale\Internals\CollectionBase\$collection
$collection
Definition
collectionbase.php:17
Bitrix\Sale\Internals\CollectionBase\offsetGet
offsetGet($offset)
Definition
collectionbase.php:40
Bitrix\Sale\Internals\CollectionBase\toArray
toArray()
Definition
collectionbase.php:132
Bitrix\Sale\Internals\CollectionBase\key
key()
Definition
collectionbase.php:100
Bitrix\Sale\Internals\CollectionBase\getIterator
getIterator()
Definition
collectionbase.php:22
Bitrix\Sale\Internals\CollectionBase\valid
valid()
Definition
collectionbase.php:108
Bitrix\Sale\Internals\CollectionBase\offsetSet
offsetSet($offset, $value)
Definition
collectionbase.php:53
Bitrix\Sale\Internals\CollectionBase\count
count()
Definition
collectionbase.php:76
Bitrix\Sale\Internals\CollectionBase\next
next()
Definition
collectionbase.php:92
Bitrix\Sale\Internals\CollectionBase\rewind
rewind()
Definition
collectionbase.php:117
Bitrix\Sale\Internals\CollectionBase\isEmpty
isEmpty()
Definition
collectionbase.php:127
Bitrix\Sale\Internals\CollectionBase\current
current()
Definition
collectionbase.php:84
Bitrix\Sale\Internals
Definition
accountnumber.php:3
modules
sale
lib
internals
collectionbase.php
Создано системой
1.10.0