Completed
Pull Request — master (#11)
by Tristan
19:07
created

LeagueApi   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 55
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getLeagueBySummonerId() 0 6 1
A getLeaguePositionsBySummonerId() 0 6 1
A getChallengerLeagues() 0 6 1
A getMasterLeagues() 0 6 1
1
<?php
2
3
namespace LoLApi\Api;
4
5
use LoLApi\Result\ApiResult;
6
7
/**
8
 * Class LeagueApi
9
 *
10
 * @package LoLApi\Api
11
 * @see     https://developer.riotgames.com/api-methods/
12
 */
13
class LeagueApi extends BaseApi
14
{
15
    const API_URL_LEAGUE_BY_SUMMONER_ID = '/lol/league/v3/leagues/by-summoner/{summonerId}';
16
    const API_URL_LEAGUE_POSITION_BY_SUMMONER_ID = '/lol/league/v3/positions/by-summoner/{summonerId}';
17
    const API_URL_LEAGUE_CHALLENGER = '/lol/league/v3/challengerleagues/by-queue/{queue}';
18
    const API_URL_LEAGUE_MASTER = '/lol/league/v3/masterleagues/by-queue/{queue}';
19
20
    /**
21
     * @param int $summonerId
22
     *
23
     * @return ApiResult
24
     */
25
    public function getLeagueBySummonerId($summonerId)
26
    {
27 1
        $url = str_replace('{summonerId}', $summonerId, self::API_URL_LEAGUE_BY_SUMMONER_ID);
28
29 1
        return $this->callApiUrl($url, [], true);
0 ignored issues
show
Unused Code introduced by
The call to LeagueApi::callApiUrl() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
30
    }
31 1
32
    /**
33
     * @param int $summonerId
34
     *
35
     * @return ApiResult
36
     */
37
    public function getLeaguePositionsBySummonerId($summonerId)
38
    {
39 1
        $url = str_replace('{summonerIds}', $summonerId, self::API_URL_LEAGUE_POSITION_BY_SUMMONER_ID);
40
41 1
        return $this->callApiUrl($url, [], true);
0 ignored issues
show
Unused Code introduced by
The call to LeagueApi::callApiUrl() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
42
    }
43 1
44
    /**
45
     * @param string $gameQueueType (Can be RANKED_SOLO_5x5, RANKED_TEAM_3x3, RANKED_TEAM_5x5)
46
     *
47
     * @return ApiResult
48
     */
49
    public function getChallengerLeagues($gameQueueType)
50
    {
51 1
        $url = str_replace('{queue}', $gameQueueType, self::API_URL_LEAGUE_CHALLENGER);
52
53 1
        return $this->callApiUrl($url, [], true);
0 ignored issues
show
Unused Code introduced by
The call to LeagueApi::callApiUrl() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
54
    }
55 1
56
    /**
57
     * @param string $gameQueueType (Can be RANKED_SOLO_5x5, RANKED_TEAM_3x3, RANKED_TEAM_5x5)
58
     *
59
     * @return ApiResult
60
     */
61
    public function getMasterLeagues($gameQueueType)
62
    {
63 1
        $url = str_replace('{queue}', $gameQueueType, self::API_URL_LEAGUE_MASTER);
64
65 1
        return $this->callApiUrl($url, [], true);
0 ignored issues
show
Unused Code introduced by
The call to LeagueApi::callApiUrl() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
66
    }
67
}
68