1 | <?php declare(strict_types=1); |
||
10 | class Search extends BaseRequest |
||
11 | { |
||
12 | const METHOD = 'GET'; |
||
13 | const ENDPOINT = '/search/tweets.json'; |
||
14 | |||
15 | private $resultTypes = ['mixed', 'recent', 'popular']; |
||
16 | |||
17 | 19 | public function __construct(string $searchString) |
|
23 | |||
24 | //use string instead of float |
||
25 | 2 | public function geocode(string $latitude, string $longitude, string $radius): Search |
|
26 | { |
||
27 | 2 | $this->parameters['geocode'] = sprintf('%s %s %s', $latitude, $longitude, $radius); |
|
28 | |||
29 | 2 | return $this; |
|
30 | } |
||
31 | |||
32 | 2 | public function language(string $language = 'en'): Search |
|
33 | { |
||
34 | 2 | $this->parameters['lang'] = $language; |
|
35 | |||
36 | 2 | return $this; |
|
37 | } |
||
38 | |||
39 | 2 | public function locale(): Search |
|
40 | { |
||
41 | 2 | $this->parameters['locale'] = 'ja'; |
|
42 | |||
43 | 2 | return $this; |
|
44 | } |
||
45 | |||
46 | 2 | public function resultType(string $resultType): Search |
|
47 | { |
||
48 | 2 | if (in_array($resultType, $this->resultTypes)) { |
|
49 | 2 | $this->parameters['result_type'] = $resultType; |
|
50 | } |
||
51 | |||
52 | 2 | return $this; |
|
53 | } |
||
54 | |||
55 | 2 | public function amount(int $amount): Search |
|
61 | |||
62 | 2 | public function until(\DateTime $until): Search |
|
68 | |||
69 | 2 | public function minimumId(int $id): Search |
|
75 | |||
76 | 2 | public function maximumId(int $id): Search |
|
82 | |||
83 | 2 | public function excludeEntities(): Search |
|
89 | } |
||
90 |