Code Duplication    Length = 10-13 lines in 6 locations

code/api/CampaignMonitorAPIConnector.php 6 locations

@@ 567-576 (lines=10) @@
564
     *
565
     * @return CS_REST_Wrapper_Result
566
     */
567
    public function deleteCustomField($listID, $key)
568
    {
569
        $wrap = new CS_REST_Lists($listID, $this->getAuth());
570
        $result = $wrap->delete_custom_field($key);
571
        return $this->returnResult(
572
            $result,
573
            "DELETE /api/v3/lists/{ID}/{Key}",
574
            "Delete Custom Field for $listID with key $key"
575
        );
576
    }
577
578
    /**
579
     * Deletes an existing list from the system
@@ 583-593 (lines=11) @@
580
     * @param Int $listID
581
     * @return CS_REST_Wrapper_Result A successful response will be empty
582
     */
583
    public function deleteList($listID)
584
    {
585
        //require_once '../../csrest_lists.php';
586
        $wrap = new CS_REST_Lists($listID, $this->getAuth());
587
        $result = $wrap->delete();
588
        return $this->returnResult(
589
            $result,
590
            "DELETE /api/v3.1/lists/{ID}",
591
            "Deleted with code"
592
        );
593
    }
594
595
    /**
596
     * Gets the basic details of the current list
@@ 613-623 (lines=11) @@
610
     *         CS_REST_LIST_UNSUBSCRIBE_SETTING_ONLY_THIS_LIST.
611
     * }
612
     */
613
    public function getList($listID)
614
    {
615
        //require_once '../../csrest_lists.php';
616
        $wrap = new CS_REST_Lists($listID, $this->getAuth());
617
        $result = $wrap->get();
618
        return $this->returnResult(
619
            $result,
620
            "GET /api/v3.1/lists/{ID}",
621
            "Got list details"
622
        );
623
    }
624
625
    /**
626
     * Gets all active subscribers added since the given date
@@ 928-940 (lines=13) @@
925
        );
926
    }
927
928
    public function getSegments($listID)
929
    {
930
        //require_once '../../csrest_lists.php';
931
        $wrap = new CS_REST_Lists($listID, $this->getAuth());
932
        //we need to do this afterwards otherwise the definition below
933
        //is not recognised
934
        $result = $wrap->get_segments();
935
        return $this->returnResult(
936
            $result,
937
            "GET /api/v3.1/lists/{listid}/segments",
938
            "Got segment details"
939
        );
940
    }
941
942
    /**
943
     * Gets statistics for list subscriptions, deletions, bounces and unsubscriptions
@@ 975-985 (lines=11) @@
972
     *     'BouncesThisYear'
973
     * }
974
     */
975
    public function getListStats($listID)
976
    {
977
        //require_once '../../csrest_lists.php';
978
        $wrap = new CS_REST_Lists($listID, $this->getAuth());
979
        $result = $wrap->get_stats();
980
        return $this->returnResult(
981
            $result,
982
            "GET /api/v3.1/lists/{ID}/stats",
983
            "Got Lists Stats"
984
        );
985
    }
986
987
    public function getListCustomFields($listID)
988
    {
@@ 987-996 (lines=10) @@
984
        );
985
    }
986
987
    public function getListCustomFields($listID)
988
    {
989
        $wrap = new CS_REST_Lists($listID, $this->getAuth());
990
        $result = $wrap->get_custom_fields();
991
        return $this->returnResult(
992
            $result,
993
            "GET /api/v3.1/lists/{ID}/customfields",
994
            "Got Lists Custom Fields"
995
        );
996
    }
997
998
    /*******************************************************
999
     * create campaigns