Code Duplication    Length = 17-17 lines in 5 locations

code/api/CampaignMonitorAPIConnector.php 5 locations

@@ 661-677 (lines=17) @@
658
     *     )
659
     * }
660
     */
661
    public function getActiveSubscribers($listID, $daysAgo = 3650, $page = 1, $pageSize = 999, $sortByField = "DATE", $sortDirection = "DESC")
662
    {
663
        //require_once '../../csrest_lists.php';
664
        $wrap = new CS_REST_Lists($listID, $this->getAuth());
665
        $result = $wrap->get_active_subscribers(
666
            date('Y-m-d', strtotime('-'.$daysAgo.' days')),
667
            $page,
668
            $pageSize,
669
            $sortByField,
670
            $sortDirection
671
        );
672
        return $this->returnResult(
673
            $result,
674
            "GET /api/v3.1/lists/{ID}/active",
675
            "Got active subscribers"
676
        );
677
    }
678
679
    /**
680
     * Gets all unconfirmed subscribers added since the given date
@@ 714-730 (lines=17) @@
711
     *     )
712
     * }
713
     */
714
    public function getUnconfirmedSubscribers($listID, $daysAgo = 3650, $page = 1, $pageSize = 999, $sortByField = "DATE", $sortDirection = "DESC")
715
    {
716
        //require_once '../../csrest_lists.php';
717
        $wrap = new CS_REST_Lists($listID, $this->getAuth());
718
        $result = $wrap->get_unconfirmed_subscribers(
719
            date('Y-m-d', strtotime('-'.$daysAgo.' days')),
720
            $page,
721
            $pageSize,
722
            $sortByField,
723
            $sortDirection
724
        );
725
        return $this->returnResult(
726
            $result,
727
            "GET /api/v3.1/lists/{ID}/unconfirmed",
728
            "Got unconfimred subscribers"
729
        );
730
    }
731
732
    /**
733
     * Gets all bounced subscribers who have bounced out since the given date
@@ 767-783 (lines=17) @@
764
     *     )
765
     * }
766
     */
767
    public function getBouncedSubscribers($listID, $daysAgo = 3650, $page = 1, $pageSize = 999, $sortByField = "DATE", $sortDirection = "DESC")
768
    {
769
        //require_once '../../csrest_lists.php';
770
        $wrap = new CS_REST_Lists($listID, $this->getAuth());
771
        $result = $wrap->get_bounced_subscribers(
772
            date('Y-m-d', strtotime('-'.$daysAgo.' days')),
773
            $page,
774
            $pageSize,
775
            $sortByField,
776
            $sortDirection
777
        );
778
        return $this->returnResult(
779
            $result,
780
            "GET /api/v3.1/lists/{ID}/bounced",
781
            "Got bounced subscribers"
782
        );
783
    }
784
785
786
    /**
@@ 821-837 (lines=17) @@
818
     *     )
819
     * }
820
     */
821
    public function getUnsubscribedSubscribers($listID, $daysAgo = 3650, $page = 1, $pageSize = 999, $sortByField = "DATE", $sortDirection = "DESC")
822
    {
823
        //require_once '../../csrest_lists.php';
824
        $wrap = new CS_REST_Lists($listID, $this->getAuth());
825
        $result = $wrap->get_unsubscribed_subscribers(
826
            date('Y-m-d', strtotime('-'.$daysAgo.' days')),
827
            $page,
828
            $pageSize,
829
            $sortByField,
830
            $sortDirection
831
        );
832
        return $this->returnResult(
833
            $result,
834
            "GET /api/v3.1/lists/{ID}/unsubscribed",
835
            "Got unsubscribed subscribers"
836
        );
837
    }
838
839
    /**
840
     * Gets all unsubscribed subscribers who have unsubscribed since the given date
@@ 1237-1253 (lines=17) @@
1234
     *     )
1235
     * }
1236
     */
1237
    public function getUnsubscribes($campaignID, $daysAgo = 3650, $page =1, $pageSize = 999, $sortByField = "EMAIL", $sortDirection = "ASC")
1238
    {
1239
        //require_once '../../csrest_campaigns.php';
1240
        $wrap = new CS_REST_Campaigns($campaignID, $this->getAuth());
1241
        $result = $wrap->get_unsubscribes(
1242
            date('Y-m-d', strtotime('-'.$daysAgo.' days')),
1243
            $page,
1244
            $pageSize,
1245
            $sortByField,
1246
            $sortDirection
1247
        );
1248
        return $this->returnResult(
1249
            $result,
1250
            "GET /api/v3.1/campaigns/{id}/unsubscribes",
1251
            "Got unsubscribes"
1252
        );
1253
    }
1254
1255
1256