# AuditReport

> Contains normalized findings and diagnostics from one package manager audit.

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

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

Contains normalized findings and diagnostics from one package manager audit.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-diagnostics"></span>`$diagnostics` readonly constructor | `string` | Diagnostic output emitted by the package manager. Default: `''`. | `AuditReport` |
| <span id="property-findings"></span>`$findings` readonly constructor | `list<`[`AuditFinding`](/docs/extensions/foxy/reference/audit/auditfinding/index.md)`>` | Normalized security findings. | `AuditReport` |
| <span id="property-manager"></span>`$manager` readonly constructor | `string` | Package manager that produced the report. | `AuditReport` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates an immutable audit report. | `AuditReport` |
| [`countPackages()`](#method-countPackages) | Returns the number of distinct affected packages. | `AuditReport` |
| [`countSeverities()`](#method-countSeverities) | Counts findings for every supported severity. | `AuditReport` |
| [`hasFindingAtLeast()`](#method-hasFindingAtLeast) | Whether any finding meets or exceeds the minimum severity. | `AuditReport` |
| [`withFindings()`](#method-withFindings) | Returns a copy with the supplied findings. | `AuditReport` |

## Method details

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

```php
public function __construct(string $manager, list<Foxy\Audit\AuditFinding> $findings, string $diagnostics = '')
```

Creates an immutable audit report.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$manager` | `string` | Package manager that produced the report. |
| `$findings` | `list<`[`AuditFinding`](/docs/extensions/foxy/reference/audit/auditfinding/index.md)`>` | Normalized security findings. |
| `$diagnostics` | `string` | Diagnostic output emitted by the package manager. |

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

```php
public function countPackages(): int
```

Returns the number of distinct affected packages.

**Returns**

`int`

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

```php
public function countSeverities(): array<string, int>
```

Counts findings for every supported severity.

**Returns**

`array<string, int>`

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

```php
public function hasFindingAtLeast(Foxy\Audit\Severity $minimumSeverity): bool
```

Whether any finding meets or exceeds the minimum severity.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$minimumSeverity` | [`Severity`](/docs/extensions/foxy/reference/audit/severity/index.md) |  |

**Returns**

`bool`

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

```php
public function withFindings(list<Foxy\Audit\AuditFinding> $findings): self
```

Returns a copy with the supplied findings.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$findings` | `list<`[`AuditFinding`](/docs/extensions/foxy/reference/audit/auditfinding/index.md)`>` | Replacement findings. |

**Returns**

`self`