Debian Codegraph @

classes/Database/UserMapperInterface.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) 2023-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 UserMapperInterface
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 UserMapperInterface
35 {
36 /**
37 * Return true if the user exists or false otherwise.
38 *
39 * @param array $data Array with user data to search
40 *
41 * @return bool
42 */
43 public function exists(array &$data): bool;
44
45 /**
46 * Fetch the user data from the database by its id or name
47 *
48 * @param array $data User data to update
49 *
50 * @return void
51 */
52 public function fetch(array &$data): void;
53
54 /**
55 * Saves user data to the database (updates or inserts an record)
56 *
57 * @param array $data User data
58 *
59 * @return void
60 */
61 public function save(array &$data): void;
62
63 /**
64 * Deletes the user from the database
65 *
66 * Deletes the user if there are no reports for this user in the database.
67 *
68 * @param array $data User data
69 *
70 * @return void
71 */
72 public function delete(array &$data): void;
73
74 /**
75 * Returns a list of users data from the database
76 *
77 * @return array
78 */
79 public function list(): array;
80
81 /**
82 * Returns the user's password hash
83 *
84 * @param array $data User data
85 *
86 * @return string
87 */
88 public function getPasswordHash(array &$data): string;
89
90 /**
91 * Replaces the user's password hash with the passed one
92 *
93 * @param array $data User data
94 * @param string $hash Password hash to save
95 */
96 public function savePasswordHash(array &$data, string $hash): void;
97
98 /**
99 * Updates the user's key string
100 *
101 * @param array $data User data
102 * @param string $key User key string to set
103 *
104 * @return void
105 */
106 public function setUserKey(array &$data, string $key): void;
107 }