Code Duplication    Length = 12-16 lines in 8 locations

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

@@ 134-146 (lines=13) @@
131
     * @return \stdClass
132
     * @throws TwitchException
133
     */
134
    public function userFollowChannels($user, $limit = null, $offset = null, $direction = null, $sortby = null)
135
    {
136
        $queryString = $this->helper->buildQueryString(array(
137
            'limit' => $limit,
138
            'offset' => $offset,
139
            'direction' => $direction,
140
            'sortby' => $sortby,
141
        ));
142
143
        $follow = new Methods\Follow($this->request);
144
145
        return $follow->userFollowChannels($user, $queryString);
146
    }
147
148
    /**
149
     * Get the status of a follow relationship
@@ 238-249 (lines=12) @@
235
     * @return \stdClass
236
     * @throws TwitchException
237
     */
238
    public function channelSearch($query, $limit = null, $offset = null)
239
    {
240
        $queryString = $this->helper->buildQueryString(array(
241
            'query' => $query,
242
            'limit' => $limit,
243
            'offset' => $offset,
244
        ));
245
246
        $search = new Methods\Search($this->request);
247
248
        return $search->channels($queryString);
249
    }
250
251
    /**
252
     * Get the specified team
@@ 304-316 (lines=13) @@
301
     * @return \stdClass
302
     * @throws TwitchException
303
     */
304
    public function channelFollows($channelName, $limit = null, $offset = null, $cursor = null, $direction = null)
305
    {
306
        $queryString = $this->helper->buildQueryString(array(
307
            'limit' => $limit,
308
            'offset' => $offset,
309
            'cursor' => $cursor,
310
            'direction' => $direction,
311
        ));
312
313
        $follow = new Methods\Follow($this->request);
314
315
        return $follow->getChannelFollows($channelName, $queryString);
316
    }
317
318
    /**
319
     * Get the specified channel's stream
@@ 362-377 (lines=16) @@
359
     * @return \stdClass
360
     * @throws TwitchException
361
     */
362
    public function streamsSummarize($game = null, array $channels = null, $hls = null)
363
    {
364
        if (!empty($channels)) {
365
            $channels = implode(',', $channels);
366
        }
367
368
        $queryString = $this->helper->buildQueryString(array(
369
            'game' => $game,
370
            'channel' => $channels,
371
            'hls' => $hls,
372
        ));
373
374
        $stream = new Methods\Stream($this->request);
375
376
        return $stream->getSummary($queryString);
377
    }
378
379
    /**
380
     * Get featured streams
@@ 387-398 (lines=12) @@
384
     * @return \stdClass
385
     * @throws TwitchException
386
     */
387
    public function streamsFeatured($limit = null, $offset = null, $hls = null)
388
    {
389
        $queryString = $this->helper->buildQueryString(array(
390
            'limit' => $limit,
391
            'offset' => $offset,
392
            'hls' => $hls,
393
        ));
394
395
        $stream = new Methods\Stream($this->request);
396
397
        return $stream->getFeatured($queryString);
398
    }
399
400
    /**
401
     * Get streams by channel
@@ 456-468 (lines=13) @@
453
     * @return \stdClass
454
     * @throws TwitchException
455
     */
456
    public function videosTop($limit = null, $offset = null, $game = null, $period = null)
457
    {
458
        $queryString = $this->helper->buildQueryString(array(
459
            'limit' => $limit,
460
            'offset' => $offset,
461
            'game' => $game,
462
            'period' => $period,
463
        ));
464
465
        $video = new Methods\Video($this->request);
466
467
        return $video->getTop($queryString);
468
    }
469
470
    /**
471
     * Get videos for a channel
@@ 480-492 (lines=13) @@
477
     * @return \stdClass
478
     * @throws TwitchException
479
     */
480
    public function videosByChannel($channel, $limit = null, $offset = null, $broadcasts = null, $hls = null)
481
    {
482
        $queryString = $this->helper->buildQueryString(array(
483
            'limit' => $limit,
484
            'offset' => $offset,
485
            'broadcasts' => $broadcasts,
486
            'hls' => $hls,
487
        ));
488
489
        $video = new Methods\Video($this->request);
490
491
        return $video->getChannelVideos($channel, $queryString);
492
    }
493
494
    /**
495
     * Returns a links object to all other chat endpoints
@@ 576-587 (lines=12) @@
573
     * @return \stdClass
574
     * @throws TwitchException
575
     */
576
    public function gameSearch($query, $type = null, $live = null)
577
    {
578
        $queryString = $this->helper->buildQueryString(array(
579
            'query' => $query,
580
            'type' => $type,
581
            'live' => $live,
582
        ));
583
584
        $search = new Methods\Search($this->request);
585
586
        return $search->games($queryString);
587
    }
588
589
    /**
590
     * Get HTML code for stream embedding