Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
Registry.php
1<?php
2
3namespace Bitrix\Im\V2;
4
8class Registry extends \ArrayObject
9{
10 public function unsetByKeys(array $keys): void
11 {
12 foreach ($keys as $key)
13 {
14 unset($this[$key]);
15 }
16 }
17
22 public function filter(callable $predicate): self
23 {
24 $newCollection = clone $this;
25 $keyToUnset = [];
26
27 foreach ($newCollection as $key => $item)
28 {
29 if (!$predicate($item))
30 {
31 $keyToUnset[] = $key;
32 }
33 }
34
35 foreach ($keyToUnset as $key)
36 {
37 unset($newCollection[$key]);
38 }
39
40 return $newCollection;
41 }
42
46 public function getAny()
47 {
48 foreach ($this as $item)
49 {
50 return $item;
51 }
52
53 return null;
54 }
55}
filter(callable $predicate)
Definition Registry.php:22
unsetByKeys(array $keys)
Definition Registry.php:10