PruneService
API reference › Scaffold › Services › PruneService
Reports the orphaned entries of scaffold-lock.json and, when forced, removes them from the lock and deletes the
orphaned files that hold only provider content.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
run() | Previews or prunes the orphaned entries of the project lock, ending with a summary line. | PruneService |
Method details
Section titled “Method details”run()
Section titled “run() ”public function run(PHPForge\Scaffold\Config\ProjectContext $context, PHPForge\Scaffold\Console\OutputWriter $out, bool $force = false, bool $deleteModified = false, bool $exitCode = false): intPreviews or prunes the orphaned entries of the project lock, ending with a summary line.
Parameters
| Parameter | Type | Description |
|---|---|---|
$context | PHPForge\ | Project to prune. |
$out | PHPForge\ | Output sink. |
$force | bool | Whether to remove the orphan entries from the lock and delete the unmodified orphan files. |
$deleteModified | bool | Whether $force also deletes orphan files that hold consumer content. |
$exitCode | bool | Whether a preview returns 1 when orphans exist. |
Returns
int: 1 when a provider manifest cannot be loaded or a file or directory cannot be deleted, or with $exitCode when a preview finds orphans; 0 otherwise.
Throws
RuntimeException: when the lock file cannot be read or written.