Code Duplication    Length = 19-20 lines in 3 locations

src/Facade/OutlookRestClient.php 3 locations

@@ 131-149 (lines=19) @@
128
     * @param string $calendar_id
129
     * @return bool|ErrorResponse
130
     */
131
    public function deleteCalendar($calendar_id)
132
    {
133
        $http_request = new Request
134
        (
135
            HttpMethods::Delete,
136
            "me/calendars/{$calendar_id}",
137
            $this->getDefaultHeaders()
138
        );
139
140
        try{
141
            $http_response =  $this->client->send($http_request, [
142
                'timeout'  => $this->timeout,
143
            ]);
144
            return $http_response->getStatusCode() == 204;
145
        }
146
        catch (ClientException $ex){
147
            return new ErrorResponse((string)$ex->getResponse()->getBody());
148
        }
149
    }
150
151
    /**
152
     * @param string $calendar_id
@@ 207-225 (lines=19) @@
204
     * @param string $event_id
205
     * @return bool|ErrorResponse
206
     */
207
    public function deleteEvent($event_id)
208
    {
209
        $http_request = new Request
210
        (
211
            HttpMethods::Delete,
212
            "me/events/{$event_id}",
213
            $this->getDefaultHeaders()
214
        );
215
216
        try{
217
            $http_response =  $this->client->send($http_request, [
218
                'timeout'  => $this->timeout,
219
            ]);
220
            return $http_response->getStatusCode() == 204;
221
        }
222
        catch (ClientException $ex){
223
            return new ErrorResponse((string)$ex->getResponse()->getBody());
224
        }
225
    }
226
227
    public function setAccessToken(array $access_token = null)
228
    {
@@ 243-262 (lines=20) @@
240
    /**
241
     * @return CalendarCollectionResponse|ErrorResponse
242
     */
243
    public function getCalendars()
244
    {
245
246
        $http_request = new Request
247
        (
248
            HttpMethods::Get,
249
            'me/calendars',
250
            $this->getDefaultHeaders()
251
        );
252
253
        try{
254
            $http_response =  $this->client->send($http_request, [
255
                'timeout'  => $this->timeout,
256
            ]);
257
            return new CalendarCollectionResponse((string)$http_response->getBody());
258
        }
259
        catch (ClientException $ex){
260
            return new ErrorResponse( (string)$ex->getResponse()->getBody());
261
        }
262
    }
263
264
    /**
265
     * sets function to be called when an access token is fetched