# AssetManagerInterface

> Defines frontend dependency manager operations used by the Foxy solver.

[API reference](/docs/api/index.md) › [Foxy](/docs/extensions/foxy/reference/index.md) › [Asset](/docs/extensions/foxy/reference/asset/index.md) › AssetManagerInterface

| interface | `Foxy\Asset\AssetManagerInterface` |
| --- | --- |
| Source | [`src/Asset/AssetManagerInterface.php`](https://github.com/php-forge/foxy/blob/main/src/Asset/AssetManagerInterface.php#L14) |

Implemented by 1 type:

- [`AbstractManifestAssetManager`](/docs/extensions/foxy/reference/asset/abstractmanifestassetmanager/index.md)

Defines frontend dependency manager operations used by the Foxy solver.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`addDependencies()`](#method-addDependencies) abstract | Add the asset dependencies in asset package file. | `AssetManagerInterface` |
| [`audit()`](#method-audit) abstract | Runs the security audit of the locked dependencies. | `AssetManagerInterface` |
| [`getAuditParser()`](#method-getAuditParser) abstract | Returns the parser of this manager's audit report. | `AssetManagerInterface` |
| [`getLockPackageName()`](#method-getLockPackageName) abstract | Get the filename of the lock file. | `AssetManagerInterface` |
| [`getName()`](#method-getName) abstract | Get the name of asset manager. | `AssetManagerInterface` |
| [`getPackageName()`](#method-getPackageName) abstract | Get the filename of the asset package. | `AssetManagerInterface` |
| [`getVersionConstraint()`](#method-getVersionConstraint) abstract | Get the supported version constraint of the asset manager. | `AssetManagerInterface` |
| [`hasLockFile()`](#method-hasLockFile) abstract | Check if the lock file is present or not. | `AssetManagerInterface` |
| [`isAvailable()`](#method-isAvailable) abstract | Check if the asset manager is available. | `AssetManagerInterface` |
| [`isInstalled()`](#method-isInstalled) abstract | Check if the asset dependencies are installed or not. | `AssetManagerInterface` |
| [`isUpdatable()`](#method-isUpdatable) abstract | Check if the asset manager can be use the update command or not. | `AssetManagerInterface` |
| [`run()`](#method-run) abstract | Run the asset manager to install/update the asset dependencies. | `AssetManagerInterface` |
| [`setUpdatable()`](#method-setUpdatable) abstract | Define if the asset manager can be use the update command. | `AssetManagerInterface` |
| [`validate()`](#method-validate) abstract | Validate the version of asset manager. | `AssetManagerInterface` |

## Method details

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

```php
abstract public function addDependencies(Composer\Package\RootPackageInterface $rootPackage, array $dependencies): Foxy\Asset\AssetPackageInterface
```

Add the asset dependencies in asset package file.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$rootPackage` | `Composer\Package\RootPackageInterface` | The composer root package |
| `$dependencies` | `array` | The asset local dependencies |

**Returns**

[`AssetPackageInterface`](/docs/extensions/foxy/reference/asset/assetpackageinterface/index.md)

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

```php
abstract public function audit(bool $noDev): Foxy\Audit\AuditProcessResult
```

Runs the security audit of the locked dependencies.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$noDev` | `bool` | Whether to exclude development dependencies; managers that cannot exclude them throw. |

**Returns**

[`Foxy\Audit\AuditProcessResult`](/docs/extensions/foxy/reference/audit/auditprocessresult/index.md)

**Throws**

- [`Foxy\Exception\RuntimeException`](/docs/extensions/foxy/reference/exception/runtimeexception/index.md): if the lock file is missing, the manager cannot honor `$noDev`, or the audit cannot run.

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

```php
abstract public function getAuditParser(): Foxy\Audit\AuditParserInterface
```

Returns the parser of this manager's audit report.

**Returns**

[`Foxy\Audit\AuditParserInterface`](/docs/extensions/foxy/reference/audit/auditparserinterface/index.md)

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

```php
abstract public function getLockPackageName(): string
```

Get the filename of the lock file.

**Returns**

`string`

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

```php
abstract public function getName(): string
```

Get the name of asset manager.

**Returns**

`string`

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

```php
abstract public function getPackageName(): string
```

Get the filename of the asset package.

**Returns**

`string`

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

```php
abstract public function getVersionConstraint(): string
```

Get the supported version constraint of the asset manager.

**Returns**

`string`

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

```php
abstract public function hasLockFile(): bool
```

Check if the lock file is present or not.

**Returns**

`bool`

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

```php
abstract public function isAvailable(): bool
```

Check if the asset manager is available.

**Returns**

`bool`

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

```php
abstract public function isInstalled(): bool
```

Check if the asset dependencies are installed or not.

**Returns**

`bool`

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

```php
abstract public function isUpdatable(): bool
```

Check if the asset manager can be use the update command or not.

**Returns**

`bool`

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

```php
abstract public function run(): int
```

Run the asset manager to install/update the asset dependencies.

**Returns**

`int`

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

```php
abstract public function setUpdatable(bool $updatable): self
```

Define if the asset manager can be use the update command.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$updatable` | `bool` | The value |

**Returns**

`self`

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

```php
abstract public function validate(): void
```

Validate the version of asset manager.

**Throws**

- [`Foxy\Exception\RuntimeException`](/docs/extensions/foxy/reference/exception/runtimeexception/index.md): When the binary isn't installed
- [`Foxy\Exception\RuntimeException`](/docs/extensions/foxy/reference/exception/runtimeexception/index.md): When the version doesn't match