refactor: rename for intent (L3)
PostChangeResult is PostSaveFollowUp (the after-save pipeline, not a result); DiviChange::changed() is record() (moved nodes are recorded but not touched). cleanValue/withoutControls were renamed in wave 2. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
@@ -16,7 +16,7 @@ use LIT\MCP\Integrations\Divi\BlockTree\NodeSummary;
|
||||
final class DiviChange
|
||||
{
|
||||
/** @var list<array{block: ?Block, id: ?string, type: string, action: string, label: string}> */
|
||||
private array $changed = [];
|
||||
private array $entries = [];
|
||||
|
||||
/** @var list<Block> */
|
||||
private array $touched = [];
|
||||
@@ -32,9 +32,9 @@ final class DiviChange
|
||||
* A node that still exists after the change: "inserted", "updated", "moved" or "duplicated".
|
||||
* Every action but "moved" counts for the quality warnings.
|
||||
*/
|
||||
public function changed(Block $block, string $action): self
|
||||
public function record(Block $block, string $action): self
|
||||
{
|
||||
$this->changed[] = [
|
||||
$this->entries[] = [
|
||||
'block' => $block,
|
||||
'id' => null,
|
||||
'type' => $block->name(),
|
||||
@@ -51,7 +51,7 @@ final class DiviChange
|
||||
/** A node that is gone; $idBefore is its ID before the change. */
|
||||
public function removed(string $idBefore, Block $block): self
|
||||
{
|
||||
$this->changed[] = [
|
||||
$this->entries[] = [
|
||||
'block' => null,
|
||||
'id' => $idBefore,
|
||||
'type' => $block->name(),
|
||||
@@ -72,7 +72,7 @@ final class DiviChange
|
||||
/** @return list<array{block: ?Block, id: ?string, type: string, action: string, label: string}> */
|
||||
public function entries(): array
|
||||
{
|
||||
return $this->changed;
|
||||
return $this->entries;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -75,6 +75,6 @@ final class DiviDuplicateNodeAbility extends DiviWriteAbility
|
||||
));
|
||||
}
|
||||
|
||||
return (new DiviChange(sprintf('Knoten %s dupliziert', $id)))->changed($copy, 'duplicated');
|
||||
return (new DiviChange(sprintf('Knoten %s dupliziert', $id)))->record($copy, 'duplicated');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ final class DiviInsertAbility extends DiviWriteAbility
|
||||
|
||||
$change = new DiviChange(sprintf('%d Divi-Knoten eingefügt', count($composed['blocks'])));
|
||||
foreach ($composed['blocks'] as $block) {
|
||||
$change->changed($block, 'inserted');
|
||||
$change->record($block, 'inserted');
|
||||
}
|
||||
|
||||
return $change;
|
||||
|
||||
@@ -71,6 +71,6 @@ final class DiviMoveAbility extends DiviWriteAbility
|
||||
);
|
||||
}
|
||||
|
||||
return (new DiviChange(sprintf('Knoten %s verschoben', $id)))->changed($node, 'moved');
|
||||
return (new DiviChange(sprintf('Knoten %s verschoben', $id)))->record($node, 'moved');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ final class DiviReplaceTextAbility implements Ability
|
||||
$change = new DiviChange(sprintf('Text ersetzt (%d Stellen)', $found['count']));
|
||||
foreach ($found['blocks'] as [$block, $attrs]) {
|
||||
$block->setAttrs($attrs);
|
||||
$change->changed($block, 'updated');
|
||||
$change->record($block, 'updated');
|
||||
}
|
||||
|
||||
$saved = $this->writer->save($this->name(), $page, $change, $input);
|
||||
|
||||
@@ -146,7 +146,7 @@ final class DiviUpdateAbility extends DiviWriteAbility
|
||||
foreach ($updates as [$block, $attrs]) {
|
||||
// Composer::update() output: every client value already passed the choke point.
|
||||
$block->setAttrs($attrs);
|
||||
$change->changed($block, 'updated');
|
||||
$change->record($block, 'updated');
|
||||
}
|
||||
|
||||
return $change;
|
||||
|
||||
@@ -13,7 +13,7 @@ use LIT\MCP\Integrations\Divi\BlockTree\NodeIndex;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\Outline;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\Serializer;
|
||||
use LIT\MCP\Integrations\Divi\Design\DesignSystemReader;
|
||||
use LIT\MCP\Integrations\WordPress\PostChangeResult;
|
||||
use LIT\MCP\Integrations\WordPress\PostSaveFollowUp;
|
||||
use WP_Error;
|
||||
|
||||
/**
|
||||
@@ -114,7 +114,7 @@ class DiviWriter
|
||||
$warnings[] = self::OUTLINE_TRUNCATED;
|
||||
}
|
||||
|
||||
$result = (new PostChangeResult(
|
||||
$result = (new PostSaveFollowUp(
|
||||
$ability,
|
||||
$this->log,
|
||||
(int) $post->ID,
|
||||
|
||||
Reference in New Issue
Block a user