Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
eventcollection.php
1<?php
2
11
13{
14 private array $ids = [];
15 private array $registry = [];
16
17 private static $instance;
18
22 private function __construct()
23 {
24
25 }
26
30 public static function getInstance(): self
31 {
32 if (!self::$instance)
33 {
34 self::$instance = new self();
35 }
36
37 return self::$instance;
38 }
39
43 public function list(): array
44 {
45 return $this->registry;
46 }
47
51 public function push(Event $event): void
52 {
53 $this->registry[$event->getHash()] = $event;
54 $this->ids[] = $event->getId();
55 }
56
60 public function getEventsId(): array
61 {
62 return $this->ids;
63 }
64
65 public function isEmpty(): bool
66 {
67 return empty($this->registry);
68 }
69
70 public function isDuplicate(Event $event): bool
71 {
72 return (isset($this->registry[$event->getHash()]));
73 }
74}