# EventCapture

> Bounds and sanitizes explicitly selected event diagnostics without inspecting arbitrary objects.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Panel](/docs/extensions/debug-core/reference/panel/index.md) › [Event](/docs/extensions/debug-core/reference/panel/event/index.md) › EventCapture

| final class | `PHPForge\Debug\Panel\Event\EventCapture` |
| --- | --- |
| Source | [`src/Panel/Event/EventCapture.php`](https://github.com/php-forge/debug-core/blob/main/src/Panel/Event/EventCapture.php#L23) |

Bounds and sanitizes explicitly selected event diagnostics without inspecting arbitrary objects.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`context()`](#method-context) static | Bounds and sanitizes the adapter-selected context fields. | `EventCapture` |
| [`trace()`](#method-trace) static | Bounds and sanitizes the source frames observed when an event fired. | `EventCapture` |

## Method details

### context() <span id="method-context"></span>

```php
public static function context(array<string, string> $fields): array<string, string>
```

Bounds and sanitizes the adapter-selected context fields.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$fields` | `array<string, string>` | Adapter-selected fields only. |

**Returns**

`array<string, string>`: At most sixteen sanitized fields, with sensitive values replaced by `[redacted]`.

### trace() <span id="method-trace"></span>

```php
public static function trace(list<array<string, mixed>> $frames, int $limit, list<string> $skipFiles = []): list<string>
```

Bounds and sanitizes the source frames observed when an event fired.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$frames` | `list<array<string, mixed>>` | Backtrace acquired with `DEBUG_BACKTRACE_IGNORE_ARGS`. |
| `$limit` | `int` | Maximum frames; hard-limited to sixteen. |
| `$skipFiles` | `list<string>` | Adapter instrumentation files to omit. |

**Returns**

`list<string>`: Sanitized `file:line` frames in call order.