1 | <?php |
||
19 | class SearchKeywordFormatter extends BaseObject |
||
20 | { |
||
21 | /** |
||
22 | * Wildcard definition |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | public $wildCard = '*'; |
||
27 | |||
28 | /** |
||
29 | * Maximum search term count to output |
||
30 | * |
||
31 | * @var int |
||
32 | */ |
||
33 | public $maxTerms = 5; |
||
34 | |||
35 | /** |
||
36 | * Search terms map |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | private $terms = []; |
||
41 | |||
42 | /** |
||
43 | * Search keyword input |
||
44 | * |
||
45 | * @var null |
||
46 | */ |
||
47 | private $searchKeyword = null; |
||
48 | |||
49 | /** |
||
50 | * Wildcarded term template, leave this empty if you don't want to apply wildcards |
||
51 | * |
||
52 | * @var string |
||
53 | */ |
||
54 | public $wildCardedTermTemplate = '{term}{wildcard}'; |
||
55 | |||
56 | /** |
||
57 | * @param array $searchKeyword |
||
58 | * @param array $config |
||
59 | */ |
||
60 | public function __construct($searchKeyword, $config = []) |
||
66 | |||
67 | private function format() |
||
78 | |||
79 | /** |
||
80 | * Removes special characters from search keyword |
||
81 | * If two quotes are provided, those are not removed to support exact match searching |
||
82 | */ |
||
83 | private function removeSpecialCharacters() |
||
94 | |||
95 | /** |
||
96 | * Removes duplicated and empty terms |
||
97 | */ |
||
98 | private function filterUniqueKeywords() |
||
105 | |||
106 | /** |
||
107 | * Applies wildcard(s) to search term based on wildCardedTermTemplate |
||
108 | */ |
||
109 | private function setTermWildCards() |
||
127 | |||
128 | /** |
||
129 | * Removes shortest search terms from terms map |
||
130 | * |
||
131 | * @param $maxCount |
||
132 | */ |
||
133 | private function removeShortestTerms($maxCount) |
||
154 | |||
155 | /** |
||
156 | * Returns formatted terms |
||
157 | * @return array |
||
158 | */ |
||
159 | public function getTerms() |
||
163 | } |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..