Mandrill_Inbound::deleteDomain()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
class Mandrill_Inbound
4
{
5
6
    private $master;
7
8
    public function __construct(Mandrill $master)
9
    {
10
        $this->master = $master;
11
    }
12
13
    /**
14
     * List the domains that have been configured for inbound delivery
15
     * @return array the inbound domains associated with the account
16
     *     - return[] struct the individual domain info
17
     *         - domain string the domain name that is accepting mail
18
     *         - created_at string the date and time that the inbound domain was added as a UTC string in YYYY-MM-DD HH:MM:SS format
19
     *         - valid_mx boolean true if this inbound domain has successfully set up an MX record to deliver mail to the Mandrill servers
20
     */
21
    public function domains()
22
    {
23
        $_params = array();
24
        return $this->master->call('inbound/domains', $_params);
25
    }
26
27
    /**
28
     * Add an inbound domain to your account
29
     * @param string $domain a domain name
30
     * @return struct information about the domain
0 ignored issues
show
Bug introduced by
The type struct was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
31
     *     - domain string the domain name that is accepting mail
32
     *     - created_at string the date and time that the inbound domain was added as a UTC string in YYYY-MM-DD HH:MM:SS format
33
     *     - valid_mx boolean true if this inbound domain has successfully set up an MX record to deliver mail to the Mandrill servers
34
     */
35
    public function addDomain($domain)
36
    {
37
        $_params = array("domain" => $domain);
38
        return $this->master->call('inbound/add-domain', $_params);
39
    }
40
41
    /**
42
     * Check the MX settings for an inbound domain. The domain must have already been added with the add-domain call
43
     * @param string $domain an existing inbound domain
44
     * @return struct information about the inbound domain
45
     *     - domain string the domain name that is accepting mail
46
     *     - created_at string the date and time that the inbound domain was added as a UTC string in YYYY-MM-DD HH:MM:SS format
47
     *     - valid_mx boolean true if this inbound domain has successfully set up an MX record to deliver mail to the Mandrill servers
48
     */
49
    public function checkDomain($domain)
50
    {
51
        $_params = array("domain" => $domain);
52
        return $this->master->call('inbound/check-domain', $_params);
53
    }
54
55
    /**
56
     * Delete an inbound domain from the account. All mail will stop routing for this domain immediately.
57
     * @param string $domain an existing inbound domain
58
     * @return struct information about the deleted domain
59
     *     - domain string the domain name that is accepting mail
60
     *     - created_at string the date and time that the inbound domain was added as a UTC string in YYYY-MM-DD HH:MM:SS format
61
     *     - valid_mx boolean true if this inbound domain has successfully set up an MX record to deliver mail to the Mandrill servers
62
     */
63
    public function deleteDomain($domain)
64
    {
65
        $_params = array("domain" => $domain);
66
        return $this->master->call('inbound/delete-domain', $_params);
67
    }
68
69
    /**
70
     * List the mailbox routes defined for an inbound domain
71
     * @param string $domain the domain to check
72
     * @return array the routes associated with the domain
73
     *     - return[] struct the individual mailbox route
74
     *         - id string the unique identifier of the route
75
     *         - pattern string the search pattern that the mailbox name should match
76
     *         - url string the webhook URL where inbound messages will be published
77
     */
78
    public function routes($domain)
79
    {
80
        $_params = array("domain" => $domain);
81
        return $this->master->call('inbound/routes', $_params);
82
    }
83
84
    /**
85
     * Add a new mailbox route to an inbound domain
86
     * @param string $domain an existing inbound domain
87
     * @param string $pattern the search pattern that the mailbox name should match
88
     * @param string $url the webhook URL where the inbound messages will be published
89
     * @return struct the added mailbox route information
90
     *     - id string the unique identifier of the route
91
     *     - pattern string the search pattern that the mailbox name should match
92
     *     - url string the webhook URL where inbound messages will be published
93
     */
94
    public function addRoute($domain, $pattern, $url)
95
    {
96
        $_params = array("domain" => $domain, "pattern" => $pattern, "url" => $url);
97
        return $this->master->call('inbound/add-route', $_params);
98
    }
99
100
    /**
101
     * Update the pattern or webhook of an existing inbound mailbox route. If null is provided for any fields, the values will remain unchanged.
102
     * @param string $id the unique identifier of an existing mailbox route
103
     * @param string $pattern the search pattern that the mailbox name should match
104
     * @param string $url the webhook URL where the inbound messages will be published
105
     * @return struct the updated mailbox route information
106
     *     - id string the unique identifier of the route
107
     *     - pattern string the search pattern that the mailbox name should match
108
     *     - url string the webhook URL where inbound messages will be published
109
     */
110
    public function updateRoute($id, $pattern = null, $url = null)
111
    {
112
        $_params = array("id" => $id, "pattern" => $pattern, "url" => $url);
113
        return $this->master->call('inbound/update-route', $_params);
114
    }
115
116
    /**
117
     * Delete an existing inbound mailbox route
118
     * @param string $id the unique identifier of an existing route
119
     * @return struct the deleted mailbox route information
120
     *     - id string the unique identifier of the route
121
     *     - pattern string the search pattern that the mailbox name should match
122
     *     - url string the webhook URL where inbound messages will be published
123
     */
124
    public function deleteRoute($id)
125
    {
126
        $_params = array("id" => $id);
127
        return $this->master->call('inbound/delete-route', $_params);
128
    }
129
130
    /**
131
     * Take a raw MIME document destined for a domain with inbound domains set up, and send it to the inbound hook exactly as if it had been sent over SMTP
132
     * @param string $raw_message the full MIME document of an email message
133
     * @param array|null $to optionally define the recipients to receive the message - otherwise we'll use the To, Cc, and Bcc headers provided in the document
134
     *     - to[] string the email address of the recipient
135
     * @param string $mail_from the address specified in the MAIL FROM stage of the SMTP conversation. Required for the SPF check.
136
     * @param string $helo the identification provided by the client mta in the MTA state of the SMTP conversation. Required for the SPF check.
137
     * @param string $client_address the remote MTA's ip address. Optional; required for the SPF check.
138
     * @return array an array of the information for each recipient in the message (usually one) that matched an inbound route
139
     *     - return[] struct the individual recipient information
140
     *         - email string the email address of the matching recipient
141
     *         - pattern string the mailbox route pattern that the recipient matched
142
     *         - url string the webhook URL that the message was posted to
143
     */
144
    public function sendRaw($raw_message, $to = null, $mail_from = null, $helo = null, $client_address = null)
145
    {
146
        $_params = array("raw_message" => $raw_message, "to" => $to, "mail_from" => $mail_from, "helo" => $helo, "client_address" => $client_address);
147
        return $this->master->call('inbound/send-raw', $_params);
148
    }
149
}
150