1 | <?php |
||
18 | class Suggest implements BuilderInterface |
||
19 | { |
||
20 | use ParametersTrait; |
||
21 | |||
22 | const TERM = 'term'; |
||
23 | const COMPLETION = 'completion'; |
||
24 | const PHRASE = 'phrase'; |
||
25 | const CONTEXT = 'completion'; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $name; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | private $type; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | private $field; |
||
41 | |||
42 | /** |
||
43 | * @var string |
||
44 | */ |
||
45 | private $text; |
||
46 | |||
47 | /** |
||
48 | * TermSuggest constructor. |
||
49 | * @param string $name |
||
50 | * @param string $field |
||
51 | * @param string $type |
||
52 | * @param string $text |
||
53 | * @param array $parameters |
||
54 | */ |
||
55 | public function __construct($name, $field, $type, $text, $parameters = []) |
||
64 | |||
65 | /** |
||
66 | * Returns element type. |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | public function getType() |
||
74 | |||
75 | /** |
||
76 | * @param string $type |
||
77 | */ |
||
78 | public function setType($type) |
||
82 | |||
83 | /** |
||
84 | * @return string |
||
85 | */ |
||
86 | public function getText() |
||
90 | |||
91 | /** |
||
92 | * @param string $text |
||
93 | */ |
||
94 | public function setText($text) |
||
98 | |||
99 | /** |
||
100 | * @return string |
||
101 | */ |
||
102 | public function getField() |
||
106 | |||
107 | /** |
||
108 | * @param string $field |
||
109 | */ |
||
110 | public function setField($field) |
||
114 | |||
115 | /** |
||
116 | * @param string $name |
||
117 | */ |
||
118 | public function setName($name) |
||
122 | |||
123 | /** |
||
124 | * Returns suggest name |
||
125 | * |
||
126 | * @return string |
||
127 | */ |
||
128 | public function getName() |
||
132 | |||
133 | /** |
||
134 | * Checks if the type is valid |
||
135 | * |
||
136 | * @param string $type |
||
137 | * |
||
138 | * @return bool |
||
139 | * |
||
140 | * @throws InvalidArgumentException |
||
141 | */ |
||
142 | private function validateType($type) |
||
156 | |||
157 | /** |
||
158 | * {@inheritdoc} |
||
159 | */ |
||
160 | public function toArray() |
||
171 | } |
||
172 |