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
|
|
|
* @return VenueSearchBuilder |
36
|
|
|
*/ |
37
|
|
|
public function page(int $page): self |
38
|
|
|
{ |
39
|
|
|
$this->query['p'] = $page; |
40
|
|
|
|
41
|
|
|
return $this; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @return VenueSearchBuilder |
46
|
|
|
*/ |
47
|
|
|
public function withName(string $name): self |
48
|
|
|
{ |
49
|
|
|
$this->query['name'] = $name; |
50
|
|
|
|
51
|
|
|
return $this; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @return VenueSearchBuilder |
56
|
|
|
*/ |
57
|
|
|
public function withCity(string $name): self |
58
|
|
|
{ |
59
|
|
|
$this->query['cityName'] = $name; |
60
|
|
|
|
61
|
|
|
return $this; |
62
|
|
|
} |
63
|
|
|
|
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
|
|
|
* @return VenueSearchBuilder |
76
|
|
|
*/ |
77
|
|
|
public function withCountry(string $country): self |
78
|
|
|
{ |
79
|
|
|
$this->query['country'] = $country; |
80
|
|
|
|
81
|
|
|
return $this; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @return VenueSearchBuilder |
86
|
|
|
*/ |
87
|
|
|
public function withState(string $name): self |
88
|
|
|
{ |
89
|
|
|
$this->query['state'] = $name; |
90
|
|
|
|
91
|
|
|
return $this; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @return VenueSearchBuilder |
96
|
|
|
*/ |
97
|
|
|
public function withStateCode(string $code): self |
98
|
|
|
{ |
99
|
|
|
$this->query['stateCode'] = $code; |
100
|
|
|
|
101
|
|
|
return $this; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function getQuery(): array |
105
|
|
|
{ |
106
|
|
|
return $this->query; |
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|