Code Duplication    Length = 12-16 lines in 8 locations

src/jofner/SDK/TwitchTV/TwitchSDK.php 8 locations

@@ 131-143 (lines=13) @@
128
     * @return \stdClass
129
     * @throws TwitchException
130
     */
131
    public function userFollowChannels($user, $limit = null, $offset = null, $direction = null, $sortby = null)
132
    {
133
        $queryString = $this->helper->buildQueryString(array(
134
            'limit' => $limit,
135
            'offset' => $offset,
136
            'direction' => $direction,
137
            'sortby' => $sortby,
138
        ));
139
140
        $follow = new Methods\Follow($this->request);
141
142
        return $follow->userFollowChannels($user, $queryString);
143
    }
144
145
    /**
146
     * Get the status of a follow relationship
@@ 239-250 (lines=12) @@
236
     * @return \stdClass
237
     * @throws TwitchException
238
     */
239
    public function channelSearch($query, $limit = null, $offset = null)
240
    {
241
        $queryString = $this->helper->buildQueryString(array(
242
            'query' => $query,
243
            'limit' => $limit,
244
            'offset' => $offset,
245
        ));
246
247
        $search = new Methods\Search($this->request);
248
249
        return $search->channels($queryString);
250
    }
251
252
    /**
253
     * Get the specified team
@@ 305-317 (lines=13) @@
302
     * @return \stdClass
303
     * @throws TwitchException
304
     */
305
    public function channelFollows($channelName, $limit = null, $offset = null, $cursor = null, $direction = null)
306
    {
307
        $queryString = $this->helper->buildQueryString(array(
308
            'limit' => $limit,
309
            'offset' => $offset,
310
            'cursor' => $cursor,
311
            'direction' => $direction,
312
        ));
313
314
        $follow = new Methods\Follow($this->request);
315
316
        return $follow->getChannelFollows($channelName, $queryString);
317
    }
318
319
    /**
320
     * Get the specified channel's stream
@@ 363-378 (lines=16) @@
360
     * @return \stdClass
361
     * @throws TwitchException
362
     */
363
    public function streamsSummarize($game = null, array $channels = null, $hls = null)
364
    {
365
        if (!empty($channels)) {
366
            $channels = implode(',', $channels);
367
        }
368
369
        $queryString = $this->helper->buildQueryString(array(
370
            'game' => $game,
371
            'channel' => $channels,
372
            'hls' => $hls,
373
        ));
374
375
        $stream = new Methods\Stream($this->request);
376
377
        return $stream->getSummary($queryString);
378
    }
379
380
    /**
381
     * Get featured streams
@@ 388-399 (lines=12) @@
385
     * @return \stdClass
386
     * @throws TwitchException
387
     */
388
    public function streamsFeatured($limit = null, $offset = null, $hls = null)
389
    {
390
        $queryString = $this->helper->buildQueryString(array(
391
            'limit' => $limit,
392
            'offset' => $offset,
393
            'hls' => $hls,
394
        ));
395
396
        $stream = new Methods\Stream($this->request);
397
398
        return $stream->getFeatured($queryString);
399
    }
400
401
    /**
402
     * Get video
@@ 423-435 (lines=13) @@
420
     * @return \stdClass
421
     * @throws TwitchException
422
     */
423
    public function videosTop($limit = null, $offset = null, $game = null, $period = null)
424
    {
425
        $queryString = $this->helper->buildQueryString(array(
426
            'limit' => $limit,
427
            'offset' => $offset,
428
            'game' => $game,
429
            'period' => $period,
430
        ));
431
432
        $video = new Methods\Video($this->request);
433
434
        return $video->getTop($queryString);
435
    }
436
437
    /**
438
     * Get videos for a channel
@@ 447-459 (lines=13) @@
444
     * @return \stdClass
445
     * @throws TwitchException
446
     */
447
    public function videosByChannel($channel, $limit = null, $offset = null, $broadcasts = null, $hls = null)
448
    {
449
        $queryString = $this->helper->buildQueryString(array(
450
            'limit' => $limit,
451
            'offset' => $offset,
452
            'broadcasts' => $broadcasts,
453
            'hls' => $hls,
454
        ));
455
456
        $video = new Methods\Video($this->request);
457
458
        return $video->getChannelVideos($channel, $queryString);
459
    }
460
461
    /**
462
     * Returns a links object to all other chat endpoints
@@ 543-554 (lines=12) @@
540
     * @return \stdClass
541
     * @throws TwitchException
542
     */
543
    public function gameSearch($query, $type = null, $live = null)
544
    {
545
        $queryString = $this->helper->buildQueryString(array(
546
            'query' => $query,
547
            'type' => $type,
548
            'live' => $live,
549
        ));
550
551
        $search = new Methods\Search($this->request);
552
553
        return $search->games($queryString);
554
    }
555
556
    /**
557
     * Get HTML code for stream embedding