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
|
|
|
* @return VenueSearchBuilder |
28
|
|
|
*/ |
29
|
|
|
public static function create(): self |
30
|
|
|
{ |
31
|
|
|
return new static(); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @param int $page |
36
|
|
|
* |
37
|
|
|
* @return VenueSearchBuilder |
38
|
|
|
*/ |
39
|
|
|
public function page(int $page): self |
40
|
|
|
{ |
41
|
|
|
$this->query['p'] = $page; |
42
|
|
|
|
43
|
|
|
return $this; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @param string $name |
48
|
|
|
* |
49
|
|
|
* @return VenueSearchBuilder |
50
|
|
|
*/ |
51
|
|
|
public function withName(string $name): self |
52
|
|
|
{ |
53
|
|
|
$this->query['name'] = $name; |
54
|
|
|
|
55
|
|
|
return $this; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @param string $name |
60
|
|
|
* |
61
|
|
|
* @return VenueSearchBuilder |
62
|
|
|
*/ |
63
|
|
|
public function withCity(string $name): self |
64
|
|
|
{ |
65
|
|
|
$this->query['cityName'] = $name; |
66
|
|
|
|
67
|
|
|
return $this; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param int $id |
72
|
|
|
* |
73
|
|
|
* @return VenueSearchBuilder |
74
|
|
|
*/ |
75
|
|
|
public function withCityId(int $id): self |
76
|
|
|
{ |
77
|
|
|
$this->query['cityId'] = $id; |
78
|
|
|
|
79
|
|
|
return $this; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @param string $country |
84
|
|
|
* |
85
|
|
|
* @return VenueSearchBuilder |
86
|
|
|
*/ |
87
|
|
|
public function withCountry(string $country): self |
88
|
|
|
{ |
89
|
|
|
$this->query['country'] = $country; |
90
|
|
|
|
91
|
|
|
return $this; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @param string $name |
96
|
|
|
* |
97
|
|
|
* @return VenueSearchBuilder |
98
|
|
|
*/ |
99
|
|
|
public function withState(string $name): self |
100
|
|
|
{ |
101
|
|
|
$this->query['stateName'] = $name; |
102
|
|
|
|
103
|
|
|
return $this; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @param string $code |
108
|
|
|
* |
109
|
|
|
* @return VenueSearchBuilder |
110
|
|
|
*/ |
111
|
|
|
public function withStateCode(string $code): self |
112
|
|
|
{ |
113
|
|
|
$this->query['stateCode'] = $code; |
114
|
|
|
|
115
|
|
|
return $this; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @return array |
120
|
|
|
*/ |
121
|
|
|
public function getQuery(): array |
122
|
|
|
{ |
123
|
|
|
return $this->query; |
124
|
|
|
} |
125
|
|
|
} |
126
|
|
|
|