Code Duplication    Length = 10-13 lines in 6 locations

code/api/CampaignMonitorAPIConnector.php 6 locations

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