Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5namespace App\Domain\Consent\Repository;
6
7use App\Domain\Consent\Data\ConsentRecord;
8
9/**
10 * Storage contract for the append-only TCPA consent ledger (FSC-87).
11 *
12 * Deliberately exposes append + read only — consent rows are never updated or
13 * deleted. Tests substitute an in-memory implementation via the DI container.
14 */
15interface ConsentRepositoryInterface
16{
17    /**
18     * Append a consent record and return its new consent_id.
19     * @param int $userId
20     * @param string $consentType
21     * @param string $action
22     * @param string $version
23     * @param string $languageShown
24     * @param ?string $ipAddress
25     * @param ?string $userAgent
26     * @param string $source
27     */
28    public function append(
29        int $userId,
30        string $consentType,
31        string $action,
32        string $version,
33        string $languageShown,
34        ?string $ipAddress,
35        ?string $userAgent,
36        string $source,
37    ): int;
38
39    /**
40     * Current consent state for a user — the latest row per consent_type.
41     *
42     * @param int $userId
43     * @return list<ConsentRecord>
44     */
45    public function getCurrentForUser(int $userId): array;
46
47    /**
48     * Full append-only history for a user, newest first.
49     *
50     * @param int $userId
51     * @return list<ConsentRecord>
52     */
53    public function getHistoryForUser(int $userId): array;
54}