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
@@ 242-253 (lines=12) @@
239
     * @return \stdClass
240
     * @throws TwitchException
241
     */
242
    public function channelSearch($query, $limit = null, $offset = null)
243
    {
244
        $queryString = $this->helper->buildQueryString(array(
245
            'query' => $query,
246
            'limit' => $limit,
247
            'offset' => $offset,
248
        ));
249
250
        $search = new Methods\Search($this->request);
251
252
        return $search->channels($queryString);
253
    }
254
255
    /**
256
     * Get the specified team
@@ 308-320 (lines=13) @@
305
     * @return \stdClass
306
     * @throws TwitchException
307
     */
308
    public function channelFollows($channelName, $limit = null, $offset = null, $cursor = null, $direction = null)
309
    {
310
        $queryString = $this->helper->buildQueryString(array(
311
            'limit' => $limit,
312
            'offset' => $offset,
313
            'cursor' => $cursor,
314
            'direction' => $direction,
315
        ));
316
317
        $follow = new Methods\Follow($this->request);
318
319
        return $follow->getChannelFollows($channelName, $queryString);
320
    }
321
322
    /**
323
     * Get the specified channel's stream
@@ 366-381 (lines=16) @@
363
     * @return \stdClass
364
     * @throws TwitchException
365
     */
366
    public function streamsSummarize($game = null, array $channels = null, $hls = null)
367
    {
368
        if (!empty($channels)) {
369
            $channels = implode(',', $channels);
370
        }
371
372
        $queryString = $this->helper->buildQueryString(array(
373
            'game' => $game,
374
            'channel' => $channels,
375
            'hls' => $hls,
376
        ));
377
378
        $stream = new Methods\Stream($this->request);
379
380
        return $stream->getSummary($queryString);
381
    }
382
383
    /**
384
     * Get featured streams
@@ 391-402 (lines=12) @@
388
     * @return \stdClass
389
     * @throws TwitchException
390
     */
391
    public function streamsFeatured($limit = null, $offset = null, $hls = null)
392
    {
393
        $queryString = $this->helper->buildQueryString(array(
394
            'limit' => $limit,
395
            'offset' => $offset,
396
            'hls' => $hls,
397
        ));
398
399
        $stream = new Methods\Stream($this->request);
400
401
        return $stream->getFeatured($queryString);
402
    }
403
404
    /**
405
     * Get video
@@ 426-438 (lines=13) @@
423
     * @return \stdClass
424
     * @throws TwitchException
425
     */
426
    public function videosTop($limit = null, $offset = null, $game = null, $period = null)
427
    {
428
        $queryString = $this->helper->buildQueryString(array(
429
            'limit' => $limit,
430
            'offset' => $offset,
431
            'game' => $game,
432
            'period' => $period,
433
        ));
434
435
        $video = new Methods\Video($this->request);
436
437
        return $video->getTop($queryString);
438
    }
439
440
    /**
441
     * Get videos for a channel
@@ 450-462 (lines=13) @@
447
     * @return \stdClass
448
     * @throws TwitchException
449
     */
450
    public function videosByChannel($channel, $limit = null, $offset = null, $broadcasts = null, $hls = null)
451
    {
452
        $queryString = $this->helper->buildQueryString(array(
453
            'limit' => $limit,
454
            'offset' => $offset,
455
            'broadcasts' => $broadcasts,
456
            'hls' => $hls,
457
        ));
458
459
        $video = new Methods\Video($this->request);
460
461
        return $video->getChannelVideos($channel, $queryString);
462
    }
463
464
    /**
465
     * Returns a links object to all other chat endpoints
@@ 546-557 (lines=12) @@
543
     * @return \stdClass
544
     * @throws TwitchException
545
     */
546
    public function gameSearch($query, $type = null, $live = null)
547
    {
548
        $queryString = $this->helper->buildQueryString(array(
549
            'query' => $query,
550
            'type' => $type,
551
            'live' => $live,
552
        ));
553
554
        $search = new Methods\Search($this->request);
555
556
        return $search->games($queryString);
557
    }
558
559
    /**
560
     * Get HTML code for stream embedding