10 private const SEPARATOR =
'u1F9D1';
17 private $inputPlaceholderText;
40 $this->setUid($options[
'id']);
41 $this->setCategory($options[
'category']);
42 $this->setTitle($options[
'title']);
43 $this->setText($options[
'text']);
44 $this->setIcon($options[
'icon']);
45 $this->setInputPlaceholderText($options[
'inputPlaceholderText']);
46 $this->setButton1Text($options[
'button1Text']);
47 $this->setButton2Text($options[
'button2Text']);
50 private function setUid($id): void
55 throw new ArgumentException(
'NotificationManager: Cannot create a notification without an ID');
58 $this->uid = $id . self::SEPARATOR . self::getUuidV4();
61 private function setCategory($category): void
63 $this->category = (string)$category;
66 private function setTitle($title): void
68 $this->title = (string)$title;
71 private function setText($text): void
73 $this->text = (string)$text;
76 private function setIcon($icon): void
78 $this->icon = (string)$icon;
81 private function setInputPlaceholderText($inputPlaceholderText): void
83 $this->inputPlaceholderText = (string)$inputPlaceholderText;
86 private function setButton1Text($button1Text): void
88 $this->button1Text = (string)$button1Text;
91 private function setButton2Text($button2Text): void
93 $this->button2Text = (string)$button2Text;
100 'category' => $this->category,
101 'title' => $this->title,
102 'text' => $this->text,
103 'icon' => $this->icon,
104 'inputPlaceholderText' => $this->inputPlaceholderText,
105 'button1Text' => $this->button1Text,
106 'button2Text' => $this->button2Text,
110 private static function getUuidV4(): string
112 return sprintf(
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
113 random_int(0, 0xffff),
114 random_int(0, 0xffff),
115 random_int(0, 0xffff),
116 random_int(0, 0x0fff) | 0x4000,
117 random_int(0, 0x3fff) | 0x8000,
118 random_int(0, 0xffff),
119 random_int(0, 0xffff),
120 random_int(0, 0xffff)