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

@@ 13-67 (lines=55) @@
10
 * @package LoLApi\Api
11
 * @see     https://developer.riotgames.com/api-methods/
12
 */
13
class LeagueApi extends BaseApi
14
{
15
    const API_URL_LEAGUE_POSITION_BY_SUMMONER_ID = '/lol/league/v4/positions/by-summoner/{encryptedSummonerId}';
16
    const API_URL_LEAGUE_CHALLENGER = '/lol/league/v4/challengerleagues/by-queue/{queue}';
17
    const API_URL_LEAGUE_MASTER = '/lol/league/v4/masterleagues/by-queue/{queue}';
18
    const API_URL_LEAGUE_GRAND_MASTER = '/lol/league/v4/grandmasterleagues/by-queue/{queue}';
19
20
    /**
21
     * @param int $summonerId
22
     *
23
     * @return ApiResult
24
     */
25
    public function getLeaguePositionsBySummonerId($summonerId)
26
    {
27
        $url = str_replace('{encryptedSummonerId}', $summonerId, self::API_URL_LEAGUE_POSITION_BY_SUMMONER_ID);
28
29
        return $this->callApiUrl($url, []);
30
    }
31
32
    /**
33
     * @param string $gameQueueType (Can be RANKED_SOLO_5x5, RANKED_FLEX_SR, RANKED_FLEX_TT)
34
     *
35
     * @return ApiResult
36
     */
37
    public function getChallengerLeagues($gameQueueType)
38
    {
39
        $url = str_replace('{queue}', $gameQueueType, self::API_URL_LEAGUE_CHALLENGER);
40
41
        return $this->callApiUrl($url, []);
42
    }
43
44
    /**
45
     * @param string $gameQueueType (Can be RANKED_SOLO_5x5, RANKED_FLEX_SR, RANKED_FLEX_TT)
46
     *
47
     * @return ApiResult
48
     */
49
    public function getMasterLeagues($gameQueueType)
50
    {
51
        $url = str_replace('{queue}', $gameQueueType, self::API_URL_LEAGUE_MASTER);
52
53
        return $this->callApiUrl($url, []);
54
    }
55
56
    /**
57
     * @param string $gameQueueType (Can be RANKED_SOLO_5x5, RANKED_FLEX_SR, RANKED_FLEX_TT)
58
     *
59
     * @return ApiResult
60
     */
61
    public function getGrandMasterLeagues($gameQueueType)
62
    {
63
        $url = str_replace('{queue}', $gameQueueType, self::API_URL_LEAGUE_MASTER);
64
65
        return $this->callApiUrl($url, []);
66
    }
67
}
68