diff --git a/src/Messenger/Message/AbstractRefresh.php b/src/Messenger/Message/AbstractRefresh.php index f508301..22d03e5 100644 --- a/src/Messenger/Message/AbstractRefresh.php +++ b/src/Messenger/Message/AbstractRefresh.php @@ -11,16 +11,16 @@ abstract class AbstractRefresh /** @var class-string */ public string $className; public int $id; - private bool $stopPropagateEvents = false; + private bool $shouldStopEventPropagation = false; public function isEventPropagationStopped(): bool { - return $this->stopPropagateEvents; + return $this->shouldStopEventPropagation; } public function stopEventPropagation(): void { - $this->stopPropagateEvents = true; + $this->setShouldStopEventPropagation(true); } protected function setElement(ElementInterface $element): void @@ -29,8 +29,8 @@ protected function setElement(ElementInterface $element): void $this->id = $element->getId() ?? throw new \InvalidArgumentException('Pimcore ID is null.'); } - protected function setPropagateEvents(bool $stopPropagateEvents): void + protected function setShouldStopEventPropagation(bool $stopEventPropagation): void { - $this->stopPropagateEvents = $stopPropagateEvents; + $this->shouldStopEventPropagation = $stopEventPropagation; } } diff --git a/src/Messenger/Message/RefreshElement.php b/src/Messenger/Message/RefreshElement.php index 2da3213..5621d13 100644 --- a/src/Messenger/Message/RefreshElement.php +++ b/src/Messenger/Message/RefreshElement.php @@ -8,9 +8,11 @@ class RefreshElement extends AbstractRefresh { - public function __construct(ElementInterface $element, bool $stopPropagateEvents = false) - { + public function __construct( + ElementInterface $element, + bool $stopEventPropagation = false, + ) { $this->setElement($element); - $this->setPropagateEvents($stopPropagateEvents); + $this->setShouldStopEventPropagation($stopEventPropagation); } } diff --git a/src/Messenger/Message/RefreshElementInIndex.php b/src/Messenger/Message/RefreshElementInIndex.php index 1e81c78..f21ed3d 100644 --- a/src/Messenger/Message/RefreshElementInIndex.php +++ b/src/Messenger/Message/RefreshElementInIndex.php @@ -11,9 +11,9 @@ class RefreshElementInIndex extends AbstractRefresh public function __construct( ElementInterface $element, public readonly string $index, - bool $stopPropagateEvents = false, + bool $stopEventPropagation = false, ) { - $this->setPropagateEvents($stopPropagateEvents); + $this->setShouldStopEventPropagation($stopEventPropagation); $this->setElement($element); } } diff --git a/src/Service/PropagateChanges.php b/src/Service/PropagateChanges.php index 5038cd6..4ea30e8 100644 --- a/src/Service/PropagateChanges.php +++ b/src/Service/PropagateChanges.php @@ -21,7 +21,7 @@ class PropagateChanges { - private static bool $propagationStopped = false; + private static bool $isPropagationStopped = false; public function __construct( private readonly IndexRepository $indexRepository, @@ -42,7 +42,7 @@ public function handle(AbstractElement $element): void $event = new RefreshedElementEvent($element, $indices); - if (!self::$propagationStopped) { + if (!self::$isPropagationStopped) { $this->eventDispatcher->dispatch($event, ElasticaBridgeEvents::PRE_REFRESH_ELEMENT); } @@ -51,12 +51,12 @@ public function handle(AbstractElement $element): void new RefreshElementInIndex( $element, $index->getName(), - self::$propagationStopped || $event->isPropagationStopped() + self::$isPropagationStopped || $event->isPropagationStopped() ) ); } - if (!self::$propagationStopped && !$event->isPropagationStopped()) { + if (!self::$isPropagationStopped && !$event->isPropagationStopped()) { $this->eventDispatcher->dispatch($event, ElasticaBridgeEvents::POST_REFRESH_ELEMENT); } } @@ -71,7 +71,7 @@ public function handleIndex( public static function stopPropagation(): void { - self::$propagationStopped = true; + self::$isPropagationStopped = true; } private function doHandleIndex( @@ -109,7 +109,7 @@ private function doHandleIndex( $event = new RefreshedElementInIndexEvent($element, $index, $elasticaIndex, $operation); - if (!self::$propagationStopped) { + if (!self::$isPropagationStopped) { $this->eventDispatcher->dispatch($event, ElasticaBridgeEvents::PRE_REFRESH_ELEMENT_IN_INDEX); } @@ -120,7 +120,7 @@ private function doHandleIndex( ElementInIndexOperation::NOTHING => null, }; - if (!self::$propagationStopped && !$event->isPropagationStopped()) { + if (!self::$isPropagationStopped && !$event->isPropagationStopped()) { $this->eventDispatcher->dispatch($event, ElasticaBridgeEvents::POST_REFRESH_ELEMENT_IN_INDEX); }