PlatformAuditService
in package
Table of Contents
Properties
- $connection : Connection
- $wormFailClosed : bool|null
- $wormSink : WormAuditSinkInterface|null
Methods
- __construct() : mixed
- Constructor.
- record() : array<string, mixed>
- Persist a platform audit event and mirror it to the configured immutable sink.
- canonicalEventJson() : string
- encodeMetadata() : string
- formatTime() : string
- Format timestamps consistently for the platform database.
- lastAuditHash() : string|null
- Return the latest audit hash for platform database hash chaining.
- mirror() : void
- Mirror an event to the configured WORM sink.
- shouldFailClosed() : bool
- Return whether audit persistence should fail when WORM mirroring fails.
Properties
$connection read-only
private
Connection
$connection
$wormFailClosed read-only
private
bool|null
$wormFailClosed
= null
$wormSink read-only
private
WormAuditSinkInterface|null
$wormSink
= null
Methods
__construct()
Constructor.
public
__construct(Connection $connection[, WormAuditSinkInterface|null $wormSink = null ][, bool|null $wormFailClosed = null ]) : mixed
Parameters
- $connection : Connection
- $wormSink : WormAuditSinkInterface|null = null
- $wormFailClosed : bool|null = null
record()
Persist a platform audit event and mirror it to the configured immutable sink.
public
record(string $action[, string|null $platformUserId = null ][, string|null $subjectType = null ][, string|null $subjectId = null ][, string|null $reason = null ][, array<string, mixed> $metadata = [] ][, bool $withTransaction = true ][, array<string, mixed> $options = [] ]) : array<string, mixed>
Parameters
- $action : string
- $platformUserId : string|null = null
- $subjectType : string|null = null
- $subjectId : string|null = null
- $reason : string|null = null
- $metadata : array<string, mixed> = []
- $withTransaction : bool = true
- $options : array<string, mixed> = []
Return values
array<string, mixed> —Persisted audit event payload
canonicalEventJson()
private
canonicalEventJson(array<string, mixed> $event) : string
Parameters
- $event : array<string, mixed>
Return values
stringencodeMetadata()
private
encodeMetadata(array<string, mixed> $metadata) : string
Parameters
- $metadata : array<string, mixed>
Return values
stringformatTime()
Format timestamps consistently for the platform database.
private
formatTime(DateTimeInterface|string $time) : string
Parameters
- $time : DateTimeInterface|string
Return values
stringlastAuditHash()
Return the latest audit hash for platform database hash chaining.
private
lastAuditHash() : string|null
Return values
string|nullmirror()
Mirror an event to the configured WORM sink.
private
mirror(array<string, mixed> $event) : void
Parameters
- $event : array<string, mixed>
shouldFailClosed()
Return whether audit persistence should fail when WORM mirroring fails.
private
shouldFailClosed() : bool