Passed
Push — master ( d156dd...acd975 )
by Thomas
04:20 queued 01:05
created

Mandrill_Rejects::delete()   A

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 2
dl 0
loc 4
rs 10
1
<?php
2
3
class Mandrill_Rejects
4
{
5
6
    public function __construct(Mandrill $master)
7
    {
8
        $this->master = $master;
0 ignored issues
show
Bug Best Practice introduced by
The property master does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
9
    }
10
11
    /**
12
     * Adds an email to your email rejection blacklist. Addresses that you
13
      add manually will never expire and there is no reputation penalty
14
      for removing them from your blacklist. Attempting to blacklist an
15
      address that has been whitelisted will have no effect.
16
     * @param string $email an email address to block
17
     * @param string $comment an optional comment describing the rejection
18
     * @param string $subaccount an optional unique identifier for the subaccount to limit the blacklist entry
19
     * @return struct a status object containing the address and the result of the operation
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...
20
     *     - email string the email address you provided
21
     *     - added boolean whether the operation succeeded
22
     */
23
    public function add($email, $comment = null, $subaccount = null)
24
    {
25
        $_params = array("email" => $email, "comment" => $comment, "subaccount" => $subaccount);
26
        return $this->master->call('rejects/add', $_params);
27
    }
28
29
    /**
30
     * Retrieves your email rejection blacklist. You can provide an email
31
      address to limit the results. Returns up to 1000 results. By default,
32
      entries that have expired are excluded from the results; set
33
      include_expired to true to include them.
34
     * @param string $email an optional email address to search by
35
     * @param boolean $include_expired whether to include rejections that have already expired.
36
     * @param string $subaccount an optional unique identifier for the subaccount to limit the blacklist
37
     * @return array Up to 1000 rejection entries
38
     *     - return[] struct the information for each rejection blacklist entry
39
     *         - email string the email that is blocked
40
     *         - reason string the type of event (hard-bounce, soft-bounce, spam, unsub, custom) that caused this rejection
41
     *         - detail string extended details about the event, such as the SMTP diagnostic for bounces or the comment for manually-created rejections
42
     *         - created_at string when the email was added to the blacklist
43
     *         - last_event_at string the timestamp of the most recent event that either created or renewed this rejection
44
     *         - expires_at string when the blacklist entry will expire (this may be in the past)
45
     *         - expired boolean whether the blacklist entry has expired
46
     *         - sender struct the sender that this blacklist entry applies to, or null if none.
47
     *             - address string the sender's email address
48
     *             - created_at string the date and time that the sender was first seen by Mandrill as a UTC date string in YYYY-MM-DD HH:MM:SS format
49
     *             - sent integer the total number of messages sent by this sender
50
     *             - hard_bounces integer the total number of hard bounces by messages by this sender
51
     *             - soft_bounces integer the total number of soft bounces by messages by this sender
52
     *             - rejects integer the total number of rejected messages by this sender
53
     *             - complaints integer the total number of spam complaints received for messages by this sender
54
     *             - unsubs integer the total number of unsubscribe requests received for messages by this sender
55
     *             - opens integer the total number of times messages by this sender have been opened
56
     *             - clicks integer the total number of times tracked URLs in messages by this sender have been clicked
57
     *             - unique_opens integer the number of unique opens for emails sent for this sender
58
     *             - unique_clicks integer the number of unique clicks for emails sent for this sender
59
     *         - subaccount string the subaccount that this blacklist entry applies to, or null if none.
60
     */
61
    public function getList($email = null, $include_expired = false, $subaccount = null)
62
    {
63
        $_params = array("email" => $email, "include_expired" => $include_expired, "subaccount" => $subaccount);
64
        return $this->master->call('rejects/list', $_params);
65
    }
66
67
    /**
68
     * Deletes an email rejection. There is no limit to how many rejections
69
      you can remove from your blacklist, but keep in mind that each deletion
70
      has an affect on your reputation.
71
     * @param string $email an email address
72
     * @param string $subaccount an optional unique identifier for the subaccount to limit the blacklist deletion
73
     * @return struct a status object containing the address and whether the deletion succeeded.
74
     *     - email string the email address that was removed from the blacklist
75
     *     - deleted boolean whether the address was deleted successfully.
76
     *     - subaccount string the subaccount blacklist that the address was removed from, if any
77
     */
78
    public function delete($email, $subaccount = null)
79
    {
80
        $_params = array("email" => $email, "subaccount" => $subaccount);
81
        return $this->master->call('rejects/delete', $_params);
82
    }
83
}
84