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\Api\Domain\Repository; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | use App\Core\Api\Domain\Model\ApiLogDetail; |
| 12 | use App\Core\Api\Domain\Model\ApiLogEntry; |
| 13 | |
| 14 | /** |
| 15 | * API Request Logger Repository Interface. |
| 16 | * |
| 17 | * Defines persistence contract for API access logs and performance metrics (NIST AU-3 / AU-9). |
| 18 | * |
| 19 | * @package App\Core\Api\Domain\Repository |
| 20 | */ |
| 21 | interface ApiLoggerInterface |
| 22 | { |
| 23 | /** |
| 24 | * Records an API request entry and optional payload details. |
| 25 | * |
| 26 | * @param ApiLogEntry $entry Request metadata value object. |
| 27 | * @param ApiLogDetail|null $detail Optional payload and exception dump. |
| 28 | * @return void |
| 29 | */ |
| 30 | public function logRequest(ApiLogEntry $entry, ?ApiLogDetail $detail = null): void; |
| 31 | |
| 32 | /** |
| 33 | * Purges expired API logs based on retention policy. |
| 34 | * |
| 35 | * @param int $standardRetentionDays Days to keep normal (2xx/3xx fast) request logs. |
| 36 | * @param int $errorRetentionDays Days to keep error (4xx/5xx) and slow request logs. |
| 37 | * @return int Total deleted records count. |
| 38 | */ |
| 39 | public function purgeExpiredLogs(int $standardRetentionDays = 14, int $errorRetentionDays = 90): int; |
| 40 | } |