This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Xklusive\BattlenetApi\Services; |
||
4 | |||
5 | use Illuminate\Support\Collection; |
||
6 | use Xklusive\BattlenetApi\BattlenetHttpClient; |
||
7 | |||
8 | /** |
||
9 | * @author Guillaume Meheust <[email protected]> |
||
10 | */ |
||
11 | class WowService extends BattlenetHttpClient |
||
12 | { |
||
13 | /** |
||
14 | * {@inheritdoc} |
||
15 | */ |
||
16 | protected $gameParam = '/wow'; |
||
17 | |||
18 | /** |
||
19 | * Get achievement information by id. |
||
20 | * |
||
21 | * This provides data about an individual achievement |
||
22 | * |
||
23 | * @param int $achievementId Id of the achievement to retrieve |
||
24 | * @param array $options Options |
||
25 | * |
||
26 | * @return Illuminate\Support\Collection api response |
||
27 | */ |
||
28 | public function getAchievement($achievementId, array $options = []) |
||
29 | { |
||
30 | return $this->cache('/achievement/'.(int) $achievementId, $options, __FUNCTION__); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * Get auction data. |
||
35 | * |
||
36 | * Auction APIs currently provide rolling batches of data about current auctions. Fetching auction dumps is a two |
||
37 | * step process that involves checking a per-realm index file to determine if a recent dump has been generated and |
||
38 | * then fetching the most recently generated dump file if necessary. |
||
39 | * |
||
40 | * This API resource provides a per-realm list of recently generated auction house data dumps |
||
41 | * |
||
42 | * @param string $realm Realm being requested |
||
43 | * @param array $options Options |
||
44 | * |
||
45 | * @return Illuminate\Support\Collection api response |
||
46 | */ |
||
47 | public function getAuctionDataStatus($realm, array $options = []) |
||
48 | { |
||
49 | return $this->cache('/auction/data/'.(string) $realm, $options, __FUNCTION__); |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Get boss master list. |
||
54 | * |
||
55 | * A list of all supported bosses. A 'boss' in this context should be considered a boss encounter, which may include |
||
56 | * more than one NPC. |
||
57 | * |
||
58 | * @param array $options Options |
||
59 | * |
||
60 | * @return Illuminate\Support\Collection api response |
||
61 | */ |
||
62 | public function getBossMasterList(array $options = []) |
||
63 | { |
||
64 | return $this->cache('/boss/', $options, __FUNCTION__); |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Get boss information by id. |
||
69 | * |
||
70 | * The boss API provides information about bosses. A 'boss' in this context should be considered a boss encounter, |
||
71 | * which may include more than one NPC. |
||
72 | * |
||
73 | * @param int $bossId Id of the boss you want to retrieve |
||
74 | * @param array $options Options |
||
75 | * |
||
76 | * @return Illuminate\Support\Collection api response |
||
77 | */ |
||
78 | public function getBoss($bossId, array $options = []) |
||
79 | { |
||
80 | return $this->cache('/boss/'.(int) $bossId, $options, __FUNCTION__); |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * Get realm leaderboards. |
||
85 | * |
||
86 | * The data in this request has data for all 9 challenge mode maps (currently). The map field includes the current |
||
87 | * medal times for each dungeon. Inside each ladder we provide data about each character that was part of each run. |
||
88 | * The character data includes the current cached spec of the character while the member field includes the spec of |
||
89 | * the character during the challenge mode run. |
||
90 | * |
||
91 | * @param string $realm Realm's name being requested |
||
92 | * @param array $options Options |
||
93 | * |
||
94 | * @return Illuminate\Support\Collection api response |
||
95 | */ |
||
96 | public function getRealmLeaderboard($realm, array $options = []) |
||
97 | { |
||
98 | return $this->cache('/challenge/'.(string) $realm, $options, __FUNCTION__); |
||
99 | } |
||
100 | |||
101 | /** |
||
102 | * Get region leaderboards. |
||
103 | * |
||
104 | * The region leaderboard has the exact same data format as the realm leaderboards except there is no realm field. |
||
105 | * It is simply the top 100 results gathered for each map for all of the available realm leaderboards in a region. |
||
106 | * |
||
107 | * @param array $options Options |
||
108 | * |
||
109 | * @return Illuminate\Support\Collection api response |
||
110 | */ |
||
111 | public function getRegionLeaderboard(array $options = []) |
||
112 | { |
||
113 | return $this->cache('/challenge/region', $options, __FUNCTION__); |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | * Get character information. |
||
118 | * |
||
119 | * The Character Profile API is the primary way to access character information. This Character Profile API can be |
||
120 | * used to fetch a single character at a time through an HTTP GET request to a URL describing the character profile |
||
121 | * resource. By default, a basic dataset will be returned and with each request and zero or more additional fields |
||
122 | * can be retrieved. To access this API, craft a resource URL pointing to the character who's information is to be |
||
123 | * retrieved |
||
124 | * |
||
125 | * @param string $realm Character's realm. Can be provided as the proper realm name or the normalized realm name |
||
126 | * @param string $characterName Name of the character you want to retrieve |
||
127 | * @param array $options Options |
||
128 | * |
||
129 | * @return Illuminate\Support\Collection api response |
||
130 | */ |
||
131 | public function getCharacter($realm, $characterName, array $options = []) |
||
132 | { |
||
133 | return $this->cache('/character/'.(string) $realm.'/'.(string) $characterName, $options, __FUNCTION__); |
||
134 | } |
||
135 | |||
136 | /** |
||
137 | * Get guild profile. |
||
138 | * |
||
139 | * The guild profile API is the primary way to access guild information. This guild profile API can be used to fetch |
||
140 | * a single guild at a time through an HTTP GET request to a url describing the guild profile resource. By default, |
||
141 | * a basic dataset will be returned and with each request and zero or more additional fields can be retrieved. |
||
142 | * |
||
143 | * There are no required query string parameters when accessing this resource, although the fields query string |
||
144 | * parameter can optionally be passed to indicate that one or more of the optional datasets is to be retrieved. |
||
145 | * Those additional fields are listed in the method titled "Optional Fields". |
||
146 | * |
||
147 | * @param string $realm Realm the guild lives on |
||
148 | * @param string $guildName Name of the guild being retrieved |
||
149 | * @param array $options Options |
||
150 | * |
||
151 | * @return Illuminate\Support\Collection api response |
||
152 | */ |
||
153 | public function getGuild($realm, $guildName, array $options = []) |
||
154 | { |
||
155 | return $this->cache('/guild/'.(string) $realm.'/'.(string) $guildName, $options, __FUNCTION__); |
||
156 | } |
||
157 | |||
158 | /** |
||
159 | * Get guild members. |
||
160 | * |
||
161 | * This provides a list of characters currently in the guild Roster. |
||
162 | * This is a wrapper function for the getGuild data function for easier access. |
||
163 | * |
||
164 | * @param string $realm Realm the guild lives on |
||
165 | * @param string $guildName Name of the guild being retrieved |
||
166 | * @param array $options Options |
||
167 | * |
||
168 | * @return Illuminate\Support\Collection api response |
||
169 | */ |
||
170 | public function getGuildMembers($realm, $guildName, array $options = []) |
||
171 | { |
||
172 | $options = $this->wrapCollection($options); |
||
173 | $query = $this->wrapCollection($options->get('query')); |
||
174 | $fields = $this->wrapCollection($query->get('fields')); |
||
175 | |||
176 | if ($fields->isEmpty()) { |
||
177 | // The options doesn't contain a fields section which is required for this query. |
||
178 | // Lets add one with the default value 'members' |
||
179 | $query->put('fields', 'members'); |
||
180 | } |
||
181 | |||
182 | if ($fields->contains('members') === false) { |
||
183 | // The options does contain a fileds element but 'members' is not part of it |
||
184 | // Lets add one 'members' to the list. |
||
185 | $fields->push('members'); |
||
186 | $query->put('fields', $fields->implode(',')); |
||
187 | } |
||
188 | |||
189 | $options->put('query', $query); |
||
190 | |||
191 | // We have everything what we need, lets call the getGuild function to proceed |
||
192 | return $this->getGuild($realm, $guildName, $options->toArray()); |
||
193 | } |
||
194 | |||
195 | /** |
||
196 | * Get item information by id. |
||
197 | * |
||
198 | * The item API provides detailed item information. This includes item set information if this item is part of a set. |
||
199 | * |
||
200 | * @param int $itemId Id of the item being retrieved |
||
201 | * @param array $options Options |
||
202 | * |
||
203 | * @return Illuminate\Support\Collection api response |
||
204 | */ |
||
205 | public function getItem($itemId, array $options = []) |
||
206 | { |
||
207 | return $this->cache('/item/'.(int) $itemId, $options, __FUNCTION__); |
||
208 | } |
||
209 | |||
210 | /** |
||
211 | * Get set information by id. |
||
212 | * |
||
213 | * The item API provides detailed item information. This includes item set information if this item is part of a set. |
||
214 | * |
||
215 | * @param int $setId Id of the set being requested |
||
216 | * @param array $options Options |
||
217 | * |
||
218 | * @return Illuminate\Support\Collection api response |
||
219 | */ |
||
220 | public function getItemSet($setId, array $options = []) |
||
221 | { |
||
222 | return $this->cache('/item/set/'.(int) $setId, $options, __FUNCTION__); |
||
223 | } |
||
224 | |||
225 | /** |
||
226 | * Get mount master list. |
||
227 | * |
||
228 | * A list of all supported mounts |
||
229 | * |
||
230 | * @param array $options Options |
||
231 | * |
||
232 | * @return Illuminate\Support\Collection api response |
||
233 | */ |
||
234 | public function getMountMasterList(array $options = []) |
||
235 | { |
||
236 | return $this->cache('/mount/', $options, __FUNCTION__); |
||
237 | } |
||
238 | |||
239 | /** |
||
240 | * Get pet lists. |
||
241 | * |
||
242 | * A list of all supported battle and vanity pets |
||
243 | * |
||
244 | * @param array $options Options |
||
245 | * |
||
246 | * @return Illuminate\Support\Collection api response |
||
247 | */ |
||
248 | public function getPetList(array $options = []) |
||
249 | { |
||
250 | return $this->cache('/pet/', $options, __FUNCTION__); |
||
251 | } |
||
252 | |||
253 | /** |
||
254 | * Get pet ability information by id. |
||
255 | * |
||
256 | * This provides data about a individual battle pet ability ID. We do not provide the tooltip for the ability yet. |
||
257 | * We are working on a better way to provide this since it depends on your pet's species, level and quality rolls. |
||
258 | * |
||
259 | * @param int $abilityId Id of the ability you want to retrieve |
||
260 | * @param array $options Options |
||
261 | * |
||
262 | * @return Illuminate\Support\Collection api response |
||
263 | */ |
||
264 | public function getPetAbility($abilityId, array $options = []) |
||
265 | { |
||
266 | return $this->cache('/pet/ability/'.(int) $abilityId, $options, __FUNCTION__); |
||
267 | } |
||
268 | |||
269 | /** |
||
270 | * Get pet species information by id. |
||
271 | * |
||
272 | * This provides the data about an individual pet species. The species IDs can be found your character profile |
||
273 | * using the options pets field. Each species also has data about what it's 6 abilities are. |
||
274 | * |
||
275 | * @param int $speciesId The species you want to retrieve |
||
276 | * @param array $options Options |
||
277 | * |
||
278 | * @return Illuminate\Support\Collection api response |
||
279 | */ |
||
280 | public function getPetSpecies($speciesId, array $options = []) |
||
281 | { |
||
282 | return $this->cache('/pet/species/'.(int) $speciesId, $options, __FUNCTION__); |
||
283 | } |
||
284 | |||
285 | /** |
||
286 | * Get pet stats by species id. |
||
287 | * |
||
288 | * Retrieve detailed information about a given species of pet |
||
289 | * |
||
290 | * @param int $speciesId Pet's species id. This can be found by querying a users' list of pets via the Character Profile API |
||
291 | * @param array $options Options |
||
292 | * |
||
293 | * @return Illuminate\Support\Collection api response |
||
294 | */ |
||
295 | public function getPetStats($speciesId, array $options = []) |
||
296 | { |
||
297 | // Create a collection from the options, easier to work with. |
||
298 | $options = $this->wrapCollection($options); |
||
299 | |||
300 | foreach ($options as $key => $option) { |
||
301 | if (in_array($key, ['level', 'breedId', 'qualityId'])) { |
||
302 | // We have some valid options for this query, lets add them to the query options |
||
303 | if ($options->has('query') === false) { |
||
304 | // We don't have any query options. Lets create an empty collection. |
||
305 | $options->put('query', collect()); |
||
306 | } |
||
307 | |||
308 | // We already have some query options lets add the new ones to the list. |
||
309 | $options->get('query')->put($key, $option); |
||
310 | } |
||
311 | } |
||
312 | |||
313 | return $this->cache('/pet/stats/'.(int) $speciesId, $options->toArray(), __FUNCTION__); |
||
314 | } |
||
315 | |||
316 | /** |
||
317 | * Get leaderboards. |
||
318 | * |
||
319 | * The Leaderboard API endpoint provides leaderboard information for the 2v2, 3v3, 5v5 and Rated Battleground |
||
320 | * leaderboards. |
||
321 | * |
||
322 | * @param int $bracket Type of leaderboard you want to retrieve. Example: 2v2, 3v3, 5v5, and rbg |
||
323 | * @param array $options Options |
||
324 | * |
||
325 | * @return Illuminate\Support\Collection api response |
||
326 | */ |
||
327 | public function getLeaderboards($bracket, array $options = []) |
||
328 | { |
||
329 | return $this->cache('/leaderboard/'.(string) $bracket, $options, __FUNCTION__); |
||
330 | } |
||
331 | |||
332 | /** |
||
333 | * Get quest information by id. |
||
334 | * |
||
335 | * Retrieve metadata for a given quest. |
||
336 | * |
||
337 | * @param int $questId Id of the quest you want to retrieve |
||
338 | * @param array $options Options |
||
339 | * |
||
340 | * @return Illuminate\Support\Collection api response |
||
341 | */ |
||
342 | public function getQuest($questId, array $options = []) |
||
343 | { |
||
344 | return $this->cache('/quest/'.(int) $questId, $options, __FUNCTION__); |
||
345 | } |
||
346 | |||
347 | /** |
||
348 | * Get realm status. |
||
349 | * |
||
350 | * The realm status API allows developers to retrieve realm status information. This information is limited to |
||
351 | * whether or not the realm is up, the type and state of the realm, the current population, and the status of the |
||
352 | * two world PvP zones |
||
353 | * |
||
354 | * @param array $options Options |
||
355 | * |
||
356 | * @return Illuminate\Support\Collection api response |
||
357 | */ |
||
358 | public function getRealmStatus(array $options = []) |
||
359 | { |
||
360 | return $this->cache('/realm/status', $options, __FUNCTION__); |
||
361 | } |
||
362 | |||
363 | /** |
||
364 | * Get recipe information by id. |
||
365 | * |
||
366 | * The recipe API provides basic recipe information |
||
367 | * |
||
368 | * @param int $recipeId Id for the desired recipe |
||
369 | * @param array $options Options |
||
370 | * |
||
371 | * @return Illuminate\Support\Collection api response |
||
372 | */ |
||
373 | public function getRecipe($recipeId, array $options = []) |
||
374 | { |
||
375 | return $this->cache('/recipe/'.(int) $recipeId, $options, __FUNCTION__); |
||
376 | } |
||
377 | |||
378 | /** |
||
379 | * Get spell information by id. |
||
380 | * |
||
381 | * The spell API provides some information about spells |
||
382 | * |
||
383 | * @param int $spellId Id of the desired spell |
||
384 | * @param array $options Options |
||
385 | * |
||
386 | * @return Illuminate\Support\Collection api response |
||
387 | */ |
||
388 | public function getSpell($spellId, array $options = []) |
||
389 | { |
||
390 | return $this->cache('/spell/'.(int) $spellId, $options, __FUNCTION__); |
||
391 | } |
||
392 | |||
393 | /** |
||
394 | * Get zone master list. |
||
395 | * |
||
396 | * A list of all supported zones and their bosses. A 'zone' in this context should be considered a dungeon, or a |
||
397 | * raid, not a zone as in a world zone. A 'boss' in this context should be considered a boss encounter, which may |
||
398 | * include more than one NPC. |
||
399 | * |
||
400 | * @param array $options Options |
||
401 | * |
||
402 | * @return Illuminate\Support\Collection api response |
||
403 | */ |
||
404 | public function getZonesMasterList(array $options = []) |
||
405 | { |
||
406 | return $this->cache('/zone/', $options, __FUNCTION__); |
||
407 | } |
||
408 | |||
409 | /** |
||
410 | * Get zone information by id. |
||
411 | * |
||
412 | * The Zone API provides some information about zones. |
||
413 | * |
||
414 | * @param int $zoneId Id of the zone you want to retrieve |
||
415 | * @param array $options Options |
||
416 | * |
||
417 | * @return Illuminate\Support\Collection api response |
||
418 | */ |
||
419 | public function getZone($zoneId, array $options = []) |
||
420 | { |
||
421 | return $this->cache('/zone/'.(int) $zoneId, $options, __FUNCTION__); |
||
422 | } |
||
423 | |||
424 | /** |
||
425 | * Get data battlegroups. |
||
426 | * |
||
427 | * The battlegroups data API provides the list of battlegroups for this region. Please note the trailing '/' on this URL |
||
428 | * |
||
429 | * @param array $options Options |
||
430 | * |
||
431 | * @return Illuminate\Support\Collection api response |
||
432 | */ |
||
433 | public function getDataBattlegroups(array $options = []) |
||
434 | { |
||
435 | return $this->cache('/data/battlegroups/', $options, __FUNCTION__); |
||
436 | } |
||
437 | |||
438 | /** |
||
439 | * Get data character races. |
||
440 | * |
||
441 | * The character races data API provides a list of each race and their associated faction, name, unique ID, and skin |
||
442 | * |
||
443 | * @param array $options Options |
||
444 | * |
||
445 | * @return Illuminate\Support\Collection api response |
||
446 | */ |
||
447 | public function getDataCharacterRaces(array $options = []) |
||
448 | { |
||
449 | return $this->cache('/data/character/races', $options, __FUNCTION__); |
||
450 | } |
||
451 | |||
452 | /** |
||
453 | * Get data character classes. |
||
454 | * |
||
455 | * The character classes data API provides a list of character classes |
||
456 | * |
||
457 | * @param array $options Options |
||
458 | * |
||
459 | * @return Illuminate\Support\Collection api response |
||
460 | */ |
||
461 | public function getDataCharacterClasses(array $options = []) |
||
462 | { |
||
463 | return $this->cache('/data/character/classes', $options, __FUNCTION__); |
||
464 | } |
||
465 | |||
466 | /** |
||
467 | * Get data character achievements. |
||
468 | * |
||
469 | * The character achievements data API provides a list of all of the achievements that characters can earn as well |
||
470 | * as the category structure and hierarchy |
||
471 | * |
||
472 | * @param array $options Options |
||
473 | * |
||
474 | * @return Illuminate\Support\Collection api response |
||
475 | */ |
||
476 | public function getDataCharacterAchievements(array $options = []) |
||
477 | { |
||
478 | return $this->cache('/data/character/achievements', $options, __FUNCTION__); |
||
479 | } |
||
480 | |||
481 | /** |
||
482 | * Get data guild rewards. |
||
483 | * |
||
484 | * The guild rewards data API provides a list of all guild rewards |
||
485 | * |
||
486 | * @param array $options Options |
||
487 | * |
||
488 | * @return Illuminate\Support\Collection api response |
||
489 | */ |
||
490 | public function getDataGuildRewards(array $options = []) |
||
491 | { |
||
492 | return $this->cache('/data/guild/rewards', $options, __FUNCTION__); |
||
493 | } |
||
494 | |||
495 | /** |
||
496 | * Get data guild perks. |
||
497 | * |
||
498 | * The guild perks data API provides a list of all guild perks |
||
499 | * |
||
500 | * @param array $options Options |
||
501 | * |
||
502 | * @return Illuminate\Support\Collection api response |
||
503 | */ |
||
504 | public function getDataGuildPerks(array $options = []) |
||
505 | { |
||
506 | return $this->cache('/data/guild/perks', $options, __FUNCTION__); |
||
507 | } |
||
508 | |||
509 | /** |
||
510 | * Get data guild achievements. |
||
511 | * |
||
512 | * The guild achievements data API provides a list of all of the achievements that guilds can earn as well as the |
||
513 | * category structure and hierarchy |
||
514 | * |
||
515 | * @param array $options Options |
||
516 | * |
||
517 | * @return Illuminate\Support\Collection api response |
||
518 | */ |
||
519 | public function getDataGuildAchievements(array $options = []) |
||
520 | { |
||
521 | return $this->cache('/data/guild/achievements', $options, __FUNCTION__); |
||
522 | } |
||
523 | |||
524 | /** |
||
525 | * Get data item classes. |
||
526 | * |
||
527 | * The item classes data API provides a list of item classes |
||
528 | * |
||
529 | * @param array $options Options |
||
530 | * |
||
531 | * @return Illuminate\Support\Collection api response |
||
532 | */ |
||
533 | public function getDataItemClasses(array $options = []) |
||
534 | { |
||
535 | return $this->cache('/data/item/classes', $options, __FUNCTION__); |
||
536 | } |
||
537 | |||
538 | /** |
||
539 | * Get data talents. |
||
540 | * |
||
541 | * The talents data API provides a list of talents, specs and glyphs for each class |
||
542 | * |
||
543 | * @param array $options Options |
||
544 | * |
||
545 | * @return Illuminate\Support\Collection api response |
||
546 | */ |
||
547 | public function getDataTalents(array $options = []) |
||
548 | { |
||
549 | return $this->cache('/data/talents', $options, __FUNCTION__); |
||
550 | } |
||
551 | |||
552 | /** |
||
553 | * Get data pet types. |
||
554 | * |
||
555 | * The different bat pet types (including what they are strong and weak against) |
||
556 | * |
||
557 | * @param array $options Options |
||
558 | * |
||
559 | * @return null|\Xklusive\BattlenetApi\Collection api response |
||
560 | */ |
||
561 | public function getDataPetTypes(array $options = []) |
||
562 | { |
||
563 | return $this->cache('/data/pet/types', $options, __FUNCTION__); |
||
564 | } |
||
565 | |||
566 | /** |
||
567 | * Get profile characters. |
||
568 | * |
||
569 | * This provides data about the current logged in OAuth user's WoW profile |
||
570 | * |
||
571 | * @param array $options Options |
||
572 | * |
||
573 | * @param string $bnetToken Access token of the current logged in user. |
||
574 | * @return Illuminate\Support\Collection api response |
||
575 | */ |
||
576 | public function getProfileCharacters(array $options = [], $bnetToken = null) |
||
577 | { |
||
578 | $options['access_token'] = $bnetToken ?? auth()->user()->bnet_token; |
||
0 ignored issues
–
show
|
|||
579 | |||
580 | return $this->cache('/user/characters', $options, __FUNCTION__); |
||
581 | } |
||
582 | } |
||
583 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: