1 | <?php |
||
5 | class SearchState |
||
6 | { |
||
7 | /** |
||
8 | * @var array |
||
9 | */ |
||
10 | protected $parsedQuery = []; |
||
11 | |||
12 | /** |
||
13 | * SearchState constructor. |
||
14 | * |
||
15 | * @param array $parsedQuery |
||
16 | */ |
||
17 | public function __construct(array $parsedQuery) |
||
32 | |||
33 | /** |
||
34 | * Get a search state for the current search limited to a new namespace |
||
35 | * |
||
36 | * @param string $ns the namespace to which to limit the search, falsy to remove the limitation |
||
37 | * @param array $notns |
||
38 | * |
||
39 | * @return SearchState |
||
40 | */ |
||
41 | public function withNamespace($ns, array $notns = []) |
||
49 | |||
50 | /** |
||
51 | * Get a search state for the current search with new search fragments and optionally phrases |
||
52 | * |
||
53 | * @param array $and |
||
54 | * @param array $not |
||
55 | * @param array $phrases |
||
56 | * |
||
57 | * @return SearchState |
||
58 | */ |
||
59 | public function withFragments(array $and, array $not, array $phrases = []) |
||
68 | |||
69 | /** |
||
70 | * Get a search state for the current search with with adjusted time limitations |
||
71 | * |
||
72 | * @param $after |
||
73 | * @param $before |
||
74 | * |
||
75 | * @return SearchState |
||
76 | */ |
||
77 | public function withTimeLimitations($after, $before) |
||
85 | |||
86 | /** |
||
87 | * Get a search state for the current search with adjusted sort preference |
||
88 | * |
||
89 | * @param $sort |
||
90 | * |
||
91 | * @return SearchState |
||
92 | */ |
||
93 | public function withSorting($sort) |
||
100 | |||
101 | /** |
||
102 | * Get a link that represents the current search state |
||
103 | * |
||
104 | * Note that this represents only a simplified version of the search state. |
||
105 | * Grouping with braces and "OR" conditions are not supported. |
||
106 | * |
||
107 | * @param $label |
||
108 | * |
||
109 | * @return string |
||
110 | */ |
||
111 | public function getSearchLink($label) |
||
141 | } |
||
142 |