Code Duplication    Length = 44-45 lines in 2 locations

src/ritero/SDK/TwitchTV/Methods/Channel.php 1 location

@@ 17-60 (lines=44) @@
14
 * @license https://github.com/jofner/Twitch-SDK/blob/master/LICENSE.md MIT
15
 * @homepage https://github.com/jofner/Twitch-SDK
16
 */
17
class Channel
18
{
19
    /** @var TwitchRequest */
20
    protected $request;
21
22
    const URI_CHANNEL_AUTH = 'channel';
23
    const URI_CHANNEL_EDITORS_AUTH = 'channels/%s/editors';
24
25
    public function __construct()
26
    {
27
        $this->request = new TwitchRequest;
28
    }
29
30
    /**
31
     * Get the authenticated channel
32
     *  - requires scope 'channel_read'
33
     * @see https://github.com/justintv/Twitch-API/blob/master/v3_resources/channels.md#get-channel
34
     * @param string $queryString
35
     * @return \stdClass
36
     * @throws TwitchException
37
     */
38
    public function getChannel($queryString)
39
    {
40
        $this->request->setApiVersion(3);
41
42
        return $this->request->request(self::URI_CHANNEL_AUTH . $queryString);
43
    }
44
45
    /**
46
     * Returns an array of users who are editors of specified channel
47
     *  - requires scope 'channel_read'
48
     * @see https://github.com/justintv/Twitch-API/blob/master/v3_resources/channels.md#get-channelschanneleditors
49
     * @param string $channel
50
     * @param string $queryString
51
     * @return \stdClass
52
     * @throws TwitchException
53
     */
54
    public function getEditors($channel, $queryString)
55
    {
56
        $this->request->setApiVersion(3);
57
58
        return $this->request->request(sprintf(self::URI_CHANNEL_EDITORS_AUTH, $channel) . $queryString);
59
    }
60
}
61

src/ritero/SDK/TwitchTV/Methods/Team.php 1 location

@@ 17-61 (lines=45) @@
14
 * @license https://github.com/jofner/Twitch-SDK/blob/master/LICENSE.md MIT
15
 * @homepage https://github.com/jofner/Twitch-SDK
16
 */
17
class Team
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