18 private static $instance;
19 private static $isJobOn =
false;
24 private function __construct()
36 self::$instance =
new self();
39 return self::$instance;
46 public static function addEvent(
string $type, array $data): void
55 private function storeEvent(
string $type, array $data = []): void
57 $event =
new Event($type);
58 $event->setData($data);
60 $this->getEventCollection()->push($event);
78 private function enableJob(): void
83 $application && $application->addBackgroundJob(
84 [ __CLASS__,
'proceedEvents' ],
89 self::$isJobOn =
true;
96 private function getEventCollection(): EventCollection