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

Mandrill_Exports::activity()   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 7
dl 0
loc 4
rs 10
1
<?php
2
3
class Mandrill_Exports
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
     * Returns information about an export job. If the export job's state is 'complete',
13
      the returned data will include a URL you can use to fetch the results. Every export
14
      job produces a zip archive, but the format of the archive is distinct for each job
15
      type. The api calls that initiate exports include more details about the output format
16
      for that job type.
17
     * @param string $id an export job identifier
18
     * @return struct the information about the export
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...
19
     *     - id string the unique identifier for this Export. Use this identifier when checking the export job's status
20
     *     - created_at string the date and time that the export job was created as a UTC string in YYYY-MM-DD HH:MM:SS format
21
     *     - type string the type of the export job - activity, reject, or whitelist
22
     *     - finished_at string the date and time that the export job was finished as a UTC string in YYYY-MM-DD HH:MM:SS format
23
     *     - state string the export job's state - waiting, working, complete, error, or expired.
24
     *     - result_url string the url for the export job's results, if the job is completed.
25
     */
26
    public function info($id)
27
    {
28
        $_params = array("id" => $id);
29
        return $this->master->call('exports/info', $_params);
30
    }
31
32
    /**
33
     * Returns a list of your exports.
34
     * @return array the account's exports
35
     *     - return[] struct the individual export info
36
     *         - id string the unique identifier for this Export. Use this identifier when checking the export job's status
37
     *         - created_at string the date and time that the export job was created as a UTC string in YYYY-MM-DD HH:MM:SS format
38
     *         - type string the type of the export job - activity, reject, or whitelist
39
     *         - finished_at string the date and time that the export job was finished as a UTC string in YYYY-MM-DD HH:MM:SS format
40
     *         - state string the export job's state - waiting, working, complete, error, or expired.
41
     *         - result_url string the url for the export job's results, if the job is completed.
42
     */
43
    public function getList()
44
    {
45
        $_params = array();
46
        return $this->master->call('exports/list', $_params);
47
    }
48
49
    /**
50
     * Begins an export of your rejection blacklist. The blacklist will be exported to a zip archive
51
      containing a single file named rejects.csv that includes the following fields: email,
52
      reason, detail, created_at, expires_at, last_event_at, expires_at.
53
     * @param string $notify_email an optional email address to notify when the export job has finished.
54
     * @return struct information about the rejects export job that was started
55
     *     - id string the unique identifier for this Export. Use this identifier when checking the export job's status
56
     *     - created_at string the date and time that the export job was created as a UTC string in YYYY-MM-DD HH:MM:SS format
57
     *     - type string the type of the export job
58
     *     - finished_at string the date and time that the export job was finished as a UTC string in YYYY-MM-DD HH:MM:SS format, or null for jobs that have not run
59
     *     - state string the export job's state
60
     *     - result_url string the url for the export job's results, if the job is complete
61
     */
62
    public function rejects($notify_email = null)
63
    {
64
        $_params = array("notify_email" => $notify_email);
65
        return $this->master->call('exports/rejects', $_params);
66
    }
67
68
    /**
69
     * Begins an export of your rejection whitelist. The whitelist will be exported to a zip archive
70
      containing a single file named whitelist.csv that includes the following fields:
71
      email, detail, created_at.
72
     * @param string $notify_email an optional email address to notify when the export job has finished.
73
     * @return struct information about the whitelist export job that was started
74
     *     - id string the unique identifier for this Export. Use this identifier when checking the export job's status
75
     *     - created_at string the date and time that the export job was created as a UTC string in YYYY-MM-DD HH:MM:SS format
76
     *     - type string the type of the export job
77
     *     - finished_at string the date and time that the export job was finished as a UTC string in YYYY-MM-DD HH:MM:SS format, or null for jobs that have not run
78
     *     - state string the export job's state
79
     *     - result_url string the url for the export job's results, if the job is complete
80
     */
81
    public function whitelist($notify_email = null)
82
    {
83
        $_params = array("notify_email" => $notify_email);
84
        return $this->master->call('exports/whitelist', $_params);
85
    }
86
87
    /**
88
     * Begins an export of your activity history. The activity will be exported to a zip archive
89
      containing a single file named activity.csv in the same format as you would be able to export
90
      from your account's activity view. It includes the following fields: Date, Email Address,
91
      Sender, Subject, Status, Tags, Opens, Clicks, Bounce Detail. If you have configured any custom
92
      metadata fields, they will be included in the exported data.
93
     * @param string $notify_email an optional email address to notify when the export job has finished
94
     * @param string $date_from start date as a UTC string in YYYY-MM-DD HH:MM:SS format
95
     * @param string $date_to end date as a UTC string in YYYY-MM-DD HH:MM:SS format
96
     * @param array $tags an array of tag names to narrow the export to; will match messages that contain ANY of the tags
97
     *     - tags[] string a tag name
98
     * @param array $senders an array of senders to narrow the export to
99
     *     - senders[] string a sender address
100
     * @param array $states an array of states to narrow the export to; messages with ANY of the states will be included
101
     *     - states[] string a message state
102
     * @param array $api_keys an array of api keys to narrow the export to; messsagse sent with ANY of the keys will be included
103
     *     - api_keys[] string an API key associated with your account
104
     * @return struct information about the activity export job that was started
105
     *     - id string the unique identifier for this Export. Use this identifier when checking the export job's status
106
     *     - created_at string the date and time that the export job was created as a UTC string in YYYY-MM-DD HH:MM:SS format
107
     *     - type string the type of the export job
108
     *     - finished_at string the date and time that the export job was finished as a UTC string in YYYY-MM-DD HH:MM:SS format, or null for jobs that have not run
109
     *     - state string the export job's state
110
     *     - result_url string the url for the export job's results, if the job is complete
111
     */
112
    public function activity($notify_email = null, $date_from = null, $date_to = null, $tags = null, $senders = null, $states = null, $api_keys = null)
113
    {
114
        $_params = array("notify_email" => $notify_email, "date_from" => $date_from, "date_to" => $date_to, "tags" => $tags, "senders" => $senders, "states" => $states, "api_keys" => $api_keys);
115
        return $this->master->call('exports/activity', $_params);
116
    }
117
}
118