Skip to content

Commit

Permalink
MAGE-866: commit cherry-picked from 864
Browse files Browse the repository at this point in the history
  • Loading branch information
cammonro authored and mrahman3177 committed May 21, 2024
1 parent 8aa0274 commit 76ae6f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
23 changes: 10 additions & 13 deletions ViewModel/Adminhtml/Analytics/Overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Algolia\AlgoliaSearch\ViewModel\Adminhtml\BackendView;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Locale\ResolverInterface;
use Magento\Store\Api\Data\StoreInterface;

class Overview implements \Magento\Framework\View\Element\Block\ArgumentInterface
Expand All @@ -17,22 +18,14 @@ 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 array */
private $analyticsParams = [];

/**
* @param BackendView $backendView
* @param AnalyticsHelper $analyticsHelper
* @param IndexEntityDataProvider $indexEntityDataProvider
* @param ResolverInterface $localeResolver
*/
public function __construct(
protected BackendView $backendView,
Expand All @@ -49,9 +42,13 @@ public function getBackendView()
return $this->backendView;
}

public function getTimeZone()
/**
* @return string
* @throws NoSuchEntityException
*/
public function getTimeZone(): string
{
return $this->backendView->getDateTime()->getConfigTimezone(
return (string) $this->backendView->getDateTime()->getConfigTimezone(
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
$this->getStore()->getId()
);
Expand All @@ -76,7 +73,7 @@ public function getIndexName()
*
* @return array
*/
public function getAnalyticsParams($additional = [])
public function getAnalyticsParams(array $additional = []): array
{
if (empty($this->analyticsParams)) {
$params = ['index' => $this->getIndexName()];
Expand Down Expand Up @@ -332,7 +329,7 @@ public function getNoResultSearches()
*
* @return bool
*/
public function checkIsValidDateRange()
public function checkIsValidDateRange(): bool
{
if ($formData = $this->getBackendView()->getBackendSession()->getAlgoliaAnalyticsFormData()) {
if (!empty($formData['from'])) {
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"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 76ae6f6

Please sign in to comment.