Code Duplication    Length = 48-55 lines in 2 locations

src/LoLApi/Api/ChampionMasteryApi.php 1 location

@@ 13-60 (lines=48) @@
10
 * @package LoLApi\Api
11
 * @see     https://developer.riotgames.com/api-methods/
12
 */
13
class ChampionMasteryApi extends BaseApi
14
{
15
    const API_URL_CHAMPION_MASTERY_BY_ID = '/lol/champion-mastery/v3/champion-masteries/by-summoner/{summonerId}';
16
    const API_URL_CHAMPION_MASTERY_BY_CHAMPION_ID = '/lol/champion-mastery/v3/champion-masteries/by-summoner/{summonerId}/by-champion/{championId}';
17
    const API_URL_CHAMPION_MASTERY_SCORE = '/lol/champion-mastery/v3/scores/by-summoner/{summonerId}';
18
19
    /**
20
     * Get all champion mastery entries sorted by number of champion points descending,
21
     *
22
     * @param int $summonerId
23
     *
24
     * @return ApiResult
25
     */
26
    public function getChampionsMasteries($summonerId)
27
    {
28
        $url = str_replace('{summonerId}', $summonerId, self::API_URL_CHAMPION_MASTERY_BY_ID);
29
30
        return $this->callApiUrl($url, []);
31
    }
32
33
    /**
34
     * @param int $summonerId
35
     * @param int $championId
36
     *
37
     * @return ApiResult
38
     */
39
    public function getChampionMastery($summonerId, $championId)
40
    {
41
        $url = str_replace('{summonerId}', $summonerId, self::API_URL_CHAMPION_MASTERY_BY_CHAMPION_ID);
42
        $url = str_replace('{championId}', $championId, $url);
43
44
        return $this->callApiUrl($url, []);
45
    }
46
47
    /**
48
     * Get a player's total champion mastery score, which is the sum of individual champion mastery levels
49
     *
50
     * @param int $summonerId
51
     *
52
     * @return ApiResult
53
     */
54
    public function getChampionsMasteriesScore($summonerId)
55
    {
56
        $url = str_replace('{playerId}', $summonerId, self::API_URL_CHAMPION_MASTERY_SCORE);
57
58
        return $this->callApiUrl($url, []);
59
    }
60
}
61

src/LoLApi/Api/LeagueApi.php 1 location

@@ 12-66 (lines=55) @@
9
 *
10
 * @see     https://developer.riotgames.com/api-methods/
11
 */
12
class LeagueApi extends BaseApi
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
28
        return $this->callApiUrl($url, []);
29
    }
30
31
    /**
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
40
        return $this->callApiUrl($url, []);
41
    }
42
43
    /**
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
52
        return $this->callApiUrl($url, []);
53
    }
54
55
    /**
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
64
        return $this->callApiUrl($url, []);
65
    }
66
}
67