Code Duplication    Length = 13-15 lines in 3 locations

lib/WebMarketingROI/OptimizelyPHP/Service/v2/Events.php 2 locations

@@ 132-144 (lines=13) @@
129
     * @param ClickEvent $event
130
     * @throws \Exception
131
     */
132
    public function updateClickEvent($pageId, $eventId, $event) 
133
    {
134
        if (!($event instanceOf ClickEvent)) {
135
            throw new \Exception("Expected argument of type ClickEvent");
136
        }
137
        
138
        $postData = $event->toArray();
139
                
140
        $response = $this->client->sendApiRequest("/pages/$pageId/click_events/$eventId", array(), 'PATCH', 
141
                $postData, array(200));
142
        
143
        return new ClickEvent($response);
144
    }
145
    
146
    /**
147
     * Updates the given custom event.
@@ 153-165 (lines=13) @@
150
     * @param CustomEvent $event
151
     * @throws \Exception
152
     */
153
    public function updateCustomEvent($pageId, $eventId, $event) 
154
    {
155
        if (!($event instanceOf CustomEvent)) {
156
            throw new \Exception("Expected argument of type CustomEvent");
157
        }
158
        
159
        $postData = $event->toArray();
160
                
161
        $response = $this->client->sendApiRequest("/pages/$pageId/custom_events/$eventId", array(), 'PATCH', 
162
                $postData, array(200));
163
        
164
        return new CustomEvent($response);
165
    }
166
}
167
168

lib/WebMarketingROI/OptimizelyPHP/Service/v2/Projects.php 1 location

@@ 90-104 (lines=15) @@
87
     * @param Project $project Project meta information.
88
     * @return Project Created project.
89
     */
90
    public function create($project)
91
    {
92
        if (!($project instanceOf Project)) {
93
            throw new \Exception("Expected argument of type Project");
94
        }
95
        
96
        $postData = $project->toArray();
97
        
98
        $response = $this->client->sendApiRequest("/projects", array(), 'POST', 
99
                $postData, array(201));
100
        
101
        $project = new Project($response);
102
        
103
        return $project;
104
    }
105
    
106
    /**
107
     * Update a Project.