Code Duplication    Length = 14-15 lines in 6 locations

src/ritero/SDK/TwitchTV/TwitchSDK.php 6 locations

@@ 673-686 (lines=14) @@
670
     * @return \stdClass
671
     * @throws TwitchException
672
     */
673
    public function authUserGet($token)
674
    {
675
        if (count($this->config) === 0) {
676
            $this->configException();
677
        }
678
679
        $queryString = $this->helper->buildQueryString(array(
680
            'oauth_token' => $token,
681
            'client_id' => $this->getConfigParam('client_id'),
682
        ));
683
684
        $user = new Methods\User($this->request);
685
        return $user->getUserAuth($queryString);
686
    }
687
688
    /**
689
     * Get the authenticated channel
@@ 695-709 (lines=15) @@
692
     * @return \stdClass
693
     * @throws TwitchException
694
     */
695
    public function authChannelGet($token)
696
    {
697
        if (count($this->config) === 0) {
698
            $this->configException();
699
        }
700
701
        $queryString = $this->helper->buildQueryString(array(
702
            'oauth_token' => $token,
703
            'client_id' => $this->getConfigParam('client_id'),
704
        ));
705
706
        $channels = new Methods\Channel($this->request);
707
708
        return $channels->getChannel($queryString);
709
    }
710
711
    /**
712
     * Update channel's status or game
@@ 752-766 (lines=15) @@
749
     * @return \stdClass
750
     * @throws TwitchException
751
     */
752
    public function authChannelResetKey($token, $channelName)
753
    {
754
        if (count($this->config) === 0) {
755
            $this->configException();
756
        }
757
758
        $queryString = $this->helper->buildQueryString(array(
759
            'oauth_token' => $token,
760
            'client_id' => $this->getConfigParam('client_id'),
761
        ));
762
763
        $channel = new Methods\Channel($this->request);
764
765
        return $channel->resetStreamKey($channelName, $queryString);
766
    }
767
768
    /**
769
     * Returns an array of users who are editors of specified channel
@@ 776-790 (lines=15) @@
773
     * @return \stdClass
774
     * @throws TwitchException
775
     */
776
    public function authChannelEditors($token, $channel)
777
    {
778
        if (count($this->config) === 0) {
779
            $this->configException();
780
        }
781
782
        $queryString = $this->helper->buildQueryString(array(
783
            'oauth_token' => $token,
784
            'client_id' => $this->getConfigParam('client_id'),
785
        ));
786
787
        $channels = new Methods\Channel($this->request);
788
789
        return $channels->getEditors($channel, $queryString);
790
    }
791
792
    /**
793
     * Returns an array of subscriptions who are subscribed to specified channel
@@ 831-845 (lines=15) @@
828
     * @return \stdClass
829
     * @throws TwitchException
830
     */
831
    public function authSubscribedUser($token, $channel, $user)
832
    {
833
        if (count($this->config) === 0) {
834
            $this->configException();
835
        }
836
837
        $queryString = $this->helper->buildQueryString(array(
838
            'oauth_token' => $token,
839
            'client_id' => $this->getConfigParam('client_id'),
840
        ));
841
842
        $subscription = new Methods\Subscription($this->request);
843
844
        return $subscription->getSubscribedUser($channel, $user, $queryString);
845
    }
846
847
    /**
848
     * Returns a channel object that user subscribes to
@@ 856-870 (lines=15) @@
853
     * @return \stdClass
854
     * @throws TwitchException
855
     */
856
    public function authSubscribedToChannel($token, $user, $channel)
857
    {
858
        if (count($this->config) === 0) {
859
            $this->configException();
860
        }
861
862
        $queryString = $this->helper->buildQueryString(array(
863
            'oauth_token' => $token,
864
            'client_id' => $this->getConfigParam('client_id'),
865
        ));
866
867
        $subscription = new Methods\Subscription($this->request);
868
869
        return $subscription->getSubscribedToChannel($user, $channel, $queryString);
870
    }
871
872
    /**
873
     * List the live streams that the authenticated user is following