1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* (c) Christian Gripp <[email protected]> |
5
|
|
|
* |
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
7
|
|
|
* file that was distributed with this source code. |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace Core23\SetlistFm\Builder; |
11
|
|
|
|
12
|
|
|
final class VenueSearchBuilder |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* @var array |
16
|
|
|
*/ |
17
|
|
|
private $query; |
18
|
|
|
|
19
|
|
|
private function __construct() |
20
|
|
|
{ |
21
|
|
|
$this->query = []; |
22
|
|
|
|
23
|
|
|
$this->page(1); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @param int $page |
28
|
|
|
* |
29
|
|
|
* @return VenueSearchBuilder |
30
|
|
|
*/ |
31
|
|
|
public function page(int $page): self |
32
|
|
|
{ |
33
|
|
|
$this->query['p'] = $page; |
34
|
|
|
|
35
|
|
|
return $this; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @param string $name |
40
|
|
|
* |
41
|
|
|
* @return VenueSearchBuilder |
42
|
|
|
*/ |
43
|
|
|
public function withName(string $name): self |
44
|
|
|
{ |
45
|
|
|
$this->query['name'] = $name; |
46
|
|
|
|
47
|
|
|
return $this; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @param string $name |
52
|
|
|
* |
53
|
|
|
* @return VenueSearchBuilder |
54
|
|
|
*/ |
55
|
|
|
public function withCity(string $name): self |
56
|
|
|
{ |
57
|
|
|
$this->query['cityName'] = $name; |
58
|
|
|
|
59
|
|
|
return $this; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @param int $id |
64
|
|
|
* |
65
|
|
|
* @return VenueSearchBuilder |
66
|
|
|
*/ |
67
|
|
|
public function withCityId(int $id): self |
68
|
|
|
{ |
69
|
|
|
$this->query['cityId'] = $id; |
70
|
|
|
|
71
|
|
|
return $this; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @param string $country |
76
|
|
|
* |
77
|
|
|
* @return VenueSearchBuilder |
78
|
|
|
*/ |
79
|
|
|
public function withCountry(string $country): self |
80
|
|
|
{ |
81
|
|
|
$this->query['country'] = $country; |
82
|
|
|
|
83
|
|
|
return $this; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @param string $name |
88
|
|
|
* |
89
|
|
|
* @return VenueSearchBuilder |
90
|
|
|
*/ |
91
|
|
|
public function withState(string $name): self |
92
|
|
|
{ |
93
|
|
|
$this->query['stateName'] = $name; |
94
|
|
|
|
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @param string $code |
100
|
|
|
* |
101
|
|
|
* @return VenueSearchBuilder |
102
|
|
|
*/ |
103
|
|
|
public function withStateCode(string $code): self |
104
|
|
|
{ |
105
|
|
|
$this->query['stateCode'] = $code; |
106
|
|
|
|
107
|
|
|
return $this; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @return array |
112
|
|
|
*/ |
113
|
|
|
public function getQuery(): array |
114
|
|
|
{ |
115
|
|
|
return $this->query; |
116
|
|
|
} |
117
|
|
|
} |
118
|
|
|
|