GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( f20fbc...7f6b56 )
by Oleg
02:14
created

WorldOfWarcraft::getProfileCharacters()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 10
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 10
loc 10
rs 9.4286
cc 2
eloc 6
nc 2
nop 2
1
<?php
2
3
namespace BlizzardApi\Service;
4
5
use GuzzleHttp\Psr7\Response;
6
7
/**
8
 * Class World Of Warcraft
9
 *
10
 * @author Oleg Kachinsky <[email protected]>
11
 */
12
class WorldOfWarcraft extends Service
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    protected $serviceParam = '/wow';
18
19
    // region Achievement API
20
21
    /**
22
     * Get achievement information by ID
23
     *
24
     * This provides data about an individual achievement
25
     *
26
     * @param int   $achievementId The ID of the achievement to retrieve
27
     * @param array $options       Options
28
     *
29
     * @return Response
30
     */
31
    public function getAchievement($achievementId, array $options = [])
32
    {
33
        return $this->request('/achievement/'.(int) $achievementId, $options);
34
    }
35
36
    // endregion Achievement API
37
38
    // region Auction API
39
40
    /**
41
     * Get auction data status
42
     *
43
     * Auction APIs currently provide rolling batches of data about current auctions. Fetching auction dumps is a two
44
     * step process that involves checking a per-realm index file to determine if a recent dump has been generated and
45
     * then fetching the most recently generated dump file if necessary.
46
     *
47
     * This API resource provides a per-realm list of recently generated auction house data dumps
48
     *
49
     * @param string $realm   The realm being requested
50
     * @param array  $options Options
51
     *
52
     * @return Response
53
     */
54
    public function getAuctionDataStatus($realm, array $options = [])
55
    {
56
        return $this->request('/auction/data/'.(string) $realm, $options);
57
    }
58
59
    // endregion Auction API
60
61
    // region Pet API
62
63
    /**
64
     * Get pet lists
65
     *
66
     * A list of all supported battle and vanity pets
67
     *
68
     * @param array $options Options
69
     *
70
     * @return Response
71
     */
72
    public function getPetList(array $options = [])
73
    {
74
        return $this->request('/pet/', $options);
75
    }
76
77
    /**
78
     * Get pet ability information by ID
79
     *
80
     * This provides data about a individual battle pet ability ID. We do not provide the tooltip for the ability yet.
81
     * We are working on a better way to provide this since it depends on your pet's species, level and quality rolls.
82
     *
83
     * @param int   $abilityId The ID of the ability you want to retrieve
84
     * @param array $options   Options
85
     *
86
     * @return Response
87
     */
88
    public function getPetAbility($abilityId, array $options = [])
89
    {
90
        return $this->request('/pet/ability/'.(int) $abilityId, $options);
91
    }
92
93
    /**
94
     * Get pet species information by ID
95
     *
96
     * This provides the data about an individual pet species. The species IDs can be found your character profile
97
     * using the options pets field. Each species also has data about what it's 6 abilities are.
98
     *
99
     * @param int   $speciesId The species you want to retrieve data on
100
     * @param array $options   Options
101
     *
102
     * @return Response
103
     */
104
    public function getPetSpecies($speciesId, array $options = [])
105
    {
106
        return $this->request('/pet/species/'.(int) $speciesId, $options);
107
    }
108
109
    /**
110
     * Get pet stats by species ID
111
     *
112
     * Retrieve detailed information about a given species of pet
113
     *
114
     * @param int   $speciesId The pet's species ID. This can be found by querying a users' list of pets via the Character Profile API
115
     * @param array $options   Options
116
     *
117
     * @return Response
118
     */
119
    public function getPetStats($speciesId, array $options = [])
120
    {
121
        return $this->request('/pet/stats/'.(int) $speciesId, $options);
122
    }
123
124
    // endregion Pet API
125
126
    // region Mound API
127
128
    /**
129
     * Get master list
130
     *
131
     * A list of all supported mounts
132
     *
133
     * @param array $options Options
134
     *
135
     * @return Response
136
     */
137
    public function getMasterList(array $options = [])
138
    {
139
        return $this->request('/mount/', $options);
140
    }
141
142
    // endregion Mount API
143
144
    // region Challenge Mode API
145
146
    /**
147
     * Get realm leaderboards
148
     *
149
     * The data in this request has data for all 9 challenge mode maps (currently). The map field includes the current
150
     * medal times for each dungeon. Inside each ladder we provide data about each character that was part of each run.
151
     * The character data includes the current cached spec of the character while the member field includes the spec of
152
     * the character during the challenge mode run.
153
     *
154
     * @param string $realm   The realm being requested
155
     * @param array  $options Options
156
     *
157
     * @return Response
158
     */
159
    public function getRealmLeaderboard($realm, array $options = [])
160
    {
161
        return $this->request('/challenge/'.(string) $realm, $options);
162
    }
163
164
    /**
165
     * Get region leaderboards
166
     *
167
     * The region leaderboard has the exact same data format as the realm leaderboards except there is no realm field.
168
     * It is simply the top 100 results gathered for each map for all of the available realm leaderboards in a region.
169
     *
170
     * @param array $options Options
171
     *
172
     * @return Response
173
     */
174
    public function getRegionLeaderboard(array $options = [])
175
    {
176
        return $this->request('/challenge/region/', $options);
177
    }
178
179
    // endregion Challenge Mode API
180
181
    // region Character profile API
182
183
    /**
184
     * Get character
185
     *
186
     * The Character Profile API is the primary way to access character information. This Character Profile API can be
187
     * used to fetch a single character at a time through an HTTP GET request to a URL describing the character profile
188
     * resource. By default, a basic dataset will be returned and with each request and zero or more additional fields
189
     * can be retrieved. To access this API, craft a resource URL pointing to the character who's information is to be
190
     * retrieved
191
     *
192
     * @param string $realm         The character's realm. Can be provided as the proper realm name or the normalized realm name
193
     * @param string $characterName The name of the character you want to retrieve
194
     * @param array  $options       Options
195
     *
196
     * @return Response
197
     */
198
    public function getCharacter($realm, $characterName, array $options = [])
199
    {
200
        return $this->request('/character/'.(string) $realm.'/'.(string) $characterName, $options);
201
    }
202
203
    // endregion Character profile API
204
205
    // region Item API
206
207
    /**
208
     * Get item information by ID
209
     *
210
     * The item API provides detailed item information. This includes item set information if this item is part of a set.
211
     *
212
     * @param int   $itemId  Unique ID of the item being requested
213
     * @param array $options Options
214
     *
215
     * @return Response
216
     */
217
    public function getItem($itemId, array $options = [])
218
    {
219
        return $this->request('/item/'.(int) $itemId, $options);
220
    }
221
222
    /**
223
     * Get set information by ID
224
     *
225
     * The item API provides detailed item information. This includes item set information if this item is part of a set.
226
     *
227
     * @param int   $setId   Unique ID of the set being requested
228
     * @param array $options Options
229
     *
230
     * @return Response
231
     */
232
    public function getItemSet($setId, array $options = [])
233
    {
234
        return $this->request('/item/set/'.(int) $setId, $options);
235
    }
236
237
    // endregion Item API
238
239
    // region Guild profile API
240
241
    /**
242
     * Get guild profile
243
     *
244
     * The guild profile API is the primary way to access guild information. This guild profile API can be used to fetch
245
     * a single guild at a time through an HTTP GET request to a url describing the guild profile resource. By default,
246
     * a basic dataset will be returned and with each request and zero or more additional fields can be retrieved.
247
     *
248
     * There are no required query string parameters when accessing this resource, although the fields query string
249
     * parameter can optionally be passed to indicate that one or more of the optional datasets is to be retrieved.
250
     * Those additional fields are listed in the method titled "Optional Fields".
251
     *
252
     * @param string $realm     The realm the guild lives on
253
     * @param string $guildName Name of the guild being queried
254
     * @param array  $options   Options
255
     *
256
     * @return Response
257
     */
258
    public function getGuild($realm, $guildName, array $options = [])
259
    {
260
        return $this->request('/guild/'.(string) $realm.'/'.(string) $guildName, $options);
261
    }
262
263
    // endregion Guild profile API
264
265
    // region PVP API
266
267
    /**
268
     * Get leaderboards
269
     *
270
     * The Leaderboard API endpoint provides leaderboard information for the 2v2, 3v3, 5v5 and Rated Battleground
271
     * leaderboards.
272
     *
273
     * @param int   $bracket The type of leaderboard you want to retrieve. Valid entries are 2v2, 3v3, 5v5, and rbg
274
     * @param array $options Options
275
     *
276
     * @return Response
277
     */
278
    public function getLeaderboards($bracket, array $options = [])
279
    {
280
        return $this->request('/leaderboard/'.(string) $bracket, $options);
281
    }
282
283
    // endregion PVP API
284
285
    // region Quest API
286
287
    /**
288
     * Get quest information by ID
289
     *
290
     * Retrieve metadata for a given quest.
291
     *
292
     * @param int   $questId The ID of the desired quest
293
     * @param array $options Options
294
     *
295
     * @return Response
296
     */
297
    public function getQuest($questId, array $options = [])
298
    {
299
        return $this->request('/quest/'.(int) $questId, $options);
300
    }
301
302
    // endregion Quest API
303
304
    // region Realm status API
305
306
    /**
307
     * Get realm status
308
     *
309
     * The realm status API allows developers to retrieve realm status information. This information is limited to
310
     * whether or not the realm is up, the type and state of the realm, the current population, and the status of the
311
     * two world PvP zones
312
     *
313
     * @param array $options Options
314
     *
315
     * @return Response
316
     */
317
    public function getRealmStatus(array $options = [])
318
    {
319
        return $this->request('/realm/', $options);
320
    }
321
322
    // endregion Realm status API
323
324
    // region Recipe API
325
326
    /**
327
     * Get recipe information by ID
328
     *
329
     * The recipe API provides basic recipe information
330
     *
331
     * @param int   $recipeId Unique ID for the desired recipe
332
     * @param array $options  Options
333
     *
334
     * @return Response
335
     */
336
    public function getRecipe($recipeId, array $options = [])
337
    {
338
        return $this->request('/recipe/'.(int) $recipeId, $options);
339
    }
340
341
    // endregion Recipe API
342
343
    // region Spell API
344
345
    /**
346
     * Get spell information by ID
347
     *
348
     * The spell API provides some information about spells
349
     *
350
     * @param int   $spellId Unique ID of the desired spell
351
     * @param array $options Options
352
     *
353
     * @return Response
354
     */
355
    public function getSpell($spellId, array $options = [])
356
    {
357
        return $this->request('/spell/'.(int) $spellId, $options);
358
    }
359
360
    // endregion Spell API
361
362
    // region Data resources API
363
364
    /**
365
     * Get battlegroups
366
     *
367
     * The battlegroups data API provides the list of battlegroups for this region. Please note the trailing '/' on this URL
368
     *
369
     * @param array $options Options
370
     *
371
     * @return Response
372
     */
373
    public function getBattlegroups(array $options = [])
374
    {
375
        return $this->request('/data/battlegroups/', $options);
376
    }
377
378
    /**
379
     * Get character races
380
     *
381
     * The character races data API provides a list of each race and their associated faction, name, unique ID, and skin
382
     *
383
     * @param array $options Options
384
     *
385
     * @return Response
386
     */
387
    public function getCharacterRaces(array $options = [])
388
    {
389
        return $this->request('/data/character/races/', $options);
390
    }
391
392
    /**
393
     * Get character classes
394
     *
395
     * The character classes data API provides a list of character classes
396
     *
397
     * @param array $options Options
398
     *
399
     * @return Response
400
     */
401
    public function getCharacterClasses(array $options = [])
402
    {
403
        return $this->request('/data/character/classes/', $options);
404
    }
405
406
    /**
407
     * Get character achievements
408
     *
409
     * The character achievements data API provides a list of all of the achievements that characters can earn as well
410
     * as the category structure and hierarchy
411
     *
412
     * @param array $options Options
413
     *
414
     * @return Response
415
     */
416
    public function getCharacterAchievements(array $options = [])
417
    {
418
        return $this->request('/data/character/achievements/', $options);
419
    }
420
421
    /**
422
     * Get guild rewards
423
     *
424
     * The guild rewards data API provides a list of all guild rewards
425
     *
426
     * @param array $options Options
427
     *
428
     * @return Response
429
     */
430
    public function getGuildRewards(array $options = [])
431
    {
432
        return $this->request('/data/guild/rewards/', $options);
433
    }
434
435
    /**
436
     * Get guild perks
437
     *
438
     * The guild perks data API provides a list of all guild perks
439
     *
440
     * @param array $options Options
441
     *
442
     * @return Response
443
     */
444
    public function getGuildPerks(array $options = [])
445
    {
446
        return $this->request('/data/guild/perks/', $options);
447
    }
448
449
    /**
450
     * Get guild achievements
451
     *
452
     * The guild achievements data API provides a list of all of the achievements that guilds can earn as well as the
453
     * category structure and hierarchy
454
     *
455
     * @param array $options Options
456
     *
457
     * @return Response
458
     */
459
    public function getGuildAchievements(array $options = [])
460
    {
461
        return $this->request('/data/guild/achievements/', $options);
462
    }
463
464
    /**
465
     * Get item classes
466
     *
467
     * The item classes data API provides a list of item classes
468
     *
469
     * @param array $options Options
470
     *
471
     * @return Response
472
     */
473
    public function getItemClasses(array $options = [])
474
    {
475
        return $this->request('/data/item/classes/', $options);
476
    }
477
478
    /**
479
     * Get talents
480
     *
481
     * The talents data API provides a list of talents, specs and glyphs for each class
482
     *
483
     * @param array $options Options
484
     *
485
     * @return Response
486
     */
487
    public function getTalents(array $options = [])
488
    {
489
        return $this->request('/data/talents/', $options);
490
    }
491
492
    /**
493
     * Get pet types
494
     *
495
     * The different bat pet types (including what they are strong and weak against)
496
     *
497
     * @param array $options Options
498
     *
499
     * @return Response
500
     */
501
    public function getPetTypes(array $options = [])
502
    {
503
        return $this->request('/data/pet/types/', $options);
504
    }
505
506
    // endregion Data resources API
507
508
    // region Community OAuth API
509
510
    /**
511
     * Get profile characters
512
     *
513
     * This provides data about the current logged in OAuth user's WoW profile
514
     *
515
     * @param null|string $accessToken Authorized user access token
516
     * @param array       $options     Options
517
     *
518
     * @return Response
519
     */
520 View Code Duplication
    public function getProfileCharacters($accessToken = null, array $options = [])
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
521
    {
522
        if (null === $accessToken) {
523
            $options['access_token'] = $this->blizzardClient->getAccessToken();
524
        } else {
525
            $options['access_token'] = $accessToken;
526
        }
527
528
        return $this->request('/user/characters', $options);
529
    }
530
531
    // endregion Community OAuth API
532
}
533