Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
resultlimit.php
1<?php
2namespace Bitrix\Main\Search;
3
4final class ResultLimit implements \JsonSerializable
5{
7 private $type;
8
10 private $title;
11
13 private $description;
14
16 private $buttons = [];
17
18 public function __construct($type, $title, $description = null)
19 {
20 $this
21 ->setType($type)
22 ->setTitle($title)
23 ->setDescription($description)
24 ;
25 }
26
32 public function getType()
33 {
34 return $this->type;
35 }
36
43 public function setType($type)
44 {
45 $this->type = $type;
46
47 return $this;
48 }
49
55 public function getTitle()
56 {
57 return $this->title;
58 }
59
67 public function setTitle($title)
68 {
69 if (is_string($title))
70 {
71 $this->title = $title;
72 }
73
74 return $this;
75 }
76
82 public function getDescription()
83 {
84 return $this->description;
85 }
86
94 public function setDescription($description)
95 {
96 if (is_string($description))
97 {
98 $this->description = $description;
99 }
100
101 return $this;
102 }
103
109 public function getButtons()
110 {
111 return $this->buttons;
112 }
113
121 public function setButtons($buttons)
122 {
123 if (is_array($buttons))
124 {
125 foreach ($buttons as $button)
126 {
127 if (is_string($button))
128 {
129 $this->buttons[] = $button;
130 }
131 }
132 }
133
134 return $this;
135 }
136
144 public function jsonSerialize(): array
145 {
146 return [
147 "type" => $this->getType(),
148 "title" => $this->getTitle(),
149 "description" => $this->getDescription(),
150 "buttons" => $this->getButtons(),
151 ];
152 }
153}
__construct($type, $title, $description=null)