Completed
Push — master ( 7e438f...abf2a0 )
by Tobias
01:56
created

Event::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2.0185

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 5
cts 6
cp 0.8333
rs 9.8666
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2.0185
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
    public function get(string $domain, array $params = [])
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 1
        return $this->hydrateResponse($response, EventResponse::class);
40
    }
41
}
42