Mandrill_Subaccounts::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
class Mandrill_Subaccounts
4
{
5
6
    private $master;
7
8
    public function __construct(Mandrill $master)
9
    {
10
        $this->master = $master;
11
    }
12
13
    /**
14
     * Get the list of subaccounts defined for the account, optionally filtered by a prefix
15
     * @param string $q an optional prefix to filter the subaccounts' ids and names
16
     * @return array the subaccounts for the account, up to a maximum of 1,000
17
     *     - return[] struct the individual subaccount info
18
     *         - id string a unique indentifier for the subaccount
19
     *         - name string an optional display name for the subaccount
20
     *         - custom_quota integer an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
21
     *         - status string the current sending status of the subaccount, one of "active" or "paused"
22
     *         - reputation integer the subaccount's current reputation on a scale from 0 to 100
23
     *         - created_at string the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
24
     *         - first_sent_at string the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format
25
     *         - sent_weekly integer the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
26
     *         - sent_monthly integer the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
27
     *         - sent_total integer the number of emails the subaccount has sent since it was created
28
     */
29
    public function getList($q = null)
30
    {
31
        $_params = array("q" => $q);
32
        return $this->master->call('subaccounts/list', $_params);
33
    }
34
35
    /**
36
     * Add a new subaccount
37
     * @param string $id a unique identifier for the subaccount to be used in sending calls
38
     * @param string $name an optional display name to further identify the subaccount
39
     * @param string $notes optional extra text to associate with the subaccount
40
     * @param int $custom_quota an optional manual hourly quota for the subaccount. If not specified, Mandrill will manage this based on reputation
41
     * @return struct the information saved about the new subaccount
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...
42
     *     - id string a unique indentifier for the subaccount
43
     *     - name string an optional display name for the subaccount
44
     *     - custom_quota integer an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
45
     *     - status string the current sending status of the subaccount, one of "active" or "paused"
46
     *     - reputation integer the subaccount's current reputation on a scale from 0 to 100
47
     *     - created_at string the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
48
     *     - first_sent_at string the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format
49
     *     - sent_weekly integer the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
50
     *     - sent_monthly integer the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
51
     *     - sent_total integer the number of emails the subaccount has sent since it was created
52
     */
53
    public function add($id, $name = null, $notes = null, $custom_quota = null)
54
    {
55
        $_params = array("id" => $id, "name" => $name, "notes" => $notes, "custom_quota" => $custom_quota);
56
        return $this->master->call('subaccounts/add', $_params);
57
    }
58
59
    /**
60
     * Given the ID of an existing subaccount, return the data about it
61
     * @param string $id the unique identifier of the subaccount to query
62
     * @return struct the information about the subaccount
63
     *     - id string a unique indentifier for the subaccount
64
     *     - name string an optional display name for the subaccount
65
     *     - notes string optional extra text to associate with the subaccount
66
     *     - custom_quota integer an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
67
     *     - status string the current sending status of the subaccount, one of "active" or "paused"
68
     *     - reputation integer the subaccount's current reputation on a scale from 0 to 100
69
     *     - created_at string the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
70
     *     - first_sent_at string the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format
71
     *     - sent_weekly integer the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
72
     *     - sent_monthly integer the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
73
     *     - sent_total integer the number of emails the subaccount has sent since it was created
74
     *     - sent_hourly integer the number of emails the subaccount has sent in the last hour
75
     *     - hourly_quota integer the current hourly quota for the subaccount, either manual or reputation-based
76
     *     - last_30_days struct stats for this subaccount in the last 30 days
77
     *         - sent integer the number of emails sent for this subaccount in the last 30 days
78
     *         - hard_bounces integer the number of emails hard bounced for this subaccount in the last 30 days
79
     *         - soft_bounces integer the number of emails soft bounced for this subaccount in the last 30 days
80
     *         - rejects integer the number of emails rejected for sending this subaccount in the last 30 days
81
     *         - complaints integer the number of spam complaints for this subaccount in the last 30 days
82
     *         - unsubs integer the number of unsbuscribes for this subaccount in the last 30 days
83
     *         - opens integer the number of times emails have been opened for this subaccount in the last 30 days
84
     *         - unique_opens integer the number of unique opens for emails sent for this subaccount in the last 30 days
85
     *         - clicks integer the number of URLs that have been clicked for this subaccount in the last 30 days
86
     *         - unique_clicks integer the number of unique clicks for emails sent for this subaccount in the last 30 days
87
     */
88
    public function info($id)
89
    {
90
        $_params = array("id" => $id);
91
        return $this->master->call('subaccounts/info', $_params);
92
    }
93
94
    /**
95
     * Update an existing subaccount
96
     * @param string $id the unique identifier of the subaccount to update
97
     * @param string $name an optional display name to further identify the subaccount
98
     * @param string $notes optional extra text to associate with the subaccount
99
     * @param int $custom_quota an optional manual hourly quota for the subaccount. If not specified, Mandrill will manage this based on reputation
100
     * @return struct the information for the updated subaccount
101
     *     - id string a unique indentifier for the subaccount
102
     *     - name string an optional display name for the subaccount
103
     *     - custom_quota integer an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
104
     *     - status string the current sending status of the subaccount, one of "active" or "paused"
105
     *     - reputation integer the subaccount's current reputation on a scale from 0 to 100
106
     *     - created_at string the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
107
     *     - first_sent_at string the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format
108
     *     - sent_weekly integer the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
109
     *     - sent_monthly integer the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
110
     *     - sent_total integer the number of emails the subaccount has sent since it was created
111
     */
112
    public function update($id, $name = null, $notes = null, $custom_quota = null)
113
    {
114
        $_params = array("id" => $id, "name" => $name, "notes" => $notes, "custom_quota" => $custom_quota);
115
        return $this->master->call('subaccounts/update', $_params);
116
    }
117
118
    /**
119
     * Delete an existing subaccount. Any email related to the subaccount will be saved, but stats will be removed and any future sending calls to this subaccount will fail.
120
     * @param string $id the unique identifier of the subaccount to delete
121
     * @return struct the information for the deleted subaccount
122
     *     - id string a unique indentifier for the subaccount
123
     *     - name string an optional display name for the subaccount
124
     *     - custom_quota integer an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
125
     *     - status string the current sending status of the subaccount, one of "active" or "paused"
126
     *     - reputation integer the subaccount's current reputation on a scale from 0 to 100
127
     *     - created_at string the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
128
     *     - first_sent_at string the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format
129
     *     - sent_weekly integer the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
130
     *     - sent_monthly integer the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
131
     *     - sent_total integer the number of emails the subaccount has sent since it was created
132
     */
133
    public function delete($id)
134
    {
135
        $_params = array("id" => $id);
136
        return $this->master->call('subaccounts/delete', $_params);
137
    }
138
139
    /**
140
     * Pause a subaccount's sending. Any future emails delivered to this subaccount will be queued for a maximum of 3 days until the subaccount is resumed.
141
     * @param string $id the unique identifier of the subaccount to pause
142
     * @return struct the information for the paused subaccount
143
     *     - id string a unique indentifier for the subaccount
144
     *     - name string an optional display name for the subaccount
145
     *     - custom_quota integer an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
146
     *     - status string the current sending status of the subaccount, one of "active" or "paused"
147
     *     - reputation integer the subaccount's current reputation on a scale from 0 to 100
148
     *     - created_at string the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
149
     *     - first_sent_at string the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format
150
     *     - sent_weekly integer the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
151
     *     - sent_monthly integer the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
152
     *     - sent_total integer the number of emails the subaccount has sent since it was created
153
     */
154
    public function pause($id)
155
    {
156
        $_params = array("id" => $id);
157
        return $this->master->call('subaccounts/pause', $_params);
158
    }
159
160
    /**
161
     * Resume a paused subaccount's sending
162
     * @param string $id the unique identifier of the subaccount to resume
163
     * @return struct the information for the resumed subaccount
164
     *     - id string a unique indentifier for the subaccount
165
     *     - name string an optional display name for the subaccount
166
     *     - custom_quota integer an optional manual hourly quota for the subaccount. If not specified, the hourly quota will be managed based on reputation
167
     *     - status string the current sending status of the subaccount, one of "active" or "paused"
168
     *     - reputation integer the subaccount's current reputation on a scale from 0 to 100
169
     *     - created_at string the date and time that the subaccount was created as a UTC string in YYYY-MM-DD HH:MM:SS format
170
     *     - first_sent_at string the date and time that the subaccount first sent as a UTC string in YYYY-MM-DD HH:MM:SS format
171
     *     - sent_weekly integer the number of emails the subaccount has sent so far this week (weeks start on midnight Monday, UTC)
172
     *     - sent_monthly integer the number of emails the subaccount has sent so far this month (months start on midnight of the 1st, UTC)
173
     *     - sent_total integer the number of emails the subaccount has sent since it was created
174
     */
175
    public function resume($id)
176
    {
177
        $_params = array("id" => $id);
178
        return $this->master->call('subaccounts/resume', $_params);
179
    }
180
}
181