Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
event.php
1<?php
2
4
6
13final class Event
14{
15 public const FACEBOOK_CONVERSION_SHOP_EVENT_ENABLED = 'FACEBOOK_CONVERSION_SHOP_EVENT_ENABLED';
16 public const FACEBOOK_CONVERSION_SHOP_EVENT_DISABLED = 'FACEBOOK_CONVERSION_SHOP_EVENT_DISABLED';
17 public const FACEBOOK_CONVERSION_EVENT_FIRED = 'FACEBOOK_CONVERSION_EVENT_FIRED';
18
20 private $name;
21
23 private $payload = [];
24
28 public function __construct(string $name, array $payload)
29 {
30 if (!in_array($name, self::getAvailableNames(), true))
31 {
32 throw new Main\ArgumentException(
33 'Name not available, see \Bitrix\Sale\Internals\Analytics\Events\Event::getAvailableNames',
34 'name'
35 );
36 }
37
38 $this->name = $name;
39 $this->payload = $payload;
40 }
41
45 public function getName(): string
46 {
47 return $this->name;
48 }
49
53 public function getPayload(): array
54 {
55 return $this->payload;
56 }
57
61 private static function getAvailableNames(): array
62 {
63 return [
64 self::FACEBOOK_CONVERSION_SHOP_EVENT_ENABLED,
65 self::FACEBOOK_CONVERSION_SHOP_EVENT_DISABLED,
66 self::FACEBOOK_CONVERSION_EVENT_FIRED,
67 ];
68 }
69}
__construct(string $name, array $payload)
Definition event.php:28