Completed
Pull Request — master (#249)
by David
09:12
created

Routes::index()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
dl 14
loc 14
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 2
1
<?php
2
3
/*
4
 * Copyright (C) 2013-2016 Mailgun
5
 *
6
 * This software may be modified and distributed under the terms
7
 * of the MIT license. See the LICENSE file for details.
8
 */
9
10
namespace Mailgun\Api;
11
12
use Mailgun\Assert;
13
use Mailgun\Resource\Api\Routes\Response\IndexResponse;
14
15
/**
16
 * {@link https://documentation.mailgun.com/api-routes.html}.
17
 *
18
 * @author David Garcia <[email protected]>
19
 */
20
class Routes extends HttpApi
21
{
22
    /**
23
     * Fetches the list of Routes. Note that Routes are defined globally,
24
     * per account, not per domain as most of other API calls.
25
     *
26
     * @param int $limit Maximum number of records to return. (100 by default)
27
     * @param int $skip  Number of records to skip. (0 by default)
28
     *
29
     * @return IndexResponse
30
     */
31 View Code Duplication
    public function index($limit = 100, $skip = 0)
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...
32
    {
33
        Assert::integer($limit);
34
        Assert::integer($skip);
35
36
        $params = [
37
            'limit' => $limit,
38
            'skip' => $skip,
39
        ];
40
41
        $response = $this->httpGet('/v3/routes', $params);
42
43
        return $this->safeDeserialize($response, IndexResponse::class);
44
    }
45
46
    /**
47
     * Returns a single Route object based on its ID.
48
     *
49
     * @param string $routeId Route ID returned by the Routes::index() method
50
     *
51
     * @return
52
     */
53
    public function show($routeId)
0 ignored issues
show
Unused Code introduced by
The parameter $routeId is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
54
    {
55
    }
56
57
    /**
58
     * Creates a new Route.
59
     *
60
     * @param string $expression  A filter expression like "match_recipient('.*@gmail.com')"
61
     * @param array  $actions     Route action. This action is executed when the expression evaluates to True. Example: "forward('[email protected]')"
62
     * @param string $description An arbitrary string
63
     * @param int    $priority    Integer: smaller number indicates higher priority. Higher priority routes are handled first. Defaults to 0.
64
     *
65
     * @return
66
     */
67
    public function create($expression, array $actions, $description, $priority = 0)
0 ignored issues
show
Unused Code introduced by
The parameter $expression is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $actions is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $description is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $priority is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
68
    {
69
    }
70
71
    /**
72
     * Updates a given Route by ID. All parameters are optional.
73
     * This API call only updates the specified fields leaving others unchanged.
74
     *
75
     * @param string      $routeId     Route ID returned by the Routes::index() method
76
     * @param string|null $expression  A filter expression like "match_recipient('.*@gmail.com')"
77
     * @param array|null  $actions     Route action. This action is executed when the expression evaluates to True. Example: "forward('[email protected]')"
78
     * @param string|null $description An arbitrary string
79
     * @param int|null    $priority    Integer: smaller number indicates higher priority. Higher priority routes are handled first. Defaults to 0.
80
     *
81
     * @return
82
     */
83
    public function update($routeId, $expression = null, array $actions = null, $description = null, $priority = null)
0 ignored issues
show
Unused Code introduced by
The parameter $routeId is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $expression is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $actions is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $description is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $priority is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
84
    {
85
    }
86
87
    /**
88
     * Deletes a Route based on the ID.
89
     */
90
    public function delete()
91
    {
92
    }
93
}
94