LeagueApi::getGrandMasterLeagues()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 6
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 6
loc 6
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace LoLApi\Api;
4
5
use LoLApi\Result\ApiResult;
6
7
/**
8
 * Class LeagueApi
9
 *
10
 * @see     https://developer.riotgames.com/api-methods/
11
 */
12 View Code Duplication
class LeagueApi extends BaseApi
0 ignored issues
show
Duplication introduced by
This class 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...
13
{
14
    const API_URL_LEAGUE_POSITION_BY_SUMMONER_ID = '/lol/league/v4/entries/by-summoner/{encryptedSummonerId}';
15
    const API_URL_LEAGUE_CHALLENGER              = '/lol/league/v4/challengerleagues/by-queue/{queue}';
16
    const API_URL_LEAGUE_MASTER                  = '/lol/league/v4/masterleagues/by-queue/{queue}';
17
    const API_URL_LEAGUE_GRAND_MASTER            = '/lol/league/v4/grandmasterleagues/by-queue/{queue}';
18
19
    /**
20
     * @param int $summonerId
21
     *
22
     * @return ApiResult
23
     */
24
    public function getLeaguePositionsBySummonerId($summonerId)
25
    {
26
        $url = str_replace('{encryptedSummonerId}', $summonerId, self::API_URL_LEAGUE_POSITION_BY_SUMMONER_ID);
27 1
28
        return $this->callApiUrl($url, []);
29 1
    }
30
31 1
    /**
32
     * @param string $gameQueueType (Can be RANKED_SOLO_5x5, RANKED_FLEX_SR, RANKED_FLEX_TT)
33
     *
34
     * @return ApiResult
35
     */
36
    public function getChallengerLeagues($gameQueueType)
37
    {
38
        $url = str_replace('{queue}', $gameQueueType, self::API_URL_LEAGUE_CHALLENGER);
39 1
40
        return $this->callApiUrl($url, []);
41 1
    }
42
43 1
    /**
44
     * @param string $gameQueueType (Can be RANKED_SOLO_5x5, RANKED_FLEX_SR, RANKED_FLEX_TT)
45
     *
46
     * @return ApiResult
47
     */
48
    public function getMasterLeagues($gameQueueType)
49
    {
50
        $url = str_replace('{queue}', $gameQueueType, self::API_URL_LEAGUE_MASTER);
51 1
52
        return $this->callApiUrl($url, []);
53 1
    }
54
55 1
    /**
56
     * @param string $gameQueueType (Can be RANKED_SOLO_5x5, RANKED_FLEX_SR, RANKED_FLEX_TT)
57
     *
58
     * @return ApiResult
59
     */
60
    public function getGrandMasterLeagues($gameQueueType)
61
    {
62
        $url = str_replace('{queue}', $gameQueueType, self::API_URL_LEAGUE_MASTER);
63 1
64
        return $this->callApiUrl($url, []);
65 1
    }
66
}
67