# CveEnricher

> Adds CVE identifiers to audit findings, resolving every unique GHSA advisory in a single batch.

[API reference](/docs/api/index.md) › [Foxy](/docs/extensions/foxy/reference/index.md) › [Audit](/docs/extensions/foxy/reference/audit/index.md) › CveEnricher

| final readonly class | `Foxy\Audit\CveEnricher` |
| --- | --- |
| Source | [`src/Audit/CveEnricher.php`](https://github.com/php-forge/foxy/blob/main/src/Audit/CveEnricher.php#L18) |

Adds CVE identifiers to audit findings, resolving every unique GHSA advisory in a single batch.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates an enricher backed by the supplied CVE resolver. | `CveEnricher` |
| [`enrich()`](#method-enrich) | Returns the report with a CVE resolution on every finding, in the original order. | `CveEnricher` |

## Method details

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

```php
public function __construct(Foxy\Audit\CveResolverInterface $resolver)
```

Creates an enricher backed by the supplied CVE resolver.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$resolver` | [`CveResolverInterface`](/docs/extensions/foxy/reference/audit/cveresolverinterface/index.md) |  |

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

```php
public function enrich(Foxy\Audit\AuditReport $report, callable(string): void $warningHandler): Foxy\Audit\AuditReport
```

Returns the report with a CVE resolution on every finding, in the original order.

A failed lookup never fails the audit: its advisory is marked `unavailable` and reported once to the handler.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$report` | [`AuditReport`](/docs/extensions/foxy/reference/audit/auditreport/index.md) | Report whose findings are enriched. |
| `$warningHandler` | `callable(string): void` | Receives one warning per GHSA identifier whose lookup failed. |

**Returns**

[`AuditReport`](/docs/extensions/foxy/reference/audit/auditreport/index.md)