Debian Codegraph @

classes/Database/StatisticsMapperInterface.php

raw symbols SCIP
1 <?php
2
3 /**
4 * dmarc-srg - A php parser, viewer and summary report generator for incoming DMARC reports.
5 * Copyright (C) 2022-2024 Aleksey Andreev (liuch)
6 *
7 * Available at:
8 * https://github.com/liuch/dmarc-srg
9 *
10 * This program is free software: you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the Free
12 * Software Foundation, either version 3 of the License.
13 *
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 *
19 * You should have received a copy of the GNU General Public License along with
20 * this program. If not, see <http://www.gnu.org/licenses/>.
21 *
22 * =========================
23 *
24 * This file contains the StatisticsMapperInterface
25 *
26 * @category API
27 * @package DmarcSrg
28 * @author Aleksey Andreev (liuch)
29 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3
30 */
31
32 namespace Liuch\DmarcSrg\Database;
33
34 interface StatisticsMapperInterface
35 {
36 /**
37 * Returns summary information for the specified domain and date range
38 *
39 * @param \Liuch\DmarcSrg\Domains\Domain|null $domain Domain for which the information is needed.
40 * Null is for all domains.
41 * @param array $range Array with two dates
42 * @param array $filter Array with filtering parameters
43 * @param int $user_id User ID to get statistics for
44 *
45 * @return array Array with Summary information:
46 * 'emails' => [
47 * 'total' => total email processed (int)
48 * 'dkim_spf_aligned' => Both DKIM and SPF aligned (int)
49 * 'dkim_aligned' => Only DKIM aligned (int)
50 * 'spf_aligned' => Only SPF aligned (int)
51 * 'quarantined' => Quarantined (int)
52 * 'rejected' => Rejected (int)
53 * ];
54 */
55 public function summary($domain, array &$range, array &$filter, int $user_id): array;
56
57 /**
58 * Returns a list of ip-addresses from which the e-mail messages were received, with some statistics for each one
59 *
60 * @param \Liuch\DmarcSrg\Domains\Domain|null $domain Domain for which the information is needed.
61 * Null is for all domains.
62 * @param array $range Array with two dates
63 * @param array $filter Array with filtering parameters
64 * @param int $user_id User ID to get statistics for
65 *
66 * @return array A list of ip-addresses with fields `ip`, `emails`, `dkim_aligned`, `spf_aligned`
67 */
68 public function ips($domain, array &$range, array &$filter, int $user_id): array;
69
70 /**
71 * Returns a list of organizations that sent the reports with some statistics for each one
72 *
73 * @param \Liuch\DmarcSrg\Domains\Domain|null $domain Domain for which the information is needed.
74 * Null is for all domains.
75 * @param array $range Array with two dates
76 * @param array $filter Array with filtering parameters
77 * @param int $user_id User ID to get statistics for
78 *
79 * @return array List of organizations with fields `name`, `reports`, `emails`
80 */
81 public function organizations($domain, array &$range, array &$filter, int $user_id): array;
82 }