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

Event   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 20
ccs 5
cts 6
cp 0.8333
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 12 2
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