Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
usages.php
1
<?php
2
namespace
Bitrix\Bizproc\Workflow\Template\Collection
;
3
4
class
Usages
5
{
6
protected
$list
;
7
8
public
function
__construct
()
9
{
10
$this->list = [];
11
}
12
13
public
function
add
($ownerId, $sourceType, $value)
14
{
15
if
(!isset($this->list[$sourceType]))
16
{
17
$this->list[$sourceType] = [];
18
}
19
$key =
"{$ownerId}#{$value}"
;
20
$this->list[$sourceType][$key] = [$ownerId, $value];
21
return
$this;
22
}
23
24
public
function
addOwnerSources
($ownerId, array $sources)
25
{
26
foreach
($sources as $source)
27
{
28
$this->
add
($ownerId, $source[0], $source[1]);
29
}
30
return
$this;
31
}
32
33
public
function
getBySourceType
($sourceType)
34
{
35
return
isset($this->list[$sourceType]) ? array_values($this->list[$sourceType]) : [];
36
}
37
38
public
function
getValuesBySourceType
($sourceType): array
39
{
40
$result = $this->
getBySourceType
($sourceType);
41
$result = array_column($result, 1);
42
return
array_unique($result);
43
}
44
45
public
function
getByOwner
($ownerId)
46
{
47
$list
= [];
48
foreach
($this->list as $sourceType => $items)
49
{
50
foreach
($items as list($id, $value))
51
{
52
if
($ownerId === $id)
53
{
54
$list
[] = [$sourceType, $value];
55
}
56
}
57
}
58
return
$list
;
59
}
60
61
public
function
getAll
()
62
{
63
return
$this->list
;
64
}
65
}
Bitrix\Bizproc\Workflow\Template\Collection\Usages
Definition
usages.php:5
Bitrix\Bizproc\Workflow\Template\Collection\Usages\__construct
__construct()
Definition
usages.php:8
Bitrix\Bizproc\Workflow\Template\Collection\Usages\getValuesBySourceType
getValuesBySourceType($sourceType)
Definition
usages.php:38
Bitrix\Bizproc\Workflow\Template\Collection\Usages\$list
$list
Definition
usages.php:6
Bitrix\Bizproc\Workflow\Template\Collection\Usages\add
add($ownerId, $sourceType, $value)
Definition
usages.php:13
Bitrix\Bizproc\Workflow\Template\Collection\Usages\addOwnerSources
addOwnerSources($ownerId, array $sources)
Definition
usages.php:24
Bitrix\Bizproc\Workflow\Template\Collection\Usages\getAll
getAll()
Definition
usages.php:61
Bitrix\Bizproc\Workflow\Template\Collection\Usages\getBySourceType
getBySourceType($sourceType)
Definition
usages.php:33
Bitrix\Bizproc\Workflow\Template\Collection\Usages\getByOwner
getByOwner($ownerId)
Definition
usages.php:45
Bitrix\Bizproc\Workflow\Template\Collection
Definition
usages.php:2
modules
bizproc
lib
workflow
template
collection
usages.php
Создано системой
1.10.0