Code Duplication    Length = 10-16 lines in 5 locations

src/Manager/GoalManager.php 2 locations

@@ 57-67 (lines=11) @@
54
     *
55
     * @return \Acquia\LiftClient\Entity\Goal
56
     */
57
    public function get($id) {
58
        $url = "/goals/{$id}";
59
60
        // Now make the request.
61
        $request = new Request('GET', $url);
62
        $data = $this->client->getResponseJson($request);
63
64
        return new Goal($data);
65
    }
66
67
    /**
68
     * Add a goal.
69
     *
70
     * @see http://docs.decision-api.acquia.com/#goals_post
@@ 78-87 (lines=10) @@
75
     *
76
     * @return \Acquia\LiftClient\Entity\Goal
77
     */
78
    public function add(Goal $goal) {
79
        $body = $goal->json();
80
        $url = '/goals';
81
        $request = new Request('POST', $url, [], $body);
82
        $data = $this->client->getResponseJson($request);
83
84
        return new Goal($data);
85
    }
86
87
    /**
88
     * Deletes a goal by ID.
89
     *
90
     * @see http://docs.decision-api.acquia.com/#goals__goal_id__delete

src/Manager/SlotManager.php 2 locations

@@ 66-76 (lines=11) @@
63
     *
64
     * @return \Acquia\LiftClient\Entity\Slot
65
     */
66
    public function get($id) {
67
        $url = "/slots/{$id}";
68
69
        // Now make the request.
70
        $request = new Request('GET', $url);
71
        $data = $this->client->getResponseJson($request);
72
73
        return new Slot($data);
74
    }
75
76
    /**
77
     * Add a slot.
78
     *
79
     * @param \Acquia\LiftClient\Entity\Slot $slot
@@ 85-94 (lines=10) @@
82
     *
83
     * @return \Acquia\LiftClient\Entity\Slot
84
     */
85
    public function add(Slot $slot) {
86
        $body = $slot->json();
87
        $url = '/slots';
88
        $request = new Request('POST', $url, [], $body);
89
        $data = $this->client->getResponseJson($request);
90
91
        return new Slot($data);
92
    }
93
94
    /**
95
     * Deletes a slot by ID.
96
     *
97
     * @param string $id

src/Manager/SegmentManager.php 1 location

@@ 19-34 (lines=16) @@
16
     *
17
     * @return \Acquia\LiftClient\Entity\Segment[]
18
     */
19
    public function query()
20
    {
21
        $url = '/segments';
22
23
        // Now make the request.
24
        $request = new Request('GET', $url);
25
        $data = $this->client->getResponseJson($request);
26
27
        // Get them as Segment objects
28
        $segments = [];
29
        foreach ($data as $dataItem) {
30
            $segments[] = new Segment($dataItem);
31
        }
32
33
        return $segments;
34
    }
35
}
36