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