1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
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
Определения
collection.php:8
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Collection\getIndexes
getIndexes()
Определения
collection.php:40
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Collection\getIterator
getIterator()
Определения
collection.php:73
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Collection\getItemByIndex
getItemByIndex($index)
Определения
collection.php:49
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Collection\$internalIndex
static $internalIndex
Определения
collection.php:10
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Collection\addItem
addItem(Item $item)
Определения
collection.php:12
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Collection\$collection
$collection
Определения
collection.php:9
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Collection\count
count()
Определения
collection.php:19
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Item
Определения
item.php:8
Bitrix\Sale\Exchange\Integration\Service\Internal\Container\Item\getInternalIndex
getInternalIndex()
Определения
item.php:31
$result
$result
Определения
get_property_values.php:14
Bitrix\Sale\Exchange\Integration\Service\Internal\Container
Определения
collection.php:2
$k
$k
Определения
template_pdf.php:567
bitrix
modules
sale
lib
exchange
integration
service
internal
container
collection.php
Создано системой
1.14.0