Completed
Push — develop ( 088525...bfb93a )
by Josef
01:55
created

Search::streams()   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
c 1
b 0
f 0
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace jofner\SDK\TwitchTV\Methods;
4
5
use jofner\SDK\TwitchTV\TwitchException;
6
use jofner\SDK\TwitchTV\TwitchRequest;
7
8
/**
9
 * Search method class for TwitchTV API SDK for PHP
10
 *
11
 * @author Josef Ohnheiser <[email protected]>
12
 * @license https://github.com/jofner/Twitch-SDK/blob/master/LICENSE.md MIT
13
 * @homepage https://github.com/jofner/Twitch-SDK
14
 */
15 View Code Duplication
class Search
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...
16
{
17
    /** @var TwitchRequest */
18
    protected $request;
19
20
    const URI_SEARCH_CHANNELS = 'search/channels';
21
    const URI_SEARCH_STREAMS = 'search/streams';
22
    const URI_SEARCH_GAMES = 'search/games';
23
24
    /**
25
     * Search constructor
26
     * @param TwitchRequest $request
27
     */
28
    public function __construct(TwitchRequest $request)
29
    {
30
        $this->request = $request;
31
    }
32
33
    /**
34
     * Search for channel
35
     * @see https://github.com/justintv/Twitch-API/blob/master/v3_resources/search.md#get-searchchannels
36
     * @param string $queryString
37
     * @return \stdClass
38
     * @throws TwitchException
39
     */
40
    public function channels($queryString)
41
    {
42
        return $this->request->request(self::URI_SEARCH_CHANNELS . $queryString);
43
    }
44
45
    /**
46
     * Search streams
47
     * @see https://github.com/justintv/Twitch-API/blob/master/v3_resources/search.md#get-searchstreams
48
     * @param string $queryString
49
     * @return \stdClass
50
     * @throws TwitchException
51
     */
52
    public function streams($queryString)
53
    {
54
        return $this->request->request(self::URI_SEARCH_STREAMS . $queryString);
55
    }
56
57
    /**
58
     * Search games
59
     * @see https://github.com/justintv/Twitch-API/blob/master/v3_resources/search.md#get-searchgames
60
     * @param string $queryString
61
     * @return \stdClass
62
     * @throws TwitchException
63
     */
64
    public function games($queryString)
65
    {
66
        return $this->request->request(self::URI_SEARCH_STREAMS . $queryString);
67
    }
68
}
69