1 | <?php declare(strict_types=1); |
||
11 | class SearchFilter |
||
12 | { |
||
13 | public const SEARCH_SOURCE_WEB = ''; |
||
14 | public const SEARCH_SOURCE_NEWS = 'news'; |
||
15 | public const SEARCH_SOURCE_IMAGES = 'images'; |
||
16 | public const SEARCH_SOURCE_YOUTUBE = 'youtube'; |
||
17 | public const SEARCH_SOURCE_GOOGLE_SHOPPING = 'froogle'; |
||
18 | |||
19 | private const DEFAULT_LANG = 'en-US'; |
||
20 | private const DEFAULT_COUNTRY = 'US'; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $token; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $location; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | * @deprecated Will be removed, cause other languages do not work as filter. We should utilize only location |
||
35 | */ |
||
36 | private $language; |
||
37 | |||
38 | /** |
||
39 | * @var int |
||
40 | */ |
||
41 | private $category; |
||
42 | |||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | private $searchTerm; |
||
47 | |||
48 | /** |
||
49 | * @var string[] |
||
50 | */ |
||
51 | private $metrics; |
||
52 | |||
53 | /** |
||
54 | * @var string |
||
55 | */ |
||
56 | private $time; |
||
57 | |||
58 | /** |
||
59 | * @var string |
||
60 | */ |
||
61 | private $compareTime; |
||
62 | |||
63 | /** |
||
64 | * @var string |
||
65 | */ |
||
66 | private $searchType; |
||
67 | |||
68 | /** |
||
69 | * @var DateTimeImmutable |
||
70 | */ |
||
71 | private $currentDate; |
||
72 | |||
73 | 41 | public function __construct(DateTimeImmutable $currentDate = null) |
|
85 | |||
86 | 15 | public function withToken(string $token): self |
|
92 | |||
93 | /** |
||
94 | * @param DateTimeImmutable $from |
||
95 | * @param DateTimeImmutable $to |
||
96 | * |
||
97 | * @return $this |
||
98 | * |
||
99 | * @throws GoogleTrendsException |
||
100 | */ |
||
101 | 41 | public function withinInterval(DateTimeImmutable $from, DateTimeImmutable $to): self |
|
128 | |||
129 | 2 | public function considerImageSearch(): self |
|
135 | |||
136 | 2 | public function considerGoogleShoppingSearch(): self |
|
142 | |||
143 | 3 | public function considerYoutubeSearch(): self |
|
149 | |||
150 | 2 | public function considerNewsSearch(): self |
|
156 | |||
157 | 41 | public function considerWebSearch(): self |
|
163 | |||
164 | 10 | public function withRisingMetrics(): self |
|
170 | |||
171 | 10 | public function withTopMetrics(): self |
|
177 | |||
178 | /** |
||
179 | * @deprecated Will be removed, cause other languages do not work as filter. We should utilize only location |
||
180 | */ |
||
181 | 41 | public function withLanguage(string $language): self |
|
187 | |||
188 | 9 | public function withCategory(int $category): self |
|
194 | |||
195 | 41 | public function withLocation(string $location): self |
|
201 | |||
202 | 26 | public function withSearchTerm(string $searchTerm): self |
|
208 | |||
209 | 15 | public function getToken(): string |
|
213 | |||
214 | 19 | public function getLocation(): string |
|
218 | |||
219 | /** |
||
220 | * @deprecated Will be removed, cause other languages do not work as filter. We should utilize only location |
||
221 | */ |
||
222 | 19 | public function getLanguage(): string |
|
226 | |||
227 | 19 | public function getCategory(): int |
|
231 | |||
232 | 19 | public function getSearchTerm(): string |
|
236 | |||
237 | 23 | public function getSearchType(): string |
|
241 | |||
242 | 18 | public function getTime(): string |
|
246 | |||
247 | 11 | public function getCompareTime(): string |
|
251 | |||
252 | 3 | public function getMetrics(): array |
|
256 | |||
257 | 7 | public function isConsideringTopMetrics(): bool |
|
261 | |||
262 | 9 | public function isConsideringRisingMetrics(): bool |
|
266 | } |
||
267 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.