Skip to content

Commit

Permalink
MAGE-866: code updated as per code review
Browse files Browse the repository at this point in the history
  • Loading branch information
mrahman3177 committed May 29, 2024
1 parent 76ae6f6 commit 7b089a1
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 10 deletions.
25 changes: 21 additions & 4 deletions Helper/AnalyticsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ class AnalyticsHelper
public const ANALYTICS_HITS_PATH = '/2/hits';
public const ANALYTICS_FILTER_PATH = '/2/filters';
public const ANALYTICS_CLICKS_PATH = '/2/clicks';

/** @var ConfigHelper */
private $configHelper;

/** @var IndexEntityDataProvider */
private $entityHelper;

/** @var Logger */
private $logger;

/** @var ResolverInterface */
private $localeResolver;

public const DATE_FORMAT_PICKER = 'dd MMM yyyy';
public const DATE_FORMAT_API = 'Y-m-d';

Expand Down Expand Up @@ -55,11 +68,15 @@ class AnalyticsHelper
* @param ResolverInterface $localeResolver
*/
public function __construct(
private ConfigHelper $configHelper,
private IndexEntityDataProvider $entityHelper,
private Logger $logger,
private ResolverInterface $localeResolver
ConfigHelper $configHelper,
IndexEntityDataProvider $entityHelper,
Logger $logger,
ResolverInterface $localeResolver
) {
$this->configHelper = $configHelper;
$this->entityHelper = $entityHelper;
$this->logger = $logger;
$this->localeResolver = $localeResolver;
$this->region = $this->configHelper->getAnalyticsRegion();
}

Expand Down
29 changes: 24 additions & 5 deletions ViewModel/Adminhtml/Analytics/Overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,40 @@ class Overview implements \Magento\Framework\View\Element\Block\ArgumentInterfac

public const DEFAULT_RETENTION_DAYS = 90;

/** @var BackendView */
private $backendView;

/** @var AnalyticsHelper */
private $analyticsHelper;

/** @var IndexEntityDataProvider */
private $indexEntityDataProvider;

/** @var ResolverInterface */
private $localeResolver;

/** @var array */
private $analyticsParams = [];

/**
* Index constructor.
*
* @param BackendView $backendView
* @param AnalyticsHelper $analyticsHelper
* @param IndexEntityDataProvider $indexEntityDataProvider
* @param ResolverInterface $localeResolver
*/
public function __construct(
protected BackendView $backendView,
protected AnalyticsHelper $analyticsHelper,
protected IndexEntityDataProvider $indexEntityDataProvider,
protected ResolverInterface $localeResolver
) { }
BackendView $backendView,
AnalyticsHelper $analyticsHelper,
IndexEntityDataProvider $indexEntityDataProvider,
ResolverInterface $localeResolver
) {
$this->backendView = $backendView;
$this->analyticsHelper = $analyticsHelper;
$this->indexEntityDataProvider = $indexEntityDataProvider;
$this->localeResolver = $localeResolver;
}

/**
* @return BackendView
Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"license": ["MIT"],
"version": "3.13.2",
"require": {
"php": "~8.1|~8.2",
"magento/framework": "~102.0|~103.0",
"algolia/algoliasearch-client-php": "3.3.2",
"guzzlehttp/guzzle": "^6.3.3|^7.3.0",
Expand Down

0 comments on commit 7b089a1

Please sign in to comment.