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

Event   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 60 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 80%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 12 12 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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