Completed
Push — master ( d8ae00...12ed8a )
by Tobias
02:18
created

Event::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 12
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 0
Metric Value
dl 12
loc 12
ccs 4
cts 5
cp 0.8
rs 9.8666
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2.032
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * Copyright (C) 2013 Mailgun
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license. See the LICENSE file for details.
10
 */
11
12
namespace Mailgun\Api;
13
14
use Mailgun\Assert;
15
use Mailgun\Model\Event\EventResponse;
16
17
/**
18
 * @see https://documentation.mailgun.com/en/latest/api-events.html
19
 *
20
 * @author Tobias Nyholm <[email protected]>
21
 */
22
class Event extends HttpApi
23
{
24
    use Pagination;
25
26
    /**
27
     * @return EventResponse
28
     */
29 2 View Code Duplication
    public function get(string $domain, array $params = [])
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
    {
31 2
        Assert::stringNotEmpty($domain);
32
33 1
        if (array_key_exists('limit', $params)) {
34
            Assert::range($params['limit'], 1, 300);
35
        }
36
37 1
        $response = $this->httpGet(sprintf('/v3/%s/events', $domain), $params);
38
39
        return $this->hydrateResponse($response, EventResponse::class);
40
    }
41
}
42