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

Mandrill_Whitelists   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
c 0
b 0
f 0
dl 0
loc 51
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 4 1
A getList() 0 4 1
A __construct() 0 3 1
A delete() 0 4 1
1
<?php
2
3
class Mandrill_Whitelists
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 whitelist. If the address is
13
      currently on your blacklist, that blacklist entry will be removed
14
      automatically.
15
     * @param string $email an email address to add to the whitelist
16
     * @param string $comment an optional description of why the email was whitelisted
17
     * @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...
18
     *     - email string the email address you provided
19
     *     - added boolean whether the operation succeeded
20
     */
21
    public function add($email, $comment = null)
22
    {
23
        $_params = array("email" => $email, "comment" => $comment);
24
        return $this->master->call('whitelists/add', $_params);
25
    }
26
27
    /**
28
     * Retrieves your email rejection whitelist. You can provide an email
29
      address or search prefix to limit the results. Returns up to 1000 results.
30
     * @param string $email an optional email address or prefix to search by
31
     * @return array up to 1000 whitelist entries
32
     *     - return[] struct the information for each whitelist entry
33
     *         - email string the email that is whitelisted
34
     *         - detail string a description of why the email was whitelisted
35
     *         - created_at string when the email was added to the whitelist
36
     */
37
    public function getList($email = null)
38
    {
39
        $_params = array("email" => $email);
40
        return $this->master->call('whitelists/list', $_params);
41
    }
42
43
    /**
44
     * Removes an email address from the whitelist.
45
     * @param string $email the email address to remove from the whitelist
46
     * @return struct a status object containing the address and whether the deletion succeeded
47
     *     - email string the email address that was removed from the blacklist
48
     *     - deleted boolean whether the address was deleted successfully
49
     */
50
    public function delete($email)
51
    {
52
        $_params = array("email" => $email);
53
        return $this->master->call('whitelists/delete', $_params);
54
    }
55
}
56