49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* @package Plumrocket_GlobalPrivacyControl
|
|
* @copyright Copyright (c) 2025 Plumrocket Inc.
|
|
* @license https://plumrocket.com/license End-user License Agreement
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Plumrocket\GlobalPrivacyControl\Model;
|
|
|
|
use Magento\Framework\Stdlib\BooleanUtils;
|
|
use Magento\Framework\Stdlib\Cookie\CookieReaderInterface;
|
|
use Plumrocket\GlobalPrivacyControl\Api\IsGpcSignalHandledInterface;
|
|
|
|
class IsGpcSignalHandled implements IsGpcSignalHandledInterface
|
|
{
|
|
/**
|
|
* @var \Magento\Framework\Stdlib\BooleanUtils
|
|
*/
|
|
private $booleanUtils;
|
|
|
|
/**
|
|
* @var \Magento\Framework\Stdlib\Cookie\CookieReaderInterface
|
|
*/
|
|
private $cookieReader;
|
|
|
|
/**
|
|
* @param \Magento\Framework\Stdlib\BooleanUtils $booleanUtils
|
|
* @param \Magento\Framework\Stdlib\Cookie\CookieReaderInterface $cookieReader
|
|
*/
|
|
public function __construct(
|
|
BooleanUtils $booleanUtils,
|
|
CookieReaderInterface $cookieReader
|
|
) {
|
|
$this->booleanUtils = $booleanUtils;
|
|
$this->cookieReader = $cookieReader;
|
|
}
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
public function execute(): bool
|
|
{
|
|
$status = $this->cookieReader->getCookie(self::COOKIE_NAME);
|
|
return $status && $this->booleanUtils->toBoolean($status);
|
|
}
|
|
}
|