Code Duplication    Length = 14-14 lines in 2 locations

src/PublicAPIClient.php 2 locations

@@ 197-210 (lines=14) @@
194
     * @return int
195
     * @throws Exception
196
     */
197
    public function sendEvent(EnvelopeInterface $envelope)
198
    {
199
        // Validating
200
        $this->validator->validate($envelope);
201
202
        // Sending
203
        $data = $this->readJson($this->send(new Event($envelope)));
204
205
        if (!is_array($data) || !isset($data['requestId']) || !is_int($data['requestId'])) {
206
            throw new Exception("Malformed response");
207
        }
208
209
        return $data['requestId'];
210
    }
211
212
    /**
213
     * Sends postback envelope to Covery and returns it's ID on Covery side
@@ 220-233 (lines=14) @@
217
     * @return int
218
     * @throws Exception
219
     */
220
    public function sendPostback(EnvelopeInterface $envelope)
221
    {
222
        // Validating
223
        $this->validator->validate($envelope);
224
225
        // Sending
226
        $data = $this->readJson($this->send(new Postback($envelope)));
227
228
        if (!is_array($data) || !isset($data['requestId']) || !is_int($data['requestId'])) {
229
            throw new Exception("Malformed response");
230
        }
231
232
        return $data['requestId'];
233
    }
234
235
    /**
236
     * Sends envelope to Covery for analysis