HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/vhost/disk-apps/magento.bikenow.co/vendor/magento/module-reports/Model/ReportStatus.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\Reports\Model;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\Exception\InputException;

/**
 * Is report for specified event type is enabled in system configuration
 */
class ReportStatus
{
    /**
     * @var ScopeConfigInterface
     */
    private $scopeConfig;

    /**
     * ReportStatus constructor.
     *
     * @param ScopeConfigInterface $scopeConfig
     */
    public function __construct(ScopeConfigInterface $scopeConfig)
    {
        $this->scopeConfig = $scopeConfig;
    }

    /**
     * Is report for specified event type is enabled in system configuration
     *
     * @param string $reportEventType
     * @return bool
     * @throws InputException
     */
    public function isReportEnabled(string $reportEventType): bool
    {
        return $this->scopeConfig->isSetFlag('reports/options/enabled')
            && $this->scopeConfig->isSetFlag($this->getConfigPathByEventType($reportEventType));
    }

    /**
     * Get Config Path By Event Type
     *
     * @param string $reportEventType
     * @return string
     * @throws InputException
     */
    private function getConfigPathByEventType(string $reportEventType): string
    {
        $typeToPathMap = [
            Event::EVENT_PRODUCT_VIEW => 'reports/options/product_view_enabled',
            Event::EVENT_PRODUCT_SEND => 'reports/options/product_send_enabled',
            Event::EVENT_PRODUCT_COMPARE => 'reports/options/product_compare_enabled',
            Event::EVENT_PRODUCT_TO_CART => 'reports/options/product_to_cart_enabled',
            Event::EVENT_PRODUCT_TO_WISHLIST => 'reports/options/product_to_wishlist_enabled',
            Event::EVENT_WISHLIST_SHARE => 'reports/options/wishlist_share_enabled',
        ];

        if (!isset($typeToPathMap[$reportEventType])) {
            throw new InputException(
                __('System configuration is not found for report event type "%1"', $reportEventType)
            );
        }

        return $typeToPathMap[$reportEventType];
    }
}