1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
counterservice.php
См. документацию.
1<?php
2
3namespace Bitrix\Socialnetwork\Internals\Counter;
4
5use Bitrix\Main;
6use Bitrix\Main\Application;
7use Bitrix\Socialnetwork\Internals\Counter;
8use Bitrix\Socialnetwork\Internals\Counter\Event\Event;
9use Bitrix\Socialnetwork\Internals\Counter\Event\EventCollection;
10
17{
18 private static $instance;
19 private static $isJobOn = false;
20
24 private function __construct()
25 {
26 $this->enableJob();
27 }
28
32 public static function getInstance(): CounterService
33 {
34 if (!self::$instance)
35 {
36 self::$instance = new self();
37 }
38
39 return self::$instance;
40 }
41
46 public static function addEvent(string $type, array $data): void
47 {
48 self::getInstance()->storeEvent($type, $data);
49 }
50
55 private function storeEvent(string $type, array $data = []): void
56 {
57 $event = new Event($type);
58 $event->setData($data);
59
60 $this->getEventCollection()->push($event);
61 }
62
70 public static function proceedEvents(): void
71 {
73 }
74
78 private function enableJob(): void
79 {
80 if (!self::$isJobOn)
81 {
82 $application = Application::getInstance();
83 $application && $application->addBackgroundJob(
84 [ __CLASS__, 'proceedEvents' ],
85 [],
86 Application::JOB_PRIORITY_LOW - 2
87 );
88
89 self::$isJobOn = true;
90 }
91 }
92
96 private function getEventCollection(): EventCollection
97 {
99 }
100}
$type
Определения options.php:106
static addEvent(string $type, array $data)
Определения counterservice.php:46
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$application
Определения bitrix.php:23
$event
Определения prolog_after.php:141