Code Duplication    Length = 12-13 lines in 5 locations

src/Api/Event.php 1 location

@@ 29-40 (lines=12) @@
26
    /**
27
     * @return EventResponse
28
     */
29
    public function get(string $domain, array $params = [])
30
    {
31
        Assert::stringNotEmpty($domain);
32
33
        if (array_key_exists('limit', $params)) {
34
            Assert::range($params['limit'], 1, 300);
35
        }
36
37
        $response = $this->httpGet(sprintf('/v3/%s/events', $domain), $params);
38
39
        return $this->hydrateResponse($response, EventResponse::class);
40
    }
41
}
42

src/Api/Suppression/Bounce.php 1 location

@@ 37-49 (lines=13) @@
34
     *
35
     * @return IndexResponse
36
     */
37
    public function index(string $domain, int $limit = 100)
38
    {
39
        Assert::stringNotEmpty($domain);
40
        Assert::range($limit, 1, 10000, '"Limit" parameter must be between 1 and 10000');
41
42
        $params = [
43
            'limit' => $limit,
44
        ];
45
46
        $response = $this->httpGet(sprintf('/v3/%s/bounces', $domain), $params);
47
48
        return $this->hydrateResponse($response, IndexResponse::class);
49
    }
50
51
    /**
52
     * @param string $domain  Domain to show bounce from

src/Api/Suppression/Complaint.php 1 location

@@ 37-49 (lines=13) @@
34
     *
35
     * @return IndexResponse
36
     */
37
    public function index(string $domain, int $limit = 100)
38
    {
39
        Assert::stringNotEmpty($domain);
40
        Assert::range($limit, 1, 10000, 'Limit parameter must be between 1 and 10000');
41
42
        $params = [
43
            'limit' => $limit,
44
        ];
45
46
        $response = $this->httpGet(sprintf('/v3/%s/complaints', $domain), $params);
47
48
        return $this->hydrateResponse($response, IndexResponse::class);
49
    }
50
51
    /**
52
     * @param string $domain  Domain to show complaint for

src/Api/Suppression/Unsubscribe.php 1 location

@@ 37-49 (lines=13) @@
34
     *
35
     * @return IndexResponse
36
     */
37
    public function index(string $domain, int $limit = 100)
38
    {
39
        Assert::stringNotEmpty($domain);
40
        Assert::range($limit, 1, 10000, 'Limit parameter must be between 1 and 10000');
41
42
        $params = [
43
            'limit' => $limit,
44
        ];
45
46
        $response = $this->httpGet(sprintf('/v3/%s/unsubscribes', $domain), $params);
47
48
        return $this->hydrateResponse($response, IndexResponse::class);
49
    }
50
51
    /**
52
     * @param string $domain  Domain to show unsubscribe for

src/Api/Suppression/Whitelist.php 1 location

@@ 40-52 (lines=13) @@
37
     *
38
     * @return IndexResponse
39
     */
40
    public function index(string $domain, int $limit = 100)
41
    {
42
        Assert::stringNotEmpty($domain);
43
        Assert::range($limit, 1, 10000, 'Limit parameter must be between 1 and 10000');
44
45
        $params = [
46
            'limit' => $limit,
47
        ];
48
49
        $response = $this->httpGet(sprintf('/v3/%s/whitelists', $domain), $params);
50
51
        return $this->hydrateResponse($response, IndexResponse::class);
52
    }
53
54
    /**
55
     * @param string $domain  Domain to show whitelist for