Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge master into beta #242

Merged
merged 9 commits into from
Dec 20, 2024
2 changes: 1 addition & 1 deletion Controller/Ajax/Analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(
/**
* @return ResponseInterface|Json|ResultInterface
*/
public function execute()
public function execute(): ResponseInterface|Json|ResultInterface
{
$result = $this->resultJsonFactory->create();
if ($this->config->isAnalyticsEnabled()) {
Expand Down
4 changes: 2 additions & 2 deletions Model/Client/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public function setProfileKey(string $profileKey)
/**
* @return string|null
*/
public function setParameterArray(string $parameter, array $value)
public function setParameterArray(string $parameter, array $value): Request
{
$this->parameters[$parameter] = $value;
return $this;
Expand All @@ -339,7 +339,7 @@ public function setParameterArray(string $parameter, array $value)
/**
* @return string|null
*/
public function isPostRequest()
public function isPostRequest(): bool
{
return false;
}
Expand Down
10 changes: 5 additions & 5 deletions Model/Client/Request/AnalyticsRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,39 @@ class AnalyticsRequest extends Request
/**
* @return string
*/
public function isPostRequest()
public function isPostRequest(): bool
{
return true;
}

/**
* @return string
*/
public function getApiurl()
public function getApiurl(): string
{
return $this->apiUrl;
}

/**
* @return void
*/
public function setProfileKey(string $profileKey)
public function setProfileKey(string $profileKey): void
{
$this->setParameter('ProfileKey', $profileKey);
}

/**
* @return void
*/
public function setPath($path)
public function setPath($path): void
{
$this->path = $path;
}

/**
* @return string
*/
public function getProfileKey()
public function getProfileKey(): string
{
$profileKey = $this->getCookie($this->config->getPersonalMerchandisingCookieName());
if (!$profileKey) {
Expand Down
6 changes: 3 additions & 3 deletions Model/Client/Request/PurchaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ class PurchaseRequest extends Request
/**
* @return true
*/
public function isPostRequest()
public function isPostRequest(): bool
{
return true;
}

/**
* @return mixed|string
*/
public function getApiurl()
public function getApiurl(): string
{
return $this->apiUrl;
}
Expand All @@ -47,7 +47,7 @@ public function getApiurl()
*
* @return void
*/
public function setProfileKey(string $profileKey)
public function setProfileKey(string $profileKey): void
{
$this->setParameter('ProfileKey', $profileKey);
}
Expand Down
10 changes: 5 additions & 5 deletions Model/PersonalMerchandisingConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ public function __construct(
* @param Store|null $store
* @return bool
*/
public function isAnalyticsEnabled(Store $store = null)
public function isAnalyticsEnabled(Store $store = null): bool
{
return (bool)$this->getStoreConfig('tweakwise/personal_merchandising/analytics_enabled', $store);
}

/**
* @return string|null
*/
public function getProfileKey()
public function getProfileKey(): ?string
{
$profileKey = $this->cookieManager->getCookie(
$this->getPersonalMerchandisingCookieName(),
Expand All @@ -61,9 +61,9 @@ public function getProfileKey()
}

/**
* @return string
* @return CookieMetadataInterface
*/
private function getCookieMetadata()
private function getCookieMetadata(): CookieMetadataInterface
{
return $this->cookieMetadataFactory
->createPublicCookieMetadata()
Expand All @@ -75,7 +75,7 @@ private function getCookieMetadata()
/**
* @return string
*/
private function generateProfileKey()
private function generateProfileKey(): string
{
return uniqid('', true);
}
Expand Down
6 changes: 3 additions & 3 deletions Observer/TweakwiseCheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public function __construct(
* @return void
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function execute(Observer $observer)
public function execute(Observer $observer): void
{
if ($this->config->isAnalyticsEnabled('tweakwise/personal_merchandising/analytics_enabled')) {
if ($this->config->isAnalyticsEnabled()) {
$order = $observer->getEvent()->getOrder();
// Get the order items
$items = $order->getAllItems();
Expand All @@ -60,7 +60,7 @@ public function execute(Observer $observer)
* @return void
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
private function sendCheckout($items)
private function sendCheckout($items): void
{
$storeId = (int)$this->storeManager->getStore()->getId();
$profileKey = $this->config->getProfileKey();
Expand Down
Loading