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_SUMMONERS_IDS = '/api/lol/{region}/v2.5/league/by-summoner/{summonerIds}'; |
16
|
|
|
const API_URL_LEAGUE_ENTRIES_BY_SUMMONERS_IDS = '/api/lol/{region}/v2.5/league/by-summoner/{summonerIds}/entry'; |
17
|
|
|
const API_URL_LEAGUE_CHALLENGER = '/api/lol/{region}/v2.5/league/challenger'; |
18
|
|
|
const API_URL_LEAGUE_MASTER = '/api/lol/{region}/v2.5/league/master'; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @param array $summonerIds |
22
|
|
|
* |
23
|
|
|
* @return ApiResult |
24
|
|
|
*/ |
25
|
|
|
public function getLeagueBySummonersIds(array $summonerIds = []) |
26
|
|
|
{ |
27
|
1 |
|
$url = str_replace('{summonerIds}', implode(',', $summonerIds), self::API_URL_LEAGUE_BY_SUMMONERS_IDS); |
28
|
|
|
|
29
|
1 |
|
return $this->callApiUrl($url, []); |
30
|
|
|
} |
31
|
1 |
|
|
32
|
|
|
/** |
33
|
|
|
* @param array $summonerIds |
34
|
|
|
* |
35
|
|
|
* @return ApiResult |
36
|
|
|
*/ |
37
|
|
|
public function getLeagueEntriesBySummonersIds(array $summonerIds = []) |
38
|
|
|
{ |
39
|
1 |
|
$url = str_replace('{summonerIds}', implode(',', $summonerIds), self::API_URL_LEAGUE_ENTRIES_BY_SUMMONERS_IDS); |
40
|
|
|
|
41
|
1 |
|
return $this->callApiUrl($url, []); |
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 |
|
return $this->callApiUrl(self::API_URL_LEAGUE_CHALLENGER, ['type' => $gameQueueType]); |
52
|
|
|
} |
53
|
1 |
|
|
54
|
|
|
/** |
55
|
1 |
|
* @param string $gameQueueType (Can be RANKED_SOLO_5x5, RANKED_TEAM_3x3, RANKED_TEAM_5x5) |
56
|
|
|
* |
57
|
|
|
* @return ApiResult |
58
|
|
|
*/ |
59
|
|
|
public function getMasterLeagues($gameQueueType) |
60
|
|
|
{ |
61
|
|
|
return $this->callApiUrl(self::API_URL_LEAGUE_MASTER, ['type' => $gameQueueType]); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|