ApplyPreviewer
API reference › Scaffold › Services › ApplyPreviewer
Computes in memory what applying a provider mapping would write to its destination, without touching the disk.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
preview() | Returns the current and proposed content of the mapping destination: the stub for replace and preserve, the merge result for append, and the prepended block for prepend. | ApplyPreviewer |
Method details
Section titled “Method details”preview()
Section titled “preview() ”public function preview(PHPForge\Scaffold\Manifest\FileMapping $mapping, string $projectRoot, PHPForge\Scaffold\Services\LockEntry|null $entry = null): PHPForge\Scaffold\Services\ApplyPreviewReturns the current and proposed content of the mapping destination: the stub for replace and preserve, the
merge result for append, and the prepended block for prepend.
Parameters
| Parameter | Type | Description |
|---|---|---|
$mapping | PHPForge\ | Validated mapping to preview. |
$projectRoot | string | Absolute path to the project root. |
$entry | PHPForge\ | Lock entry of the destination, or null when it is untracked. |
Returns
ApplyPreview: Current and proposed content of the destination, with its replace and preserve flags.
Throws
RuntimeException: when the stub is missing or a file cannot be read or hashed.