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

SummonerApi::getSummonerBySummonerId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 2
cts 2
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace LoLApi\Api;
4
5
use LoLApi\Result\ApiResult;
6
7
/**
8
 * Class SummonerApi
9
 *
10
 * @package LoLApi\Api
11
 * @see     https://developer.riotgames.com/api-methods/
12
 */
13
class SummonerApi extends BaseApi
14
{
15
    const API_URL_SUMMONER_BY_NAME = '/lol/summoner/v3/summoners/by-name/{summonerName}';
16
    const API_URL_SUMMONER_BY_ID = '/lol/summoner/v3/summoners/{summonerId}';
17
    const API_URL_SUMMONER_BY_ACCOUNT_ID = '/lol/summoner/v3/summoners/by-account/{accountId}';
18
19
    /**
20
     * @param string $summonerName
21
     *
22
     * @return ApiResult
23
     */
24
    public function getSummonerBySummonerName($summonerName)
25
    {
26 1
        $url = str_replace('{summonerName}', $summonerName, self::API_URL_SUMMONER_BY_NAME);
27
28 1
        return $this->callApiUrl($url, [], true);
0 ignored issues
show
Unused Code introduced by
The call to SummonerApi::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...
29
    }
30 1
31
    /**
32
     * @param string $summonerId
33
     *
34
     * @return ApiResult
35
     */
36
    public function getSummonerBySummonerId($summonerId)
37
    {
38 1
        $url = str_replace('{summonerId}', $summonerId, self::API_URL_SUMMONER_BY_ID);
39
40 1
        return $this->callApiUrl($url, [], true);
0 ignored issues
show
Unused Code introduced by
The call to SummonerApi::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...
41
    }
42 1
43
    /**
44
     * @param string $accountId
45
     *
46
     * @return ApiResult
47
     */
48
    public function getSummonerByAccountId($accountId)
49
    {
50 5
        $url = str_replace('{accountId}', $accountId, self::API_URL_SUMMONER_BY_ACCOUNT_ID);
51
52 1
        return $this->callApiUrl($url, [], true);
0 ignored issues
show
Unused Code introduced by
The call to SummonerApi::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...
53
    }
54
}
55