refactor(audit): extract audit domain into self-contained module

Move the entire audit subsystem (system audit, API audit, import audit,
user lifecycle audit, frontend telemetry) from core into modules/audit/.

Core decoupling via interface-based injection:
- AuditRecorderInterface replaces SystemAuditService in 10+ core services
- UserLifecycleAuditInterface / ImportAuditInterface for specialized flows
- NullAuditRecorder fallback when audit module is disabled
- ApiBootstrap/ApiResponse use null-safe callable resolvers

Module structure (modules/audit/):
- Manifest with routes, permissions, scheduler jobs, authorization policy
- 9 services, 8 repositories, 6 domain enums, 4 job handlers
- 33 page files, 4 JS files, 8 test files, migration scripts, i18n

Core cleanup:
- OperationsAuthorizationPolicy, UiCapabilityMap, PermissionService
  surgically cleaned of audit-specific constants
- Sidebar template cleared of hardcoded audit navigation
- AuditModuleIsolationContractTest ensures no future core→module coupling

All quality gates pass: 1346 tests (19,276 assertions), PHPStan level 5
clean, architecture contracts verified.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-25 21:12:49 +01:00
parent 12a837bda9
commit 0c351f6aff
176 changed files with 2157 additions and 834 deletions

View File

@@ -0,0 +1,49 @@
<?php
use MintyPHP\Module\Audit\AuditAuthorizationPolicy;
use MintyPHP\Module\Audit\Service\ApiAuditService;
use MintyPHP\Support\Guard;
Guard::requireLogin();
Guard::requireAbilityOrForbidden(AuditAuthorizationPolicy::ABILITY_API_AUDIT_VIEW);
gridRequireGetRequest();
$filters = gridParseFiltersFromSchemaFile(__DIR__ . '/filter-schema.php');
$result = app(ApiAuditService::class)->listPaged($filters);
$rows = [];
foreach ($result['rows'] as $row) {
$statusCode = (int) ($row['status_code'] ?? 0);
$statusBadge = gridResolveBadgeVariant(
$statusCode >= 500 ? '5xx' : ($statusCode >= 400 ? '4xx' : ($statusCode >= 200 ? '2xx' : 'other')),
['2xx' => 'success', '4xx' => 'warning', '5xx' => 'danger']
);
$userLabel = trim((string) ($row['user_display_name'] ?? ''));
$userEmail = trim((string) ($row['user_email'] ?? ''));
if ($userLabel === '') {
$userLabel = $userEmail !== '' ? $userEmail : '-';
}
$rows[] = [
'id' => (int) ($row['id'] ?? 0),
'request_id' => (string) ($row['request_id'] ?? ''),
'created_at' => dt((string) ($row['created_at'] ?? '')),
'method' => strtoupper((string) ($row['method'] ?? '')),
'path' => (string) ($row['path'] ?? ''),
'status_code' => $statusCode,
'status_badge' => $statusBadge,
'duration_ms' => (int) ($row['duration_ms'] ?? 0),
'error_code' => (string) ($row['error_code'] ?? ''),
'tenant_id' => (int) ($row['tenant_id'] ?? 0),
'tenant_label' => (string) ($row['tenant_description'] ?? ''),
'tenant_uuid' => (string) ($row['tenant_uuid'] ?? ''),
'user_id' => (int) ($row['user_id'] ?? 0),
'user_label' => $userLabel,
'user_uuid' => (string) ($row['user_uuid'] ?? ''),
'ip' => (string) ($row['ip'] ?? ''),
];
}
gridJsonDataResult($rows, (int) ($result['total'] ?? 0));

View File

@@ -0,0 +1,93 @@
<?php
return gridFilterSchema([
'query' => [
'limit' => ['type' => 'int', 'default' => 20, 'min' => 1, 'max' => 200],
'offset' => ['type' => 'int', 'default' => 0, 'min' => 0],
'search' => ['type' => 'string'],
'status' => ['type' => 'string'],
'method' => ['type' => 'enum', 'allowed' => ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'], 'default' => ''],
'created_from' => ['type' => 'date'],
'created_to' => ['type' => 'date'],
'tenant_ids' => ['type' => 'csv_ids', 'max' => 200],
'user_ids' => ['type' => 'csv_ids', 'max' => 200],
'order' => ['type' => 'order', 'allowed' => ['created_at', 'status_code', 'method', 'path', 'duration_ms'], 'default' => 'created_at'],
'dir' => ['type' => 'dir', 'default' => 'desc'],
],
'toolbar' => [
[
'key' => 'search',
'type' => 'text',
'label' => 'Search',
'placeholder' => 'Search...',
'input_id' => 'api-audit-search',
'search' => true,
'query' => ['type' => 'string'],
],
[
'key' => 'status',
'type' => 'select',
'label' => 'Status',
'input_id' => 'api-audit-status-filter',
'default' => '',
'allowed' => [
['id' => '', 'description' => 'All statuses'],
['id' => '2xx', 'description' => '2xx', 'translate' => false],
['id' => '4xx', 'description' => '4xx', 'translate' => false],
['id' => '5xx', 'description' => '5xx', 'translate' => false],
['id' => '401', 'description' => '401', 'translate' => false],
['id' => '403', 'description' => '403', 'translate' => false],
['id' => '404', 'description' => '404', 'translate' => false],
['id' => '422', 'description' => '422', 'translate' => false],
['id' => '500', 'description' => '500', 'translate' => false],
],
],
[
'key' => 'method',
'type' => 'select',
'label' => 'Method',
'input_id' => 'api-audit-method-filter',
'default' => '',
'allowed' => [
['id' => '', 'description' => 'All methods'],
['id' => 'GET', 'description' => 'GET', 'translate' => false],
['id' => 'POST', 'description' => 'POST', 'translate' => false],
['id' => 'PUT', 'description' => 'PUT', 'translate' => false],
['id' => 'PATCH', 'description' => 'PATCH', 'translate' => false],
['id' => 'DELETE', 'description' => 'DELETE', 'translate' => false],
],
],
[
'key' => 'created_from',
'type' => 'date',
'label' => 'Created from',
'input_id' => 'api-audit-created-from',
],
[
'key' => 'created_to',
'type' => 'date',
'label' => 'Created to',
'input_id' => 'api-audit-created-to',
],
[
'key' => 'tenant_ids',
'type' => 'multi_csv',
'label' => 'Tenants',
'placeholder' => 'Select tenants',
'input_id' => 'api-audit-tenant-ids-filter',
'options_key' => 'tenant_items',
'default' => [],
'query' => ['type' => 'csv_ids', 'max' => 200, 'return' => 'array'],
],
[
'key' => 'user_ids',
'type' => 'multi_csv',
'label' => 'Users',
'placeholder' => 'Select users',
'input_id' => 'api-audit-user-ids-filter',
'options_key' => 'user_items',
'default' => [],
'query' => ['type' => 'csv_ids', 'max' => 200, 'return' => 'array'],
],
],
]);

View File

@@ -0,0 +1,15 @@
<?php
use MintyPHP\Http\Request;
use MintyPHP\Router;
use MintyPHP\Support\Guard;
Guard::requireLogin();
$slug = trim((string) ($slug ?? ''));
if ($slug === '') {
require __DIR__ . '/index().php';
return;
}
Router::redirect('error/not_found?url=' . urlencode(Request::pathWithQuery()));

View File

@@ -0,0 +1,161 @@
<?php
use MintyPHP\Buffer;
use MintyPHP\Http\SessionStoreInterface;
use MintyPHP\Module\Audit\AuditAuthorizationPolicy;
use MintyPHP\Module\Audit\Service\ApiAuditService;
use MintyPHP\Service\Access\SettingsAuthorizationPolicy;
use MintyPHP\Service\Access\UiAccessService;
use MintyPHP\Support\Guard;
$session = app(SessionStoreInterface::class)->all();
Guard::requireLogin();
Guard::requireAbility(AuditAuthorizationPolicy::ABILITY_API_AUDIT_VIEW);
$viewAuth['page'] = app(UiAccessService::class)->pageCapabilities(
(int) ($session['user']['id'] ?? 0),
['can_purge' => SettingsAuthorizationPolicy::ABILITY_ADMIN_SETTINGS_UPDATE]
);
Buffer::set('title', t('API audit logs'));
Buffer::set('grid_lang', json_encode(gridLang(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
$filterSchema = require __DIR__ . '/filter-schema.php';
$filterState = gridParseFilters(requestInput()->queryAll(), [
...gridSchemaQuery($filterSchema),
'tenant_ids' => ['type' => 'csv_ids', 'max' => 200, 'return' => 'array'],
'user_ids' => ['type' => 'csv_ids', 'max' => 200, 'return' => 'array'],
]);
$filterOptions = app(ApiAuditService::class)->filterOptions(200);
$activeTenantIds = array_map('strval', is_array($filterState['tenant_ids'] ?? null) ? $filterState['tenant_ids'] : []);
$activeUserIds = array_map('strval', is_array($filterState['user_ids'] ?? null) ? $filterState['user_ids'] : []);
$apiAuditTenantItems = [];
foreach ((array) ($filterOptions['tenants'] ?? []) as $tenantOption) {
if (!is_array($tenantOption)) {
continue;
}
$tenantId = (int) ($tenantOption['id'] ?? 0);
if ($tenantId <= 0) {
continue;
}
$tenantLabel = trim((string) ($tenantOption['description'] ?? ''));
$tenantExists = (bool) ($tenantOption['exists'] ?? false);
if ($tenantLabel === '') {
$tenantLabel = $tenantExists
? sprintf(t('Tenant #%d'), $tenantId)
: sprintf(t('Tenant #%d (deleted)'), $tenantId);
}
$id = (string) $tenantId;
$apiAuditTenantItems[$id] = [
'id' => $id,
'description' => $tenantLabel,
];
}
foreach ($activeTenantIds as $tenantId) {
if (!isset($apiAuditTenantItems[$tenantId])) {
$apiAuditTenantItems[$tenantId] = [
'id' => $tenantId,
'description' => sprintf(t('Tenant #%d (deleted)'), (int) $tenantId),
];
}
}
$apiAuditTenantItems = array_values($apiAuditTenantItems);
$apiAuditUserItems = [];
foreach ((array) ($filterOptions['users'] ?? []) as $userOption) {
if (!is_array($userOption)) {
continue;
}
$userId = (int) ($userOption['id'] ?? 0);
if ($userId <= 0) {
continue;
}
$userDisplayName = trim((string) ($userOption['display_name'] ?? ''));
$userEmail = trim((string) ($userOption['email'] ?? ''));
$userExists = (bool) ($userOption['exists'] ?? false);
$userLabel = $userDisplayName !== '' ? $userDisplayName : $userEmail;
if ($userLabel === '') {
$userLabel = $userExists
? sprintf(t('User #%d'), $userId)
: sprintf(t('User #%d (deleted)'), $userId);
}
$id = (string) $userId;
$apiAuditUserItems[$id] = [
'id' => $id,
'description' => $userLabel,
];
}
foreach ($activeUserIds as $userId) {
if (!isset($apiAuditUserItems[$userId])) {
$apiAuditUserItems[$userId] = [
'id' => $userId,
'description' => sprintf(t('User #%d (deleted)'), (int) $userId),
];
}
}
$apiAuditUserItems = array_values($apiAuditUserItems);
$toolbarFilterState = [
'search' => (string) ($filterState['search'] ?? ''),
'status' => (string) ($filterState['status'] ?? ''),
'method' => (string) ($filterState['method'] ?? ''),
'created_from' => (string) ($filterState['created_from'] ?? ''),
'created_to' => (string) ($filterState['created_to'] ?? ''),
'tenant_ids' => $activeTenantIds,
'user_ids' => $activeUserIds,
];
$toolbarOptionSets = [
'tenant_items' => $apiAuditTenantItems,
'user_items' => $apiAuditUserItems,
];
$listFilterContext = gridBuildListFilterContext($filterSchema, [
'filter_state' => $filterState,
'search_keys' => ['search'],
'toolbar_state_overrides' => $toolbarFilterState,
'toolbar_option_sets' => $toolbarOptionSets,
]);
$toolbarFilterSchema = $listFilterContext['toolbarFilterSchema'];
$toolbarFilterState = $listFilterContext['toolbarFilterState'];
$searchToolbarFilterSchema = $listFilterContext['searchToolbarFilterSchema'];
$drawerToolbarFilterSchema = $listFilterContext['drawerToolbarFilterSchema'];
$schemaByKey = $listFilterContext['schemaByKey'];
$toolbarOptionSets = $listFilterContext['toolbarOptionSets'];
$filterChipMeta = [
'search' => [
'label' => t('Search'),
'type' => 'text',
],
'status' => [
'label' => t('Status'),
'type' => 'select',
'default' => (string) (($schemaByKey['status']['default'] ?? '')),
'options' => gridOptionMapFromAllowed((array) ($schemaByKey['status'] ?? [])),
],
'method' => [
'label' => t('Method'),
'type' => 'select',
'default' => (string) (($schemaByKey['method']['default'] ?? '')),
'options' => gridOptionMapFromAllowed((array) ($schemaByKey['method'] ?? [])),
],
'tenant_ids' => [
'label' => t('Tenants'),
'type' => 'multi_csv',
'options' => gridOptionMapFromItems($apiAuditTenantItems),
],
'user_ids' => [
'label' => t('Users'),
'type' => 'multi_csv',
'options' => gridOptionMapFromItems($apiAuditUserItems),
],
'created_range' => [
'label' => t('Created'),
'type' => 'date_range',
'from_param' => 'created_from',
'to_param' => 'created_to',
],
];
$clientFilterSchema = $listFilterContext['clientFilterSchema'];
$searchConfig = $listFilterContext['searchConfig'];

View File

@@ -0,0 +1,69 @@
<?php
$pageAuth = is_array($viewAuth['page'] ?? null) ? $viewAuth['page'] : [];
$canPurgeApiAudit = (bool) ($pageAuth['can_purge'] ?? false);
$toolbarFilterSchema = is_array($toolbarFilterSchema ?? null) ? $toolbarFilterSchema : [];
$searchToolbarFilterSchema = is_array($searchToolbarFilterSchema ?? null) ? $searchToolbarFilterSchema : [];
$drawerToolbarFilterSchema = is_array($drawerToolbarFilterSchema ?? null) ? $drawerToolbarFilterSchema : [];
$toolbarFilterState = is_array($toolbarFilterState ?? null) ? $toolbarFilterState : [];
$toolbarOptionSets = is_array($toolbarOptionSets ?? null) ? $toolbarOptionSets : [];
$filterChipMeta = is_array($filterChipMeta ?? null) ? $filterChipMeta : [];
$clientFilterSchema = is_array($clientFilterSchema ?? null) ? $clientFilterSchema : [];
$searchConfig = is_array($searchConfig ?? null) ? $searchConfig : null;
?>
<?php
$breadcrumbs = [
['label' => t('Home'), 'path' => 'admin'],
['label' => t('API audit logs')],
];
require templatePath('partials/app-breadcrumb.phtml');
?>
<?php
$listTitle = t('API audit logs');
ob_start();
?>
<?php
$listPurgeEnabled = $canPurgeApiAudit;
$listPurgeFormId = 'api-audit-purge-form';
$listPurgeAction = 'admin/api-audit/purge';
$listPurgeConfirmMessage = t('Purge entries older than 90 days?');
$listPurgeButtonLabel = t('Purge API audit logs');
require templatePath('partials/app-list-purge-action.phtml');
?>
<?php
$listTitleActionsHtml = ob_get_clean();
require templatePath('partials/app-list-titlebar.phtml');
?>
<?php
$filterUiNamespace = 'api-audit';
require templatePath('partials/app-list-filters.phtml');
?>
<div class="app-list-table">
<div id="api-audit-grid"></div>
</div>
<?php
$gridLang = json_decode(appBufferValue('grid_lang'), true);
if (!is_array($gridLang)) {
$gridLang = [];
}
$pageConfig = [
'gridSearch' => $searchConfig,
'filterSchema' => $clientFilterSchema,
'filterChipMeta' => $filterChipMeta,
'gridLang' => $gridLang,
'labels' => [
'created' => t('Created'),
'statusCode' => t('Status code'),
'method' => t('Method'),
'path' => t('Path'),
'durationMs' => t('Duration (ms)'),
'user' => t('User'),
'tenant' => t('Tenant'),
'errorCode' => t('Error code'),
'ip' => t('IP'),
],
];
?>
<script src="<?php e(assetVersion('vendor/gridjs/gridjs.umd.js')); ?>"></script>
<script type="application/json" id="page-config-admin-api-audit-index"><?php gridJsonForJs($pageConfig); ?></script>
<script type="module" src="<?php e(assetVersion('modules/audit/js/pages/admin-api-audit-index.js')); ?>"></script>

View File

@@ -0,0 +1,23 @@
<?php
use MintyPHP\Router;
use MintyPHP\Session;
use MintyPHP\Support\Flash;
use MintyPHP\Support\Guard;
Guard::requireLogin();
Guard::requireAbility(\MintyPHP\Service\Access\SettingsAuthorizationPolicy::ABILITY_ADMIN_SETTINGS_UPDATE);
if (strtoupper((string) (requestInput()->method())) !== 'POST') {
Router::redirect('admin/api-audit');
}
$errorBag = formErrors();
if (!Session::checkCsrfToken()) {
$errorBag->addGlobal(t('Form expired, please try again'));
flashFormErrors($errorBag, 'admin/api-audit', 'api_audit');
Router::redirect('admin/api-audit');
}
$deleted = app(\MintyPHP\Module\Audit\Service\ApiAuditService::class)->purgeExpired();
Flash::success(sprintf(t('%d API audit entries purged'), $deleted), 'admin/api-audit', 'api_audit_purged');
Router::redirect('admin/api-audit');

View File

@@ -0,0 +1,18 @@
<?php
use MintyPHP\Buffer;
use MintyPHP\Router;
use MintyPHP\Support\Flash;
use MintyPHP\Support\Guard;
Guard::requireLogin();
Guard::requireAbility(\MintyPHP\Module\Audit\AuditAuthorizationPolicy::ABILITY_API_AUDIT_VIEW);
$auditId = (int) ($id ?? 0);
$auditLog = $auditId > 0 ? app(\MintyPHP\Module\Audit\Service\ApiAuditService::class)->find($auditId) : null;
if (!$auditLog) {
Flash::error('API audit entry not found', 'admin/api-audit', 'api_audit_not_found');
Router::redirect('admin/api-audit');
}
Buffer::set('title', t('View API audit entry'));

View File

@@ -0,0 +1,193 @@
<?php
/**
* @var array $auditLog
*/
$auditLog = $auditLog ?? [];
$statusCode = (int) ($auditLog['status_code'] ?? 0);
$statusVariant = 'neutral';
if ($statusCode >= 200 && $statusCode < 300) {
$statusVariant = 'success';
} elseif ($statusCode >= 400 && $statusCode < 500) {
$statusVariant = 'warning';
} elseif ($statusCode >= 500) {
$statusVariant = 'danger';
}
$queryJson = trim((string) ($auditLog['query_json'] ?? ''));
$queryPretty = '-';
if ($queryJson !== '') {
$decoded = json_decode($queryJson, true);
if (is_array($decoded)) {
$pretty = json_encode($decoded, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$queryPretty = is_string($pretty) ? $pretty : $queryJson;
} else {
$queryPretty = $queryJson;
}
}
$userLabel = trim((string) ($auditLog['user_display_name'] ?? ''));
$userEmail = trim((string) ($auditLog['user_email'] ?? ''));
if ($userLabel === '') {
$userLabel = $userEmail !== '' ? $userEmail : '-';
}
$tenantLabel = trim((string) ($auditLog['tenant_description'] ?? ''));
if ($tenantLabel === '') {
$tenantLabel = '-';
}
$requestId = trim((string) ($auditLog['request_id'] ?? ''));
$method = strtoupper(trim((string) ($auditLog['method'] ?? '')));
$path = trim((string) ($auditLog['path'] ?? ''));
$errorCode = trim((string) ($auditLog['error_code'] ?? ''));
$ip = trim((string) ($auditLog['ip'] ?? ''));
$userAgent = trim((string) ($auditLog['user_agent'] ?? ''));
$durationMs = (int) ($auditLog['duration_ms'] ?? 0);
$tokenId = (int) ($auditLog['api_token_id'] ?? 0);
$tokenTenantId = (int) ($auditLog['token_tenant_id'] ?? 0);
?>
<div class="app-details-container">
<section>
<?php
$breadcrumbs = [
['label' => t('Home'), 'path' => 'admin'],
['label' => t('API audit logs'), 'path' => 'admin/api-audit'],
['label' => t('View')],
];
require templatePath('partials/app-breadcrumb.phtml');
$titlebar = [
'title' => t('View API audit entry'),
'backHref' => 'admin/api-audit',
'backTitle' => t('Back'),
];
require templatePath('partials/app-details-titlebar.phtml');
?>
<div class="app-details-content">
<details open>
<summary><?php e(t('Request details')); ?></summary>
<hr>
<div class="grid">
<div>
<small><?php e(t('Method')); ?></small>
<p><span class="badge" data-variant="neutral"><?php e($method !== '' ? $method : '-'); ?></span></p>
</div>
<div>
<small><?php e(t('Path')); ?></small>
<p><code><?php e($path !== '' ? $path : '-'); ?></code></p>
</div>
</div>
<?php if ($errorCode !== '' || $ip !== ''): ?>
<div class="grid">
<div>
<small><?php e(t('Error code')); ?></small>
<p><?php e($errorCode !== '' ? $errorCode : '-'); ?></p>
</div>
<div>
<small><?php e(t('IP')); ?></small>
<p><?php e($ip !== '' ? $ip : '-'); ?></p>
</div>
</div>
<?php endif; ?>
<?php if ($userAgent !== ''): ?>
<div>
<small><?php e(t('User agent')); ?></small>
<textarea readonly rows="3"><?php e($userAgent); ?></textarea>
</div>
<?php endif; ?>
</details>
<hr>
<details open>
<summary><?php e(t('Scope')); ?></summary>
<hr>
<div class="grid">
<div>
<small><?php e(t('User')); ?></small>
<p>
<?php if (!empty($auditLog['user_uuid'])): ?>
<a href="admin/users/edit/<?php e($auditLog['user_uuid']); ?>"><?php e($userLabel); ?></a>
<?php else: ?>
<?php e($userLabel); ?>
<?php endif; ?>
</p>
</div>
<div>
<small><?php e(t('Tenant')); ?></small>
<p>
<?php if (!empty($auditLog['tenant_uuid'])): ?>
<a href="admin/tenants/edit/<?php e($auditLog['tenant_uuid']); ?>"><?php e($tenantLabel); ?></a>
<?php else: ?>
<?php e($tenantLabel); ?>
<?php endif; ?>
</p>
</div>
</div>
<?php if ($tokenId > 0 || $tokenTenantId > 0): ?>
<div class="grid">
<div>
<small><?php e(t('Token ID')); ?></small>
<p><?php e($tokenId > 0 ? (string) $tokenId : '-'); ?></p>
</div>
<div>
<small><?php e(t('Token tenant')); ?></small>
<p><?php e($tokenTenantId > 0 ? (string) $tokenTenantId : '-'); ?></p>
</div>
</div>
<?php endif; ?>
</details>
<?php if ($queryPretty !== '-'): ?>
<hr>
<details>
<summary><?php e(t('Query')); ?></summary>
<hr>
<textarea readonly rows="12"><?php e($queryPretty); ?></textarea>
</details>
<?php endif; ?>
</div>
</section>
<aside id="app-details-aside-section">
<div class="app-details-aside-section">
<hgroup>
<strong><?php e(t('API audit')); ?></strong>
<p><small><?php e($requestId !== '' ? $requestId : '-'); ?></small></p>
</hgroup>
<hr>
<div class="grid">
<div>
<small><?php e(t('ID')); ?></small>
<p>
<span class="badge" data-variant="neutral" data-copy="true" data-copy-value="<?php e((string) ($auditLog['id'] ?? '')); ?>">
<?php e((string) ($auditLog['id'] ?? '-')); ?>
</span>
</p>
</div>
<div>
<small><?php e(t('Status')); ?></small>
<p><span class="badge" data-variant="<?php e($statusVariant); ?>"><?php e((string) $statusCode); ?></span></p>
</div>
</div>
<div>
<small><?php e(t('Request ID')); ?></small>
<p>
<span class="badge" data-variant="neutral" data-copy="true" data-copy-value="<?php e($requestId); ?>">
<?php e($requestId !== '' ? substr($requestId, 0, 10) : '-'); ?>
</span>
</p>
</div>
<div>
<small><?php e(t('Created')); ?></small>
<p><?php e(dt((string) ($auditLog['created_at'] ?? '')) ?: '-'); ?></p>
</div>
<div>
<small><?php e(t('Duration (ms)')); ?></small>
<p><?php e($durationMs > 0 ? (string) $durationMs : '-'); ?></p>
</div>
</div>
</aside>
</div>