Code Duplication    Length = 12-16 lines in 8 locations

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

@@ 140-152 (lines=13) @@
137
     * @return \stdClass
138
     * @throws TwitchException
139
     */
140
    public function userFollowChannels($user, $limit = null, $offset = null, $direction = null, $sortby = null)
141
    {
142
        $queryString = $this->helper->buildQueryString(array(
143
            'limit' => $limit,
144
            'offset' => $offset,
145
            'direction' => $direction,
146
            'sortby' => $sortby,
147
        ));
148
149
        $follow = new Methods\Follow($this->request);
150
151
        return $follow->userFollowChannels($user, $queryString);
152
    }
153
154
    /**
155
     * Get the status of a follow relationship
@@ 248-259 (lines=12) @@
245
     * @return \stdClass
246
     * @throws TwitchException
247
     */
248
    public function channelSearch($query, $limit = null, $offset = null)
249
    {
250
        $queryString = $this->helper->buildQueryString(array(
251
            'query' => $query,
252
            'limit' => $limit,
253
            'offset' => $offset,
254
        ));
255
256
        $search = new Methods\Search($this->request);
257
258
        return $search->channels($queryString);
259
    }
260
261
    /**
262
     * Get the specified team
@@ 314-326 (lines=13) @@
311
     * @return \stdClass
312
     * @throws TwitchException
313
     */
314
    public function channelFollows($channelName, $limit = null, $offset = null, $cursor = null, $direction = null)
315
    {
316
        $queryString = $this->helper->buildQueryString(array(
317
            'limit' => $limit,
318
            'offset' => $offset,
319
            'cursor' => $cursor,
320
            'direction' => $direction,
321
        ));
322
323
        $follow = new Methods\Follow($this->request);
324
325
        return $follow->getChannelFollows($channelName, $queryString);
326
    }
327
328
    /**
329
     * Get the specified channel's stream
@@ 372-387 (lines=16) @@
369
     * @return \stdClass
370
     * @throws TwitchException
371
     */
372
    public function streamsSummarize($game = null, array $channels = null, $hls = null)
373
    {
374
        if (!empty($channels)) {
375
            $channels = implode(',', $channels);
376
        }
377
378
        $queryString = $this->helper->buildQueryString(array(
379
            'game' => $game,
380
            'channel' => $channels,
381
            'hls' => $hls,
382
        ));
383
384
        $stream = new Methods\Stream($this->request);
385
386
        return $stream->getSummary($queryString);
387
    }
388
389
    /**
390
     * Get featured streams
@@ 397-408 (lines=12) @@
394
     * @return \stdClass
395
     * @throws TwitchException
396
     */
397
    public function streamsFeatured($limit = null, $offset = null, $hls = null)
398
    {
399
        $queryString = $this->helper->buildQueryString(array(
400
            'limit' => $limit,
401
            'offset' => $offset,
402
            'hls' => $hls,
403
        ));
404
405
        $stream = new Methods\Stream($this->request);
406
407
        return $stream->getFeatured($queryString);
408
    }
409
410
    /**
411
     * Get video
@@ 432-444 (lines=13) @@
429
     * @return \stdClass
430
     * @throws TwitchException
431
     */
432
    public function videosTop($limit = null, $offset = null, $game = null, $period = null)
433
    {
434
        $queryString = $this->helper->buildQueryString(array(
435
            'limit' => $limit,
436
            'offset' => $offset,
437
            'game' => $game,
438
            'period' => $period,
439
        ));
440
441
        $video = new Methods\Video($this->request);
442
443
        return $video->getTop($queryString);
444
    }
445
446
    /**
447
     * Get videos for a channel
@@ 456-468 (lines=13) @@
453
     * @return \stdClass
454
     * @throws TwitchException
455
     */
456
    public function videosByChannel($channel, $limit = null, $offset = null, $broadcasts = null, $hls = null)
457
    {
458
        $queryString = $this->helper->buildQueryString(array(
459
            'limit' => $limit,
460
            'offset' => $offset,
461
            'broadcasts' => $broadcasts,
462
            'hls' => $hls,
463
        ));
464
465
        $video = new Methods\Video($this->request);
466
467
        return $video->getChannelVideos($channel, $queryString);
468
    }
469
470
    /**
471
     * Returns a links object to all other chat endpoints
@@ 552-563 (lines=12) @@
549
     * @return \stdClass
550
     * @throws TwitchException
551
     */
552
    public function gameSearch($query, $type = null, $live = null)
553
    {
554
        $queryString = $this->helper->buildQueryString(array(
555
            'query' => $query,
556
            'type' => $type,
557
            'live' => $live,
558
        ));
559
560
        $search = new Methods\Search($this->request);
561
562
        return $search->games($queryString);
563
    }
564
565
    /**
566
     * Get HTML code for stream embedding