Skip to content
PHP Ecosystem
Explore

AbstractLineMergeStrategy

API reference › Scaffold › Merge › AbstractLineMergeStrategy

abstract classPHPForge\Scaffold\Merge\AbstractLineMergeStrategy
ImplementsMergeStrategy
Sourcesrc/Merge/AbstractLineMergeStrategy.php
3 subclasses

Provides the merge pipeline shared by the line-oriented strategies.

MethodDescriptionDefined by
merge()Adds the provider entries missing from the consumer.AbstractLineMergeStrategy
plan() protected abstractComputes the insertions that make the consumer satisfy the provider.AbstractLineMergeStrategy
public function merge(string $provider, string $consumer): PHPForge\Scaffold\Merge\MergeResult

Adds the provider entries missing from the consumer.

Parameters

ParameterTypeDescription
$providerstringProvider content whose missing entries are added.
$consumerstringConsumer content; an empty string stands for an absent file.

Returns

MergeResult: Merged content and whether it differs from the consumer.

abstract protected function plan(list<string> $provider, list<string> $consumer): PHPForge\Scaffold\Merge\MergePlan

Computes the insertions that make the consumer satisfy the provider.

Parameters

ParameterTypeDescription
$providerlist<string>Provider lines.
$consumerlist<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.