Skip to content

Commit 4bbc9bf

Browse files
committed
MAGE-941 Rename EventProcessor service (singular form)
1 parent e4fb08c commit 4bbc9bf

File tree

7 files changed

+35
-35
lines changed

7 files changed

+35
-35
lines changed

Api/Insights/EventsProcessorInterface.php renamed to Api/Insights/EventProcessorInterface.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Magento\Sales\Model\Order;
1010
use Magento\Store\Model\StoreManagerInterface;
1111

12-
interface EventsProcessorInterface
12+
interface EventProcessorInterface
1313
{
1414
/** @var string */
1515
public const EVENT_KEY_SUBTYPE = 'eventSubtype';
@@ -37,13 +37,13 @@ interface EventsProcessorInterface
3737
/** @var int */
3838
public const MAX_EVENTS_PER_REQUEST = 1000;
3939

40-
public function setInsightsClient(InsightsClient $client): EventsProcessorInterface;
40+
public function setInsightsClient(InsightsClient $client): EventProcessorInterface;
4141

42-
public function setAuthenticatedUserToken(string $token): EventsProcessorInterface;
42+
public function setAuthenticatedUserToken(string $token): EventProcessorInterface;
4343

44-
public function setAnonymousUserToken(string $token): EventsProcessorInterface;
44+
public function setAnonymousUserToken(string $token): EventProcessorInterface;
4545

46-
public function setStoreManager(StoreManagerInterface $storeManager): EventsProcessorInterface;
46+
public function setStoreManager(StoreManagerInterface $storeManager): EventProcessorInterface;
4747

4848
/**
4949
* @param string $eventName

Helper/InsightsHelper.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Algolia\AlgoliaSearch\Helper;
44

5-
use Algolia\AlgoliaSearch\Api\Insights\EventsProcessorInterface;
6-
use Algolia\AlgoliaSearch\Api\Insights\EventsProcessorInterfaceFactory;
5+
use Algolia\AlgoliaSearch\Api\Insights\EventProcessorInterface;
6+
use Algolia\AlgoliaSearch\Api\Insights\EventProcessorInterfaceFactory;
77
use Algolia\AlgoliaSearch\Api\InsightsClient;
88
use Algolia\AlgoliaSearch\Helper\Configuration\PersonalizationHelper;
99
use Magento\Customer\Model\Customer;
@@ -40,18 +40,18 @@ class InsightsHelper
4040
/** @var InsightsClient|null */
4141
protected ?InsightsClient $insightsClient = null;
4242

43-
/** @var EventsProcessorInterface|null */
44-
protected ?EventsProcessorInterface $eventsProcessor = null;
43+
/** @var EventProcessorInterface|null */
44+
protected ?EventProcessorInterface $eventProcessor = null;
4545

4646
public function __construct(
47-
private readonly ConfigHelper $configHelper,
48-
private readonly PersonalizationHelper $personalizationHelper,
49-
private readonly CookieManagerInterface $cookieManager,
50-
private readonly CookieMetadataFactory $cookieMetadataFactory,
51-
private readonly CustomerSession $customerSession,
52-
private readonly EventsProcessorInterfaceFactory $eventsProcessorFactory,
53-
private readonly StoreManagerInterface $storeManager,
54-
private readonly Logger $logger
47+
private readonly ConfigHelper $configHelper,
48+
private readonly PersonalizationHelper $personalizationHelper,
49+
private readonly CookieManagerInterface $cookieManager,
50+
private readonly CookieMetadataFactory $cookieMetadataFactory,
51+
private readonly CustomerSession $customerSession,
52+
private readonly EventProcessorInterfaceFactory $eventProcessorFactory,
53+
private readonly StoreManagerInterface $storeManager,
54+
private readonly Logger $logger
5555
)
5656
{}
5757

@@ -82,19 +82,19 @@ public function getInsightsClient(): InsightsClient
8282
}
8383

8484
/**
85-
* @return EventsProcessorInterface
85+
* @return EventProcessorInterface
8686
*/
87-
public function getEventsProcessor(): EventsProcessorInterface
87+
public function getEventProcessor(): EventProcessorInterface
8888
{
89-
if (!$this->eventsProcessor) {
90-
$this->eventsProcessor = $this->eventsProcessorFactory->create([
89+
if (!$this->eventProcessor) {
90+
$this->eventProcessor = $this->eventProcessorFactory->create([
9191
'client' => $this->getInsightsClient(),
9292
'userToken' => $this->getAnonymousUserToken(),
9393
'authenticatedUserToken' => $this->getAuthenticatedUserToken(),
9494
'storeManager' => $this->storeManager
9595
]);
9696
}
97-
return $this->eventsProcessor;
97+
return $this->eventProcessor;
9898
}
9999

100100
public function getAnonymousUserToken(): string

Observer/Insights/CheckoutCartProductAddAfter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function execute(Observer $observer): void
6767
return;
6868
}
6969

70-
$eventsProcessor = $this->insightsHelper->getEventsProcessor();
70+
$eventProcessor = $this->insightsHelper->getEventProcessor();
7171

7272
$queryId = $this->request->getParam('queryID');
7373

@@ -79,7 +79,7 @@ public function execute(Observer $observer): void
7979
// This logic handles both perso and conversion tracking
8080
if ($isAddToCartTracked) {
8181
try {
82-
$eventsProcessor->convertAddToCart(
82+
$eventProcessor->convertAddToCart(
8383
__('Added to Cart'),
8484
$this->productHelper->getIndexName($storeId),
8585
$quoteItem,

Observer/Insights/CheckoutOnePageControllerSuccessAction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ public function execute(Observer $observer): void
5353
return;
5454
}
5555

56-
$eventsProcessor = $this->insightsHelper->getEventsProcessor();
56+
$eventProcessor = $this->insightsHelper->getEventProcessor();
5757

5858
try {
59-
$eventsProcessor->convertPurchase(
59+
$eventProcessor->convertPurchase(
6060
__(self::PLACE_ORDER_EVENT_NAME),
6161
$indexName,
6262
$order

Observer/Insights/WishlistProductAddAfter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ public function execute(Observer $observer): void
3535
return;
3636
}
3737

38-
$eventsProcessor = $this->insightsHelper->getEventsProcessor();
38+
$eventProcessor = $this->insightsHelper->getEventProcessor();
3939
$productIds = array_map(function (Item $item) {
4040
return $item->getProductId();
4141
}, $items);
4242

4343
try {
44-
$eventsProcessor->convertedObjectIDs(
44+
$eventProcessor->convertedObjectIDs(
4545
__('Added to Wishlist'),
4646
$this->productHelper->getIndexName($firstItem->getStoreId()),
4747
$productIds

Service/Insights/EventsProcessor.php renamed to Service/Insights/EventProcessor.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Algolia\AlgoliaSearch\Service\Insights;
44

5-
use Algolia\AlgoliaSearch\Api\Insights\EventsProcessorInterface;
5+
use Algolia\AlgoliaSearch\Api\Insights\EventProcessorInterface;
66
use Algolia\AlgoliaSearch\Api\InsightsClient;
77
use Algolia\AlgoliaSearch\Exceptions\AlgoliaException;
88
use Algolia\AlgoliaSearch\Helper\InsightsHelper;
@@ -12,7 +12,7 @@
1212
use Magento\Sales\Model\Order\Item as OrderItem;
1313
use Magento\Store\Model\StoreManagerInterface;
1414

15-
class EventsProcessor implements EventsProcessorInterface
15+
class EventProcessor implements EventProcessorInterface
1616
{
1717
/** @var string */
1818
protected const NO_QUERY_ID_KEY = '__NO_QUERY_ID__';
@@ -24,25 +24,25 @@ public function __construct(
2424
protected ?StoreManagerInterface $storeManager = null
2525
) {}
2626

27-
public function setInsightsClient(InsightsClient $client): EventsProcessorInterface
27+
public function setInsightsClient(InsightsClient $client): EventProcessorInterface
2828
{
2929
$this->client = $client;
3030
return $this;
3131
}
3232

33-
public function setAnonymousUserToken(string $token): EventsProcessorInterface
33+
public function setAnonymousUserToken(string $token): EventProcessorInterface
3434
{
3535
$this->userToken = $token;
3636
return $this;
3737
}
3838

39-
public function setAuthenticatedUserToken(string $token): EventsProcessorInterface
39+
public function setAuthenticatedUserToken(string $token): EventProcessorInterface
4040
{
4141
$this->authenticatedUserToken = $token;
4242
return $this;
4343
}
4444

45-
public function setStoreManager(StoreManagerInterface $storeManager): EventsProcessorInterface
45+
public function setStoreManager(StoreManagerInterface $storeManager): EventProcessorInterface
4646
{
4747
$this->storeManager = $storeManager;
4848
return $this;

etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<!-- Declare implementation for QueueArchiveInterface -->
3434
<preference for="Algolia\AlgoliaSearch\Api\Data\QueueArchiveInterface" type="Algolia\AlgoliaSearch\Model\QueueArchive" />
3535

36-
<preference for="Algolia\AlgoliaSearch\Api\Insights\EventsProcessorInterface" type="Algolia\AlgoliaSearch\Service\Insights\EventsProcessor"/>
36+
<preference for="Algolia\AlgoliaSearch\Api\Insights\EventProcessorInterface" type="Algolia\AlgoliaSearch\Service\Insights\EventProcessor"/>
3737

3838
<preference for="Algolia\AlgoliaSearch\Api\Product\ReplicaManagerInterface" type="Algolia\AlgoliaSearch\Service\Product\ReplicaManager"/>
3939

0 commit comments

Comments
 (0)