Code Duplication    Length = 16-18 lines in 3 locations

src/Mailgun/Api/Domain.php 1 location

@@ 158-173 (lines=16) @@
155
     *
156
     * @return CreateCredentialResponse|array|ResponseInterface
157
     */
158
    public function createCredential($domain, $login, $password)
159
    {
160
        Assert::stringNotEmpty($domain);
161
        Assert::stringNotEmpty($login);
162
        Assert::stringNotEmpty($password);
163
        Assert::lengthBetween($password, 5, 32, 'SMTP password must be between 5 and 32 characters.');
164
165
        $params = [
166
            'login' => $login,
167
            'password' => $password,
168
        ];
169
170
        $response = $this->httpPost(sprintf('/v3/domains/%s/credentials', $domain), $params);
171
172
        return $this->hydrateResponse($response, CreateCredentialResponse::class);
173
    }
174
175
    /**
176
     * Update a set of SMTP credentials for the specified domain.

src/Mailgun/Api/Route.php 2 locations

@@ 34-49 (lines=16) @@
31
     *
32
     * @return IndexResponse
33
     */
34
    public function index($limit = 100, $skip = 0)
35
    {
36
        Assert::integer($limit);
37
        Assert::integer($skip);
38
        Assert::greaterThan($limit, 0);
39
        Assert::greaterThanEq($skip, 0);
40
41
        $params = [
42
            'limit' => $limit,
43
            'skip' => $skip,
44
        ];
45
46
        $response = $this->httpGet('/v3/routes', $params);
47
48
        return $this->hydrateResponse($response, IndexResponse::class);
49
    }
50
51
    /**
52
     * Returns a single Route object based on its ID.
@@ 77-94 (lines=18) @@
74
     *
75
     * @return CreateResponse
76
     */
77
    public function create($expression, array $actions, $description, $priority = 0)
78
    {
79
        Assert::string($expression);
80
        Assert::isArray($actions);
81
        Assert::string($description);
82
        Assert::integer($priority);
83
84
        $params = [
85
            'priority' => $priority,
86
            'expression' => $expression,
87
            'action' => $actions,
88
            'description' => $description,
89
        ];
90
91
        $response = $this->httpPost('/v3/routes', $params);
92
93
        return $this->hydrateResponse($response, CreateResponse::class);
94
    }
95
96
    /**
97
     * Updates a given Route by ID. All parameters are optional.