From 7b089a1b3d002414b1e50ba71b177b582456d05f Mon Sep 17 00:00:00 2001 From: Mohammad Rahman Date: Wed, 29 May 2024 08:49:49 -0400 Subject: [PATCH] MAGE-866: code updated as per code review --- Helper/AnalyticsHelper.php | 25 ++++++++++++++++--- ViewModel/Adminhtml/Analytics/Overview.php | 29 ++++++++++++++++++---- composer.json | 1 - 3 files changed, 45 insertions(+), 10 deletions(-) diff --git a/Helper/AnalyticsHelper.php b/Helper/AnalyticsHelper.php index 459cf022a..5987da55e 100644 --- a/Helper/AnalyticsHelper.php +++ b/Helper/AnalyticsHelper.php @@ -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'; @@ -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(); } diff --git a/ViewModel/Adminhtml/Analytics/Overview.php b/ViewModel/Adminhtml/Analytics/Overview.php index 7ccc91a39..f03b0168e 100644 --- a/ViewModel/Adminhtml/Analytics/Overview.php +++ b/ViewModel/Adminhtml/Analytics/Overview.php @@ -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 diff --git a/composer.json b/composer.json index 7d77e5827..bc18202ab 100755 --- a/composer.json +++ b/composer.json @@ -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",