| 1 | <?php |
||
| 7 | class Data |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var null|string |
||
| 11 | */ |
||
| 12 | protected $name; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var null|string |
||
| 16 | */ |
||
| 17 | protected $period; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var array |
||
| 21 | */ |
||
| 22 | protected $values = []; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var null|string |
||
| 26 | */ |
||
| 27 | protected $title; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var null|string |
||
| 31 | */ |
||
| 32 | protected $description; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @var null|string |
||
| 36 | */ |
||
| 37 | protected $id; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @var null|srting |
||
| 41 | */ |
||
| 42 | protected $tag; |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @var array |
||
| 46 | */ |
||
| 47 | protected $data; |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Data constructor. |
||
| 51 | * |
||
| 52 | * @param array $data |
||
| 53 | */ |
||
| 54 | 5 | public function __construct(array $data) |
|
| 55 | { |
||
| 56 | 5 | $this->name = $data['name'] ?? null; |
|
| 57 | 5 | $this->period = $data['period'] ?? null; |
|
| 58 | 5 | $this->title = $data['title'] ?? null; |
|
| 59 | 5 | $this->description = $data['description'] ?? null; |
|
| 60 | 5 | $this->id = $data['id'] ?? null; |
|
| 61 | 5 | $this->tag = $data['tag'] ?? null; |
|
| 62 | |||
| 63 | 5 | $this->setValues($data); |
|
| 64 | 5 | } |
|
| 65 | |||
| 66 | /** |
||
| 67 | * @return null|string |
||
| 68 | */ |
||
| 69 | 1 | public function getName() |
|
| 73 | |||
| 74 | /** |
||
| 75 | * @return null|string |
||
| 76 | */ |
||
| 77 | 1 | public function getPeriod() |
|
| 81 | |||
| 82 | /** |
||
| 83 | * @return \Kerox\Messenger\Model\Data\Value[] |
||
| 84 | */ |
||
| 85 | 1 | public function getValues(): array |
|
| 89 | |||
| 90 | /** |
||
| 91 | * @param array $data |
||
| 92 | * |
||
| 93 | * @return \Kerox\Messenger\Model\Data |
||
| 94 | */ |
||
| 95 | 5 | public function setValues(array $data): Data |
|
| 105 | |||
| 106 | /** |
||
| 107 | * @return null|string |
||
| 108 | */ |
||
| 109 | 1 | public function getTitle(): string |
|
| 113 | |||
| 114 | /** |
||
| 115 | * @return null|string |
||
| 116 | */ |
||
| 117 | 1 | public function getDescription(): string |
|
| 121 | |||
| 122 | /** |
||
| 123 | * @return null|string |
||
| 124 | */ |
||
| 125 | 1 | public function getId(): string |
|
| 129 | |||
| 130 | /** |
||
| 131 | * @return null|string |
||
| 132 | */ |
||
| 133 | 1 | public function getTag(): string |
|
| 137 | |||
| 138 | /** |
||
| 139 | * @param array $data |
||
| 140 | * |
||
| 141 | * @return \Kerox\Messenger\Model\Data |
||
| 142 | */ |
||
| 143 | 4 | public static function create(array $data): Data |
|
| 147 | } |
||
| 148 |