Smile-SA/elasticsuite

View on GitHub
src/module-elasticsuite-tracker/Model/Customer/TrackingService.php

Summary

Maintainability
A
2 hrs
Test Coverage

Showing 3 of 3 total issues

Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

\Smile\ElasticsuiteTracker\Model\ResourceModel\CustomerLink $customerLinkResource,
\Smile\ElasticsuiteTracker\Helper\Data $helper,
\Smile\ElasticsuiteTracker\Api\EventQueueInterface $eventQueue,
\Magento\Customer\Model\Session $customerSession,
\Smile\ElasticsuiteTracker\Helper\BotDetector $botDetector
Severity: Minor
Found in src/module-elasticsuite-tracker/Model/Customer/TrackingService.php - About 35 mins to fix

    Function addCustomerLink has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    private function addCustomerLink(&$eventData)
    {
    // The customerId should be sent by the frontend, if any.
    $customerId = $eventData['customer']['id'] ?? null;
    if ($customerId !== null && ((int) $customerId > 0)) {
    Severity: Minor
    Found in src/module-elasticsuite-tracker/Model/Customer/TrackingService.php - About 35 mins to fix

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    public function __construct(
    \Smile\ElasticsuiteTracker\Model\ResourceModel\CustomerLink $customerLinkResource,
    \Smile\ElasticsuiteTracker\Helper\Data $helper,
    \Smile\ElasticsuiteTracker\Api\EventQueueInterface $eventQueue,
    \Magento\Customer\Model\Session $customerSession,
    src/module-elasticsuite-analytics/Model/Search/Usage/Terms/AggregationProvider.php on lines 62..74
    src/module-elasticsuite-catalog/Model/Product/Search/Position.php on lines 61..73
    Category
    Status