Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
collection.php
1
<?php
2
namespace
Bitrix\Sale\Exchange\Integration\Service\Internal\Container
;
3
4
use Traversable;
5
6
class
Collection
7
implements
\IteratorAggregate
8
{
9
protected
$collection
= [];
10
static
$internalIndex
= 0;
11
12
public
function
addItem
(
Item
$item)
13
{
14
$index = $item->
getInternalIndex
() ==
''
?
'n'
.static::$internalIndex++ : $item->
getInternalIndex
();
15
16
$this->collection[$index] = $item;
17
}
18
19
public
function
count
()
20
{
21
return
count
($this->collection);
22
}
23
24
public
function
toArray()
25
{
26
$result = [];
27
if
(
count
($this->collection)>0)
28
{
32
foreach
($this->collection as $index=>$item)
33
{
34
$result[$index] = $item->getEntity()->getFieldsValues();
35
}
36
}
37
return
$result;
38
}
39
40
public
function
getIndexes
()
41
{
42
return
count
($this->collection)>0 ? array_keys($this->collection):[];
43
}
44
49
public
function
getItemByIndex
($index)
50
{
51
$result =
null
;
52
if
(
count
($this->collection)>0)
53
{
54
foreach
($this->collection as $k=>$item)
55
{
56
if
($index == $k)
57
{
58
$result = $item;
59
break
;
60
}
61
}
62
}
63
return
$result;
64
}
65
73
public
function
getIterator
()
74
{
75
return
new \ArrayIterator($this->collection);
76
}
77
}
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Collection
Definition
collection.php:8
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Collection\getIndexes
getIndexes()
Definition
collection.php:40
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Collection\getIterator
getIterator()
Definition
collection.php:73
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Collection\getItemByIndex
getItemByIndex($index)
Definition
collection.php:49
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Collection\$internalIndex
static $internalIndex
Definition
collection.php:10
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Collection\addItem
addItem(Item $item)
Definition
collection.php:12
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Collection\$collection
$collection
Definition
collection.php:9
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Collection\count
count()
Definition
collection.php:19
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Item
Definition
item.php:8
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Item\getInternalIndex
getInternalIndex()
Definition
item.php:31
Bitrix\Sale\Exchange\Integration\Service\Internal\Container
Definition
collection.php:2
modules
sale
lib
exchange
integration
service
internal
container
collection.php
Создано системой
1.10.0