Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
abstractconsentmessagebuilder.php
1<?php
2
4
6{
7 protected $fields = [];
8
15 protected static abstract function filterFields(array $fieldForConsent) : array;
16
23 protected static abstract function checkRequireFields(?array $fields) : bool;
24
25 public function __construct(?array $fields = null)
26 {
27 if(is_array($fields))
28 {
29 $this->setFields($fields);
30 }
31 }
32
39 public function setFields(?array $fieldForConsent): AbstractConsentMessageBuilder
40 {
41 $fields = $this->filterFields($fieldForConsent);
42 if($this->checkRequireFields($fields))
43 {
44 $this->fields = $fields;
45 return $this;
46 }
47 throw new \InvalidArgumentException("");
48 }
49
57 public function set(string $field, $value)
58 {
59 return $this->fields[$field] = $value;
60 }
61
68 public function get(string $field)
69 {
70 return $this->fields[$field];
71 }
72
76 public abstract function buildMessage();
77}