Completed
Push — master ( bd5cf0...67488c )
by Michaël
12s
created

SummonerApi::getSummonerBySummonerName()   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, []);
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, []);
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, []);
53
    }
54
}
55