Skip to content
PHP Ecosystem
Explore

PruneService

API reference › Scaffold › Services › PruneService

final classPHPForge\Scaffold\Services\PruneService
Sourcesrc/Services/PruneService.php

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.

MethodDescriptionDefined by
run()Previews or prunes the orphaned entries of the project lock, ending with a summary line.PruneService
public function run(PHPForge\Scaffold\Config\ProjectContext $context, PHPForge\Scaffold\Console\OutputWriter $out, bool $force = false, bool $deleteModified = false, bool $exitCode = false): int

Previews or prunes the orphaned entries of the project lock, ending with a summary line.

Parameters

ParameterTypeDescription
$contextPHPForge\Scaffold\Config\ProjectContextProject to prune.
$outPHPForge\Scaffold\Console\OutputWriterOutput sink.
$forceboolWhether to remove the orphan entries from the lock and delete the unmodified orphan files.
$deleteModifiedboolWhether $force also deletes orphan files that hold consumer content.
$exitCodeboolWhether 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