Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Core\Audit\Domain\Repository; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | use App\Core\Audit\Domain\Model\SecurityEvent; |
| 12 | |
| 13 | /** |
| 14 | * Security Audit Repository Contract. |
| 15 | * |
| 16 | * Defines persistence and query operations for security incidents and audit events. |
| 17 | * |
| 18 | * @package App\Core\Audit\Domain\Repository |
| 19 | */ |
| 20 | interface SecurityAuditRepositoryInterface |
| 21 | { |
| 22 | /** |
| 23 | * Persists a security audit event. |
| 24 | * |
| 25 | * @param SecurityEvent $event Security incident to persist. |
| 26 | * @return int Inserted record ID. |
| 27 | */ |
| 28 | public function log(SecurityEvent $event): int; |
| 29 | |
| 30 | /** |
| 31 | * Finds security audit events matching search criteria. |
| 32 | * |
| 33 | * @param array<string, mixed> $criteria Filter criteria (event_type, severity, actor_id, request_id, etc.). |
| 34 | * @param int $limit Maximum number of records to return. |
| 35 | * @param int $offset Pagination offset. |
| 36 | * @return array<int, SecurityEvent> List of matching security events. |
| 37 | */ |
| 38 | public function find(array $criteria = [], int $limit = 50, int $offset = 0): array; |
| 39 | |
| 40 | /** |
| 41 | * Counts security audit events matching search criteria. |
| 42 | * |
| 43 | * @param array<string, mixed> $criteria Filter criteria. |
| 44 | * @return int Total matching records. |
| 45 | */ |
| 46 | public function count(array $criteria = []): int; |
| 47 | |
| 48 | /** |
| 49 | * Prunes expired security logs older than the specified timestamp. |
| 50 | * |
| 51 | * @param string $cutoffDate ISO-8601 or MySQL datetime cutoff. |
| 52 | * @return int Number of pruned records. |
| 53 | */ |
| 54 | public function pruneOlderThan(string $cutoffDate): int; |
| 55 | } |