ChampionMasteryApi::getChampionsMasteriesScore()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 6
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 6
loc 6
ccs 3
cts 3
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 ChampionMasteryApi
9
 *
10
 * @package LoLApi\Api
11
 * @see     https://developer.riotgames.com/api-methods/
12
 */
13 View Code Duplication
class ChampionMasteryApi 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...
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 1
    {
28
        $url = str_replace('{summonerId}', $summonerId, self::API_URL_CHAMPION_MASTERY_BY_ID);
29 1
30 1
        return $this->callApiUrl($url, []);
31 1
    }
32
33 1
    /**
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 1
        $url = str_replace('{championId}', $championId, $url);
43
44 1
        return $this->callApiUrl($url, []);
45 1
    }
46
47 1
    /**
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 1
        $url = str_replace('{playerId}', $summonerId, self::API_URL_CHAMPION_MASTERY_SCORE);
57
58 1
        return $this->callApiUrl($url, []);
59 1
    }
60
}
61