Completed
Push — develop ( 08fdc8...0ae162 )
by Josef
01:54
created

Team::getTeam()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 6
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace ritero\SDK\TwitchTV\Methods;
4
5
use ritero\SDK\TwitchTV\TwitchRequest;
6
use ritero\SDK\TwitchTV\TwitchException;
7
8
/**
9
 * TwitchTV API SDK for PHP
10
 *
11
 * Teams method class
12
 *
13
 * @author Josef Ohnheiser <[email protected]>
14
 * @license https://github.com/jofner/Twitch-SDK/blob/master/LICENSE.md MIT
15
 * @homepage https://github.com/jofner/Twitch-SDK
16
 */
17 View Code Duplication
class Team
1 ignored issue
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...
18
{
19
    /** @var TwitchRequest */
20
    protected $request;
21
22
    const URI_TEAM = 'teams/';
23
    const URI_TEAMS = 'teams';
24
25
    /**
26
     * Team constructor
27
     * @param TwitchRequest $request
28
     */
29
    public function __construct(TwitchRequest $request)
30
    {
31
        $this->request = $request;
32
    }
33
34
    /**
35
     * Get the specified team
36
     * @see https://github.com/justintv/Twitch-API/blob/master/v3_resources/teams.md#get-teamsteam
37
     * @param string $team
38
     * @return \stdClass
39
     * @throws TwitchException
40
     */
41
    public function getTeam($team)
42
    {
43
        $this->request->setApiVersion(3);
44
45
        return $this->request->request(self::URI_TEAM . $team);
46
    }
47
48
    /**
49
     * Returns a list of active teams
50
     * @see https://github.com/justintv/Twitch-API/blob/master/v3_resources/teams.md#get-teams
51
     * @param $queryString
52
     * @return \stdClass
53
     * @throws TwitchException
54
     */
55
    public function getTeams($queryString)
56
    {
57
        $this->request->setApiVersion(3);
58
59
        return $this->request->request(self::URI_TEAMS . $queryString);
60
    }
61
}
62