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

SpectatorApi::getFeaturedGames()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 4
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace LoLApi\Api;
4
5
use LoLApi\Result\ApiResult;
6
7
/**
8
 * Class FeaturedGamesApi
9
 *
10
 * @package LoLApi\Api
11
 * @see     https://developer.riotgames.com/api-methods/
12
 */
13 View Code Duplication
class SpectatorApi extends BaseApi
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
{
15
    const API_URL_SPECTATOR_FEATURED = '/lol/spectator/v3/featured-games';
16
    const API_URL_CURRENT_GAME_BY_SUMMONER_ID = '/lol/spectator/v3/active-games/by-summoner/{summonerId}';
17
18
    /**
19
     * @return ApiResult
20
     */
21
    public function getFeaturedGames()
22
    {
23
        return $this->callApiUrl(self::API_URL_SPECTATOR_FEATURED, [], true);
0 ignored issues
show
Unused Code introduced by
The call to SpectatorApi::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...
24
    }
25
26
    /**
27
     * @param string $summonerId
28
     *
29
     * @return ApiResult
30
     */
31
    public function getCurrentGameByPlatformIdAndSummonerId($summonerId)
32
    {
33
        $url = str_replace('{summonerId}', $summonerId, self::API_URL_CURRENT_GAME_BY_SUMMONER_ID);
34
35
        return $this->callApiUrl($url, [], true);
0 ignored issues
show
Unused Code introduced by
The call to SpectatorApi::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...
36
    }
37
}
38