Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
map.php
1
<?php
2
3
namespace
Bitrix\Calendar\Core\Base
;
4
5
use
Bitrix\Main\ArgumentException
;
6
10
abstract
class
Map
extends
Collection
11
{
20
public
function
add
($item, $key =
null
): self
21
{
22
if
($key ===
null
)
23
{
24
throw
new
ArgumentException
(
'you must transfer the key'
);
25
}
26
27
$this->collection[$key] = $item;
28
29
if
($this->generator)
30
{
31
$this->generator->send($item);
32
}
33
34
return
$this;
35
}
36
42
public
function
addItems
(array $items):
Collection
43
{
44
// $this->collection = array_replace($this->collection, $items);
45
46
$this->collection = $this->collection + $items;
47
return
$this;
48
}
49
55
public
function
getItem
($key)
56
{
57
return
$this->collection[$key] ??
null
;
58
}
59
64
public
function
has
($key): bool
65
{
66
return
isset($this->collection[$key]);
67
}
68
75
public
function
updateItem
($item, $key):
Map
76
{
77
$this->collection[$key] = $item;
78
79
return
$this;
80
}
81
86
public
function
getItemsByKeys
(array $keys):
Map
87
{
88
return
new
static
(array_intersect_key($this->collection, array_flip($keys)));
89
}
90
}
Bitrix\Calendar\Core\Base\Collection
Definition
collection.php:10
Bitrix\Calendar\Core\Base\Map
Definition
map.php:11
Bitrix\Calendar\Core\Base\Map\getItemsByKeys
getItemsByKeys(array $keys)
Definition
map.php:86
Bitrix\Calendar\Core\Base\Map\updateItem
updateItem($item, $key)
Definition
map.php:75
Bitrix\Calendar\Core\Base\Map\add
add($item, $key=null)
Definition
map.php:20
Bitrix\Calendar\Core\Base\Map\has
has($key)
Definition
map.php:64
Bitrix\Calendar\Core\Base\Map\addItems
addItems(array $items)
Definition
map.php:42
Bitrix\Calendar\Core\Base\Map\getItem
getItem($key)
Definition
map.php:55
Bitrix\Main\ArgumentException
Definition
exception.php:34
Bitrix\Calendar\Core\Base
Definition
baseexception.php:3
modules
calendar
lib
core
base
map.php
Создано системой
1.10.0