# AuditCommand

> Audits frontend dependencies and renders normalized vulnerability findings.

[API reference](/docs/api/index.md) › [Foxy](/docs/extensions/foxy/reference/index.md) › [Command](/docs/extensions/foxy/reference/command/index.md) › AuditCommand

| final class | `Foxy\Command\AuditCommand` |
| --- | --- |
| Extends | `Composer\Command\BaseCommand` |
| Source | [`src/Command/AuditCommand.php`](https://github.com/php-forge/foxy/blob/main/src/Command/AuditCommand.php#L30) |

Audits frontend dependencies and renders normalized vulnerability findings.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates the audit command and its optional CVE resolver. | `AuditCommand` |
| [`configure()`](#method-configure) protected | Configures the audit command options and help text. | `AuditCommand` |
| [`execute()`](#method-execute) protected | Runs the audit and returns its stable command status. | `AuditCommand` |

## Constants

| Constant | Value | Description | Defined by |
| --- | --- | --- | --- |
| <span id="const-STATUS_FAILED"></span>`STATUS_FAILED` | `2` |  | `AuditCommand` |
| <span id="const-STATUS_OK"></span>`STATUS_OK` | `0` |  | `AuditCommand` |
| <span id="const-STATUS_VULNERABLE"></span>`STATUS_VULNERABLE` | `1` |  | `AuditCommand` |

## Method details

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

```php
public function __construct(Foxy\Audit\AuditRunnerInterface $runner, Foxy\Audit\AuditFormatter $formatter = new \Foxy\Audit\AuditFormatter(), Foxy\Audit\CveResolverInterface|null $cveResolver = null)
```

Creates the audit command and its optional CVE resolver.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$runner` | [`Foxy\Audit\AuditRunnerInterface`](/docs/extensions/foxy/reference/audit/auditrunnerinterface/index.md) | Runs the selected package manager audit. |
| `$formatter` | [`Foxy\Audit\AuditFormatter`](/docs/extensions/foxy/reference/audit/auditformatter/index.md) | Renders the normalized report. |
| `$cveResolver` | [`Foxy\Audit\CveResolverInterface`](/docs/extensions/foxy/reference/audit/cveresolverinterface/index.md)`\|null` | Resolves GHSA advisories to CVE identifiers. |

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

```php
protected function configure(): void
```

Configures the audit command options and help text.

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

```php
protected function execute(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output): int
```

Runs the audit and returns its stable command status.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$input` | `Symfony\Component\Console\Input\InputInterface` |  |
| `$output` | `Symfony\Component\Console\Output\OutputInterface` |  |

**Returns**

`int`