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

MatchApi   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 95
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 0
loc 95
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getMatchByMatchId() 0 6 1
A getMatchListByAccountId() 0 15 1
A getLastMatchlistByAccountId() 0 4 1
A getTimelineByMatchId() 0 4 1
A getMatchIdByTournamentCode() 0 4 1
A getMatchByMatchIdAndTournamentCode() 0 4 1
1
<?php
2
3
namespace LoLApi\Api;
4
5
use LoLApi\Result\ApiResult;
6
7
/**
8
 * Class MatchApi
9
 *
10
 * @package LoLApi\Api
11
 * @see     https://developer.riotgames.com/api-methods/
12
 */
13
class MatchApi extends BaseApi
14
{
15
    const API_URL_MATCH_BY_ID = '/lol/match/v3/matches/{matchId}';
16
    const API_URL_MATCH_LIST_BY_ACCOUNT = '/lol/match/v3/matchlists/by-account/{accountId}';
17
    const API_URL_RECENT_MATCH_LIST_BY_ACCOUNT = '/lol/match/v3/matchlists/by-account/{accountId}/recent';
18
    const API_URL_TIMELINES_BY_MATCH_ID = '/lol/match/v3/timelines/by-match/{matchId}';
19
    const API_URL_MATCH_ID_BY_TOURNAMENT_CODE = '/lol/match/v3/matches/by-tournament-code/{tournamentCode}/ids';
20
    const API_URL_MATCH_BY_MATCH_ID_AND_TOURNAMENT_CODE = '/lol/match/v3/matches/{matchId}/by-tournament-code/{tournamentCode}';
21
22
    /**
23 1
     * @param int $matchId
24
     *
25 1
     * @return ApiResult
26 1
     */
27
    public function getMatchByMatchId($matchId)
28 1
    {
29
        $url = str_replace('{matchId}', $matchId, self::API_URL_MATCH_BY_ID);
30 1
31
        return $this->callApiUrl($url, [], true);
0 ignored issues
show
Unused Code introduced by
The call to MatchApi::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...
32
    }
33
34
    /**
35
     * @param int   $accountId
36
     * @param array $championIds
37
     * @param array $rankedQueues
38
     * @param array $seasons
39
     * @param int   $beginTime
40
     * @param int   $endTime
41
     * @param int   $beginIndex
42
     * @param int   $endIndex
43
     *
44
     * @return ApiResult
45
     */
46
    public function getMatchListByAccountId($accountId, array $championIds = [], array $rankedQueues = [], array $seasons = [], $beginTime = null, $endTime = null, $beginIndex = null, $endIndex = null)
47
    {
48
        $url             = str_replace('{accountId}', $accountId, self::API_URL_MATCH_LIST_BY_ACCOUNT);
49
        $queryParameters = [];
50
51
        $queryParameters['championIds']  = implode(',', $championIds);
52
        $queryParameters['rankedQueues'] = implode(',', $rankedQueues);
53
        $queryParameters['seasons']      = implode(',', $seasons);
54
        $queryParameters['beginTime']    = $beginTime;
55
        $queryParameters['endTime']      = $endTime;
56
        $queryParameters['beginIndex']   = $beginIndex;
57
        $queryParameters['endIndex']     = $endIndex;
58
59
        return $this->callApiUrl($url, array_filter($queryParameters));
60
    }
61
62
63
    /**
64
     * Get matchlist for last 20 matches played on given account ID and platform ID.
65
     *
66
     * @throws \Exception
67
     */
68
    public function getLastMatchlistByAccountId()
69
    {
70
        throw new \Exception("Method not implemented yet");
71
    }
72
73
    /**
74
     * Get match timeline by match ID.
75
     *
76
     * @throws \Exception
77
     */
78
    public function getTimelineByMatchId()
79
    {
80
        throw new \Exception("Method not implemented yet");
81
    }
82
83
    /**
84
     * Get match IDs by tournament code.
85
     *
86
     * @param string $tournamentCode
87
     *
88
     * @throws \Exception
89
     */
90
    public function getMatchIdByTournamentCode($tournamentCode)
0 ignored issues
show
Unused Code introduced by
The parameter $tournamentCode is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
91
    {
92
        throw new \Exception("Method not implemented yet");
93
    }
94
95
    /**
96
     * Get match by match ID and tournament code.
97
     *
98
     * @param int    $matchId
99
     * @param string $tournamentCode
100
     *
101
     * @throws \Exception
102
     */
103
    public function getMatchByMatchIdAndTournamentCode($matchId, $tournamentCode)
0 ignored issues
show
Unused Code introduced by
The parameter $matchId is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $tournamentCode is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
104
    {
105
        throw new \Exception("Method not implemented yet");
106
    }
107
}
108