Code Duplication    Length = 14-15 lines in 6 locations

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

@@ 662-675 (lines=14) @@
659
     * @return \stdClass
660
     * @throws TwitchException
661
     */
662
    public function authUserGet($token)
663
    {
664
        if ($this->authConfig === false) {
665
            $this->authConfigException();
666
        }
667
668
        $queryString = $this->helper->buildQueryString(array(
669
            'oauth_token' => $token,
670
            'client_id' => $this->authConfig['client_id'],
671
        ));
672
673
        $user = new Methods\User($this->request);
674
        return $user->getUserAuth($queryString);
675
    }
676
677
    /**
678
     * Get the authenticated channel
@@ 684-698 (lines=15) @@
681
     * @return \stdClass
682
     * @throws TwitchException
683
     */
684
    public function authChannelGet($token)
685
    {
686
        if ($this->authConfig === false) {
687
            $this->authConfigException();
688
        }
689
690
        $queryString = $this->helper->buildQueryString(array(
691
            'oauth_token' => $token,
692
            'client_id' => $this->authConfig['client_id'],
693
        ));
694
695
        $channels = new Methods\Channel($this->request);
696
697
        return $channels->getChannel($queryString);
698
    }
699
700
    /**
701
     * Update channel's status or game
@@ 741-755 (lines=15) @@
738
     * @return \stdClass
739
     * @throws TwitchException
740
     */
741
    public function authChannelResetKey($token, $channelName)
742
    {
743
        if ($this->authConfig === false) {
744
            $this->authConfigException();
745
        }
746
747
        $queryString = $this->helper->buildQueryString(array(
748
            'oauth_token' => $token,
749
            'client_id' => $this->authConfig['client_id'],
750
        ));
751
752
        $channel = new Methods\Channel($this->request);
753
754
        return $channel->resetStreamKey($channelName, $queryString);
755
    }
756
757
    /**
758
     * Returns an array of users who are editors of specified channel
@@ 765-779 (lines=15) @@
762
     * @return \stdClass
763
     * @throws TwitchException
764
     */
765
    public function authChannelEditors($token, $channel)
766
    {
767
        if ($this->authConfig === false) {
768
            $this->authConfigException();
769
        }
770
771
        $queryString = $this->helper->buildQueryString(array(
772
            'oauth_token' => $token,
773
            'client_id' => $this->authConfig['client_id'],
774
        ));
775
776
        $channels = new Methods\Channel($this->request);
777
778
        return $channels->getEditors($channel, $queryString);
779
    }
780
781
    /**
782
     * Returns an array of subscriptions who are subscribed to specified channel
@@ 820-834 (lines=15) @@
817
     * @return \stdClass
818
     * @throws TwitchException
819
     */
820
    public function authSubscribedUser($token, $channel, $user)
821
    {
822
        if ($this->authConfig === false) {
823
            $this->authConfigException();
824
        }
825
826
        $queryString = $this->helper->buildQueryString(array(
827
            'oauth_token' => $token,
828
            'client_id' => $this->authConfig['client_id'],
829
        ));
830
831
        $subscription = new Methods\Subscription($this->request);
832
833
        return $subscription->getSubscribedUser($channel, $user, $queryString);
834
    }
835
836
    /**
837
     * Returns a channel object that user subscribes to
@@ 845-859 (lines=15) @@
842
     * @return \stdClass
843
     * @throws TwitchException
844
     */
845
    public function authSubscribedToChannel($token, $user, $channel)
846
    {
847
        if ($this->authConfig === false) {
848
            $this->authConfigException();
849
        }
850
851
        $queryString = $this->helper->buildQueryString(array(
852
            'oauth_token' => $token,
853
            'client_id' => $this->authConfig['client_id'],
854
        ));
855
856
        $subscription = new Methods\Subscription($this->request);
857
858
        return $subscription->getSubscribedToChannel($user, $channel, $queryString);
859
    }
860
861
    /**
862
     * List the live streams that the authenticated user is following