1 | <?php |
||
7 | class QueryContent { |
||
8 | |||
9 | |||
10 | const OPTION_MUST = 1; |
||
11 | const OPTION_MUST_NOT = 2; |
||
12 | |||
13 | |||
14 | /** @var string */ |
||
15 | private $word; |
||
16 | |||
17 | /** @var string */ |
||
18 | private $should; |
||
19 | |||
20 | /** @var string */ |
||
21 | private $match; |
||
22 | |||
23 | /** @var int */ |
||
24 | private $option; |
||
25 | |||
26 | |||
27 | /** @var array */ |
||
28 | private $options = [ |
||
29 | '+' => [self::OPTION_MUST, 'must', 'prefix'], |
||
30 | '-' => [self::OPTION_MUST_NOT, 'must_not', 'prefix'] |
||
31 | ]; |
||
32 | |||
33 | |||
34 | /** |
||
35 | * SearchQueryContent constructor. |
||
36 | * |
||
37 | * @param string $word |
||
38 | */ |
||
39 | function __construct($word) { |
||
44 | |||
45 | |||
46 | private function init() { |
||
68 | |||
69 | |||
70 | /** |
||
71 | * @return string |
||
72 | */ |
||
73 | public function getWord() { |
||
76 | |||
77 | /** |
||
78 | * @param string $word |
||
79 | */ |
||
80 | public function setWord($word) { |
||
83 | |||
84 | |||
85 | /** |
||
86 | * @return string |
||
87 | */ |
||
88 | public function getShould() { |
||
91 | |||
92 | /** |
||
93 | * @param string $should |
||
94 | * |
||
95 | * @return QueryContent |
||
96 | */ |
||
97 | public function setShould($should) { |
||
102 | |||
103 | |||
104 | /** |
||
105 | * @return string |
||
106 | */ |
||
107 | public function getMatch() { |
||
110 | |||
111 | /** |
||
112 | * @param string $match |
||
113 | * |
||
114 | * @return QueryContent |
||
115 | */ |
||
116 | public function setMatch($match) { |
||
121 | |||
122 | |||
123 | /** |
||
124 | * @return int |
||
125 | */ |
||
126 | public function getOption() { |
||
129 | |||
130 | /** |
||
131 | * @param int $option |
||
132 | * |
||
133 | * @return QueryContent |
||
134 | */ |
||
135 | public function setOption($option) { |
||
140 | |||
141 | |||
142 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.