# PruneCommand

> Lists the files that no allowed provider ships anymore and, with --force, removes them from the lock and deletes the ones that hold only provider content.

[API reference](/docs/api/index.md) › [Scaffold](/docs/extensions/scaffold/reference/index.md) › [Console](/docs/extensions/scaffold/reference/console/index.md) › [Command](/docs/extensions/scaffold/reference/console/command/index.md) › PruneCommand

| final class | `PHPForge\Scaffold\Console\Command\PruneCommand` |
| --- | --- |
| Extends | [`AbstractScaffoldCommand`](/docs/extensions/scaffold/reference/console/command/abstractscaffoldcommand/index.md) » `Symfony\Component\Console\Command\Command` |
| Source | [`src/Console/Command/PruneCommand.php`](https://github.com/php-forge/scaffold/blob/main/src/Console/Command/PruneCommand.php#L17) |

Lists the files that no allowed provider ships anymore and, with `--force`, removes them from the lock and deletes
the ones that hold only provider content.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`configure()`](#method-configure) protected | Declares the `--force`, `--delete-modified` and `--exit-code` options. | `PruneCommand` |
| <span id="method-execute"></span>[`execute()`](/docs/extensions/scaffold/reference/console/command/abstractscaffoldcommand/index.md#method-execute) protected final | Validates the input, resolves the project root and runs [`AbstractScaffoldCommand::handle()`](/docs/extensions/scaffold/reference/console/command/abstractscaffoldcommand/index.md#method-handle). | [`AbstractScaffoldCommand`](/docs/extensions/scaffold/reference/console/command/abstractscaffoldcommand/index.md) |
| [`handle()`](#method-handle) protected | Previews or prunes the orphaned entries. | `PruneCommand` |
| <span id="method-validate"></span>[`validate()`](/docs/extensions/scaffold/reference/console/command/abstractscaffoldcommand/index.md#method-validate) protected | Returns whether the input is valid, writing the error to the error output when it is not. | [`AbstractScaffoldCommand`](/docs/extensions/scaffold/reference/console/command/abstractscaffoldcommand/index.md) |

## Method details

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

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

Declares the `--force`, `--delete-modified` and `--exit-code` options.

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

```php
protected function handle(Symfony\Component\Console\Input\InputInterface $input, PHPForge\Scaffold\Console\SymfonyOutputWriter $out, string $projectRoot): int
```

Previews or prunes the orphaned entries.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$input` | `Symfony\Component\Console\Input\InputInterface` | Input with the `--force`, `--delete-modified` and `--exit-code` options. |
| `$out` | [`PHPForge\Scaffold\Console\SymfonyOutputWriter`](/docs/extensions/scaffold/reference/console/symfonyoutputwriter/index.md) | Output sink that receives the orphan report and the error messages. |
| `$projectRoot` | `string` | Absolute path of the project root. |

**Returns**

`int`: Exit code of [`PruneService::run()`](/docs/extensions/scaffold/reference/services/pruneservice/index.md#method-run).