Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
NotificationAuditService
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 log
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Modules\NotificationModule\Services;
4
5use App\Modules\NotificationModule\Models\NotificationAuditLogModel;
6
7class NotificationAuditService
8{
9    protected NotificationAuditLogModel $model;
10
11    public function __construct()
12    {
13        $this->model = new NotificationAuditLogModel();
14    }
15
16    /**
17     * Journalisation complète
18     */
19    public function log(
20        int $notificationId,
21        string $provider,
22        array $request,
23        array $response,
24        string $status,
25        ?int $latencyMs = null
26    ): void {
27
28        $this->model->insert([
29            'notification_id' => $notificationId,
30            'provider'        => $provider,
31            'request'         => json_encode($request),
32            'response'        => json_encode($response),
33            'status'          => $status,
34            'latency_ms'      => $latencyMs,
35            'created_at'      => date('Y-m-d H:i:s'),
36        ]);
37
38        log_message(
39            'info',
40            "[AUDIT_LOG] notification={$notificationId} provider={$provider} status={$status}"
41        );
42    }
43}