Skip to content

Commit 1e23e6c

Browse files
committed
adding region in $options
1 parent 8597e85 commit 1e23e6c

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/wargaming.php

+14-9
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public function searchPlayers($search, $options = null)
6262
$returned = $this->request("accountSearch", [
6363
"search" => $search,
6464
"limit" => !empty($options['limit']) ? $options['limit'] : 100,
65-
"method" => !empty($options['method']) ? $options['method'] : "startswith"
65+
"method" => !empty($options['method']) ? $options['method'] : "startswith",
66+
"region" => !empty($options['region']) ? $options['region'] : $this->region
6667
]);
6768

6869
return [
@@ -85,7 +86,8 @@ public function searchPlayer($accounts_id = [])
8586
}
8687

8788
$returned = $this->request("accountId", [
88-
"accounts" => $accounts
89+
"accounts" => $accounts,
90+
"region" => !empty($options['region']) ? $options['region'] : $this->region
8991
]);
9092

9193
return [
@@ -102,16 +104,15 @@ public function searchPlayer($accounts_id = [])
102104
*/
103105
public function serverInfo($region = null)
104106
{
105-
$region = !empty($region) ? $region : $this->region;
106107

107108
$returned = $this->request("serverInfo", [
108-
"region" => $region
109-
])['data'];
109+
"region" => !empty($region) ? $region : $this->region
110+
]);
110111

111112
return [
112-
"wotb" => $returned['wotb'],
113-
"wot" => $returned['wot'],
114-
"wows" => $returned['wows']
113+
"wotb" => $returned['data']['wotb'],
114+
"wot" => $returned['data']['wot'],
115+
"wows" => $returned['data']['wows']
115116
];
116117

117118
}
@@ -142,7 +143,8 @@ public function searchClans($search, $option = null)
142143
$returned = $this->request("clansSearch", [
143144
"search" => $search,
144145
"limit" => !empty($options['limit']) ? $options['limit'] : 100,
145-
"pagination" => !empty($options['pagination']) ? $options['pagination'] : 1
146+
"pagination" => !empty($options['pagination']) ? $options['pagination'] : 1,
147+
"region" => !empty($options['region']) ? $options['region'] : $this->region
146148
]);
147149

148150
return [
@@ -169,12 +171,14 @@ private function request($ref, $options)
169171
$link = str_replace("{search}", $options['search'], $link);
170172
$link = str_replace("{limit}", $options['limit'], $link);
171173
$link = str_replace("{method}", $options['method'], $link);
174+
$link = str_replace("{region}", $options['region'], $link);
172175
break;
173176

174177
case "accountId":
175178

176179
//Replace data of the link
177180
$link = str_replace("{accounts}", $options['accounts'], $link);
181+
$link = str_replace("{region}", $options['region'], $link);
178182
break;
179183

180184
case "clansSearch":
@@ -183,6 +187,7 @@ private function request($ref, $options)
183187
$link = str_replace("{search}", $options['search'], $link);
184188
$link = str_replace("{limit}", $options['limit'], $link);
185189
$link = str_replace("{pagination}", $options['pagination'], $link);
190+
$link = str_replace("{region}", $options['region'], $link);
186191
break;
187192

188193
case "serverInfo":

0 commit comments

Comments
 (0)