Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
config.php
1
<?php
2
3
namespace
Bitrix\Location\Entity\Source
;
4
10
final
class
Config
implements
\IteratorAggregate
11
{
13
private
$items = [];
14
19
public
function
addItem
(
ConfigItem
$item)
20
{
21
$this->items[] = $item;
22
23
return
$this;
24
}
25
30
public
function
getItem
(
string
$code): ?
ConfigItem
31
{
32
foreach
($this->items as $item)
33
{
34
if
($item->getCode() !== $code)
35
{
36
continue
;
37
}
38
39
return
$item;
40
}
41
42
return
null
;
43
}
44
49
public
function
getValue
(
string
$code)
50
{
51
$item = $this->
getItem
($code);
52
if
(!$item)
53
{
54
return
null
;
55
}
56
57
return
$item->getValue();
58
}
59
65
public
function
setValue
(
string
$code, $value): bool
66
{
67
foreach
($this->items as $item)
68
{
69
if
($item->getCode() !== $code)
70
{
71
continue
;
72
}
73
74
$item->setValue($value);
75
76
return
true
;
77
}
78
79
return
false
;
80
}
81
85
public
function
getIterator
(): \Traversable
86
{
87
usort(
88
$this->items,
89
function
(
ConfigItem
$item1,
ConfigItem
$item2)
90
{
91
if
($item1->
getSort
() == $item2->
getSort
())
92
{
93
return 0;
94
}
95
96
return ($item1->
getSort
() < $item2->
getSort
()) ? -1 : 1;
97
}
98
);
99
100
return
new \ArrayIterator($this->items);
101
}
102
}
Bitrix\Location\Entity\Source\Config\setValue
setValue(string $code, $value)
Definition
config.php:65
Bitrix\Location\Entity\Source\Config\getItem
getItem(string $code)
Definition
config.php:30
Bitrix\Location\Entity\Source\Config\addItem
addItem(ConfigItem $item)
Definition
config.php:19
Bitrix\Location\Entity\Source\Config\getIterator
getIterator()
Definition
config.php:85
Bitrix\Location\Entity\Source\Config\getValue
getValue(string $code)
Definition
config.php:49
Bitrix\Location\Entity\Source\ConfigItem
Definition
configitem.php:13
Bitrix\Location\Entity\Source\ConfigItem\getSort
getSort()
Definition
configitem.php:67
Bitrix\Location\Entity\Source
Definition
config.php:3
Bitrix\Main\Config
Definition
configuration.php:2
modules
location
lib
entity
source
config.php
Создано системой
1.10.0