AbstractLineMergeStrategy
API reference › Scaffold › Merge › AbstractLineMergeStrategy
3 subclasses
Provides the merge pipeline shared by the line-oriented strategies.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
merge() | Adds the provider entries missing from the consumer. | AbstractLineMergeStrategy |
plan() protected abstract | Computes the insertions that make the consumer satisfy the provider. | AbstractLineMergeStrategy |
Method details
Section titled “Method details”merge()
Section titled “merge() ”public function merge(string $provider, string $consumer): PHPForge\Scaffold\Merge\MergeResultAdds the provider entries missing from the consumer.
Parameters
| Parameter | Type | Description |
|---|---|---|
$provider | string | Provider content whose missing entries are added. |
$consumer | string | Consumer content; an empty string stands for an absent file. |
Returns
MergeResult: Merged content and whether it differs from the consumer.
plan()
Section titled “plan() ”abstract protected function plan(list<string> $provider, list<string> $consumer): PHPForge\Scaffold\Merge\MergePlanComputes the insertions that make the consumer satisfy the provider.
Parameters
| Parameter | Type | Description |
|---|---|---|
$provider | list<string> | Provider lines. |
$consumer | list<string> | Consumer lines without terminators. |
Returns
PHPForge\Scaffold\Merge\MergePlan: Lines to insert after a consumer line index (-1 inserts at the top) and blocks to append at the end; both empty when the consumer already satisfies the provider.