CurrentGameEndpoints   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 5
c 1
b 0
f 0
dl 0
loc 58
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A currentGameQuit() 0 3 1
A currentGameMatch() 0 3 1
A currentGameLoadouts() 0 3 1
A currentGamePlayer() 0 3 1
1
<?php
2
3
namespace Seaony\ValorantApi\Endpoints;
4
5
trait CurrentGameEndpoints
6
{
7
    /**
8
     * Get the current game match ID for the provided player
9
     *
10
     * @param  string  $shard
11
     * @param  string  $region
12
     * @param  string  $puuid
13
     *
14
     * @return mixed
15
     */
16
    public function currentGamePlayer(string $shard, string $region, string $puuid)
17
    {
18
        return $this->request('GET', "https://glz-{$region}-1.{$shard}.a.pvp.net/core-game/v1/players/{$puuid}");
0 ignored issues
show
Bug introduced by
It seems like request() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
        return $this->/** @scrutinizer ignore-call */ request('GET', "https://glz-{$region}-1.{$shard}.a.pvp.net/core-game/v1/players/{$puuid}");
Loading history...
19
    }
20
21
    /**
22
     * Get the current game match info
23
     *
24
     * @param  string  $shard
25
     * @param  string  $region
26
     * @param  string  $currentGameMatchId
27
     *
28
     * @return mixed|\Psr\Http\Message\ResponseInterface
29
     * @throws \GuzzleHttp\Exception\GuzzleException
30
     */
31
    public function currentGameMatch(string $shard, string $region, string $currentGameMatchId)
32
    {
33
        return $this->request('GET', "https://glz-{$region}-1.{$shard}.a.pvp.net/core-game/v1/matches/{$currentGameMatchId}");
34
    }
35
36
    /**
37
     * @param  string  $shard
38
     * @param  string  $region
39
     * @param  string  $currentGameMatchId
40
     *
41
     * @return mixed|\Psr\Http\Message\ResponseInterface
42
     * @throws \GuzzleHttp\Exception\GuzzleException
43
     */
44
    public function currentGameLoadouts(string $shard, string $region, string $currentGameMatchId)
45
    {
46
        return $this->request('GET', "https://glz-{$region}-1.{$shard}.a.pvp.net/core-game/v1/matches/{$currentGameMatchId}/loadouts");
47
    }
48
49
    /**
50
     * Quits the current game
51
     *
52
     * @param  string  $shard
53
     * @param  string  $region
54
     * @param  string  $puuid
55
     * @param  string  $currentGameMatchId
56
     *
57
     * @return mixed|\Psr\Http\Message\ResponseInterface
58
     * @throws \GuzzleHttp\Exception\GuzzleException
59
     */
60
    public function currentGameQuit(string $shard, string $region, string $puuid, string $currentGameMatchId)
61
    {
62
        return $this->request('POST', "https://glz-{$region}-1.{$shard}.a.pvp.net/core-game/v1/players/{$puuid}/disassociate/{$currentGameMatchId}");
63
    }
64
65
}