Code Duplication    Length = 12-16 lines in 7 locations

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

@@ 140-152 (lines=13) @@
137
     * @return \stdClass
138
     * @throws TwitchSDKException
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
@@ 314-326 (lines=13) @@
311
     * @return \stdClass
312
     * @throws TwitchSDKException
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
@@ 350-362 (lines=13) @@
347
     * @return \stdClass
348
     * @throws TwitchSDKException
349
     */
350
    public function streamSearch($query, $limit = null, $offset = null, $hls = null)
351
    {
352
        $queryString = $this->helper->buildQueryString(array(
353
            'query' => $query,
354
            'limit' => $limit,
355
            'offset' => $offset,
356
            'hls' => $hls,
357
        ));
358
359
        $search = new Methods\Search($this->request);
360
361
        return $search->streams($queryString);
362
    }
363
364
    /**
365
     * Summarize streams
@@ 372-387 (lines=16) @@
369
     * @return \stdClass
370
     * @throws TwitchSDKException
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 TwitchSDKException
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 TwitchSDKException
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 TwitchSDKException
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